# Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils webapp DESCRIPTION="Textpattern is a free, flexible, elegant, easy-to-use content management system for all kinds of websites, even weblogs." HOMEPAGE="http://www.textpattern.com/" SRC_URI="http://www.textpattern.com/dload/${P}.tar.gz" LICENSE="GPL-2" KEYWORDS="~x86" IUSE="" DEPEND=">=dev-db/mysql-3.23 >=virtual/httpd-php-4.3" src_compile() { einfo "Nothing to compile" } src_install() { einfo "Installing..." webapp_src_preinst cp -r . ${D}/${MY_HTDOCSDIR} cp .htaccess ${D}/${MY_HTDOCSDIR} dodoc textpattern/license.txt README for x in `find . -type f -print` ; do webapp_serverowned ${MY_HTDOCSDIR}/$x done rm -f ${D}/${MY_HTDOCSDIR}/README rm -f ${D}/${MY_HTDOCSDIR}/textpattern/license.txt webapp_src_install } pkg_postinst() { webapp_pkg_postinst einfo einfo "If this is a new install a database needs to be created. Either do it manually or run:" einfo "\"ebuild /var/db/pkg/${CATEGORY}/${PF}/${PF}.ebuild config\"" einfo "You need to know the MySQL user and password." einfo "For virtual hosts you can run:" einfo "\"webapp-config -I -u user -g group -h virtual.domain -d /htdocs/dir ${PN} ${PV}\"" einfo "In the Textpattern web root directory you will find an .htaccess which you might need to edit. If Textpattern is in a subdir of your web root then uncomment RewriteBase and specify the relative URI path to the root subdir of Textpattern." einfo "You should point to the top-most index.php. Don't confuse the index in the root dir with the one in the textpattern subdir." einfo "Finally you should point ypur browser to http://domain.com/URI_path_to_textpattern_root/textpattern/index.php (yes, the subdir)." einfo "Once you've finished the setup process you should consider removing the textpattern/setup dir and change permissions such as:" einfo "chmod 777 /images" einfo "chmod 777 /files" einfo } pkg_config() { # default values for db stuff D_DB="textpattern" D_HOST="localhost" D_USER="textpattern" # do we want to start mysqld? # /etc/init.d/mysql restart || die "mysql needs to be running" echo -n "mysql db name [${D_DB}]: "; read MY_DB if (test -z ${MY_DB}) ; then MY_DB=${D_DB} ; fi echo -n "mysql db host [${D_HOST}]: "; read MY_HOST if (test -z ${MY_HOST}) ; then MY_HOST=${D_HOST}; fi echo -n "mysql dbuser name [${D_USER}]: "; read MY_USER if (test -z ${MY_USER}) ; then MY_USER=${D_USER} ; fi echo -n "mysql dbuser password: "; read mypwd # it is advised to NOT allow bank passwords (uncomment): # if (test -z ${mypwd}) ; then die "Error: no dbuser password" ; fi # privileges echo -n "Please enter login info for user who has grant privileges on ${MY_HOST} [$USER]: "; read adminuser if (test -z ${adminuser}) ; then adminuser="$USER" ; fi if [ "${MY_HOST}" != "localhost" ]; then echo -n "Client address (at db side) [$(hostname -f)]: "; read clientaddr if (test -z ${clientaddr}) ; then clientaddr="$(hostname -f)" ; fi fi # this will be default for localhost if (test -z ${clientaddr}) ; then clientaddr="${MY_HOST}" ; fi # if $MY_HOST == localhost, don't specify -h argument, so local socket can be used. host=${MY_HOST/localhost} mysqladmin -u ${adminuser} ${host:+-h ${host}} -p create ${MY_DB} || die "Error creating database" mysql -u ${adminuser} ${host:+-h ${host}} -p mysql --exec="GRANT SELECT,INSERT,UPDATE,DELETE,INDEX, ALTER,CREATE,DROP,REFERENCES ON ${MY_DB}.* TO ${MY_USER}@${clientaddr} IDENTIFIED BY '${mypwd}'; FLUSH PRIVILEGES;" || { echo "Error running query!" echo echo "Please run it manually on ${host}." echo echo " \$ mysql -u ${adminuser} -p mysql --exec=\"GRANT SELECT,INSERT,UPDATE,DELETE,INDEX, ALTER,CREATE,DROP,REFERENCES ON ${MY_DB}.* TO ${MY_USER}@${clientaddr} IDENTIFIED BY '${mypwd}'; FLUSH PRIVILEGES;\"" echo } }