# Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit webapp MY_P="taskfreak-single-" DESCRIPTION="A Web-based task manager and todo list." HOMEPAGE="http://www.taskfreak.com" SRC_URI="mysql? ( http://weboperative.com/gentoo/distfiles/${MY_P}mysql-${PV}.tgz ) sqlite? ( http://weboperative.com/gentoo/distfiles/${MY_P}sqlite-${PV}.tgz )" LICENSE="GPL-2" KEYWORDS="~x86" IUSE="vhosts mysql sqlite" S="${WORKDIR}/${PN}" DEPEND="dev-lang/php mysql? ( dev-db/mysql ) sqlite? ( dev-db/sqlite )" src_install() { webapp_src_preinst cd "${S}" if use mysql; then einfo "copying mysql data" webapp_sqlscript mysql install/taskfreak_init.sql sed -i '31,34s/^/#/' config.php elif use sqlite; then einfo "copying sqlite data" sed -i 's#../config.php#config.php#' install/install_sqlite.php sed -i '24,28s/^/#/' config.php insopts -m0644 insinto ${MY_HTDOCSDIR} doins taskfreak.db install/install_sqlite.php webapp_serverowned ${MY_HTDOCSDIR}/taskfreak.db fi local htdocs="classes config.php context.css freak.css freak.js images \ index.php priority3.css priority5.css priority9.css project.php" insinto ${MY_HTDOCSDIR} for i in $htdocs; do doins -r $i; done dodoc install/{UPDATE.v02.txt,update_sqlite.v02.php} webapp_serverowned ${MY_HTDOCSDIR} webapp_configfile ${MY_HTDOCSDIR}/config.php webapp_src_install } pkg_postinst() { webapp_pkg_postinst einfo "to finish installation run the following command." einfo "emerge =${PF} --config" } pkg_config() { einfo "Creating the ${PN} database if necessary" if use mysql; then einfo "Configurating mysql database for ${PN}" einfo "enter password for the mysql 'root' user" ewarn "Avoid [\"'\\_%] characters in the password" read -rsp "" pwd1 einfo "Confirm the password" read -rsp "" pwd2 if [ "$pwd1" != "$pwd2" ]; then die "Passwords don't match" fi ${ROOT}/usr/bin/mysqladmin -uroot -p"${pwd1}" create ${PN} einfo "loading ${PN} mysql db" ${ROOT}/usr/bin/mysqladmin -uroot -p"$pwd1" $PN < ${MY_SQLSCRIPTSDIR}/taskfreak_init.sql elif use sqlite; then einfo "Point your web browser to http://localhost/taskfreak/install_sqlite.php" einfo "If you have created the taskfreak.db file, you might have to force the" einfo "creation of the database by clicking on the link that" einfo "says \"Click here to reset the database\"." einfo "if you get \"read-only permission error\" when adding a new task" einfo "run \"chmod apache:apache ${MY_HTDOCSDIR}/${PN}" fi }