# Copyright 1999-2003 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 # $Header: $ DESCRIPTION="A family tree server, for creating/editing and serving family trees" HOMEPAGE="http://cristal.inria.fr/~ddr/GeneWeb/" SRC_URI="ftp://ftp.inria.fr/INRIA/Projects/cristal/geneweb/Src/${P}.tar.gz" LICENSE="GPL-2" SLOT="0" KEYWORDS="~x86" IUSE="" DEPEND=">=dev-lang/ocaml-3.06" #RDEPEND="" S=${WORKDIR}/${P} #source some environment variables, like GENEWEBDB . ${FILESDIR}/geneweb.conf.d src_compile() { make || die #upstream function: move everything to the ./distribution directory make distrib || die } src_install() { #install binaries into /usr cd ${S}/distribution/gw dobin consang ged2gwb gwb2ged gwc gwd gwu gwsetup #install manpages cd ${S}/man doman ged2gwb.1 gwb2ged.1 gwc.1 gwu.1 #install docs cd ${S}/distribution/gw dodoc CHANGES.txt INSTALL.htm LICENSE.txt LISEZMOI.txt README.txt #install html docs cd ${S}/distribution/gw/doc dohtml CREDITS.html LICENSE.htm index.htm docinto html/de dohtml -r de/* docinto html/en dohtml -r en/* docinto html/fr dohtml -r fr/* docinto html/images dohtml -r images/* docinto html/it dohtml -r nl/* docinto html/nl dohtml -r sv/* #now for the start-stop-restart script insinto /etc/init.d insopts -m0744 newins ${FILESDIR}/geneweb.init.d geneweb #the conf file insinto /etc/conf.d insopts -m0744 newins ${FILESDIR}/geneweb.conf.d geneweb #install some misc files insinto /usr/share/geneweb/etc cd ${S}/distribution/gw/etc doins * #install some misc images insinto /usr/share/geneweb/images cd ${S}/distribution/gw/images doins * #install some misc lang stuff insinto /usr/share/geneweb/lang cd ${S}/distribution/gw/lang doins * } pkg_postinst() { set -e RCFILE=/etc/conf.d/geneweb INITFILE=/etc/init.d/geneweb #If the user doesn't have a base directory, create one for him #and create a geneweb database as well if ! [ -d ${GENEWEBDB} ] then einfo "Creating geneweb database in ${GENEWEBDB}" einfo "The new database is called: example" mkdir -p ${GENEWEBDB} || die cp ${S}/distribution/gw/a.gwf ${GENEWEBDB}/example.gwf || die cd ${GENEWEBDB} || die gwc -o example || die fi #create some directories in the database if they don't exist if ! [ -d ${GENEWEBDB}/cnt ] then mkdir -p ${GENEWEBDB}/cnt || die fi if ! [ -d ${GENEWEBDB}/etc ] then mkdir -p ${GENEWEBDB}/etc || die fi if ! [ -d ${GENEWEBDB}/images ] then mkdir -p ${GENEWEBDB}/images || die fi chmod 0755 /usr/bin/gwd || die #Check if the groupadd program is installed and in path if [ ! -x `which groupadd` ]; then einfo "You must have groupadd installed"; die fi # Make sure user group is available, if not create it # enewgroup $GENEWEBGROUP # enewuser $GENEWEBUSER -1 /bin/bash ${GENEWEBDB} $GENEWEBGROUP if ! grep -q "^${GENEWEBGROUP}:" /etc/group; then einfo "Adding $GENEWEBGROUP group ... " groupadd $GENEWEBGROUP || die fi #Check if the useradd program installed and in path if [ ! -x `which useradd` ]; then einfo "You must have useradd installed" die fi # Make sure geneweb user doesn't exists if ! grep -q "^${GENEWEBUSER}:" /etc/passwd; then einfo "Adding $GENEWEBUSER user ... " useradd -g $GENEWEBGROUP -d ${GENEWEBDB} $GENEWEBUSER || die fi # If the log file doesn't exist, create it. if [ ! -x $LOGFILE ]; then einfo "Creating $LOGFILE ..." touch $LOGFILE fi # Thus all files created there will have geneweb as group chown root:$GENEWEBGROUP $GENEWEBDB $GENEWEBDB/images $GENEWEBDB/cnt $GENEWEBDB/etc $LOGFILE # The database directory is writable by geneweb group chmod ug+rwx,o-rwx $GENEWEBDB $GENEWEBDB/images $GENEWEBDB/cnt $GENEWEBDB/etc # SetGID bit on the database directory owned by geneweb group chmod g+s $GENEWEBDB $GENEWEBDB/images $GENEWEBDB/cnt $GENEWEBDB/etc # Copy files needed by gwsetup. if [ ! -e ${GENEWEBDB}/setup/lang ] then einfo "Creating ${GENEWEBDB}/setup/lang for gwsetup ..." mkdir -p ${GENEWEBDB}/setup/lang fi cd ${S}/distribution/gw/setup cp -R * ${GENEWEBDB}/setup # Fix incorrect database and images directories permissions # These directories have to be group-writable # as the daemon now runs with an unprivileged UID for base in `find $GENEWEBDB -type d -name \*.gwb` do chgrp $GENEWEBGROUP $base chmod g+w,g+s $base done for imagedir in `find $GENEWEBDB/images -type d` do chgrp $GENEWEBGROUP $imagedir chmod g+w,g+s $imagedir done einfo "An example database called 'example' has been" einfo "created in /home/geneweb" einfo "Go to http://localhost:$PORT and type in 'example'" einfo "to view the example database" einfo "Create a new database by typing: gwc -o " einfo "while in the $GENEWEBDB directory" } #pkg_prerm() { #Maybe add something here to make sure the dbs are safe. Like export them, or copy them to a new directory with the work "backup" appended #idea for future #} pkg_postrm() { einfo "You may safely remove the user ${GENEWEBUSER} and" einfo "the group ${GENEWEBGROUP}. See userdel and groupdel." #remove user and group # set -e # if grep -q "^${GENEWEBUSER}:" /etc/passwd; # then # einfo "Removing $GENEWEBUSER user ... " # userdel $GENEWEBUSER || die # fi # # # if grep -q "^${GENEWEBGROUP}:" /etc/group; # then # einfo "Removing $GENEWEBGROUP group ... " # groupdel $GENEWEBGROUP || die # fi }