# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/app-backup/backuppc/backuppc-2.1.2-r1.ebuild,v 1.2 2006/10/10 14:45:52 seemant Exp $ inherit eutils webapp IUSE="samba doc" MY_P=BackupPC-${PV} PATCH_VER=0.1 S=${WORKDIR}/${MY_P} DESCRIPTION="A high performance, enterprise grade backup system for backing up Linux, Windows, Mac OS X desktops and laptops to a server's disk. No client side software needed." HOMEPAGE="http://backuppc.sourceforge.net" SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.gz" #SRC_URI="http://superb-west.dl.sourceforge.net/sourceforge/backuppc/${MY_P}.tar.gz" LICENSE="GPL-2" KEYWORDS="~amd64 x86" DEPEND="dev-lang/perl" RDEPEND="dev-perl/File-RsyncP app-arch/par2cmdline app-arch/gzip app-arch/bzip2 app-arch/unzip dev-perl/Archive-Zip virtual/mta net-www/apache samba? ( net-fs/samba )" PATCHDIR=${WORKDIR}/gentoo/prepatch pkg_setup() { local backuppcuserid backuppcuserid="101" if ! egrep "^backuppc" -q /etc/passwd ; then while [ "$exitloop" != "1" ] ; do found=""; for i in `cut -d':' -f3 /etc/passwd` ; do if [ "$i" == "$backuppcuserid" ] ; then found=1 ; backuppcuserid=$(($backuppcuserid+1)); fi ; done ; if [ "$found" != "" ] ; then exitloop=1; fi ; done ; else backuppcuserid="`egrep '^backuppc' /etc/passwd | cut -d':' -f3 `" fi einfo "Using ${backuppcuserid} as the UID for the backuppc user" backuppcuseridG="${backuppcuserid}" enewgroup backuppc enewuser backuppc ${backuppcuseridG} -1 /dev/null backuppc webapp_pkg_setup } src_unpack() { unpack ${A}; cd ${S} epatch ${FILESDIR}/perlInterpreter.patch } src_compile() { find ./ -name 'CVS' -type d | xargs rm -rf echo "#include " > backuppc.c echo "#include " >> backuppc.c echo "#include " >> backuppc.c echo "int main(){" >> backuppc.c echo "setuid(${backuppcuseridG});" >> backuppc.c echo "system(\"./BackupPC_Admin\");" >> backuppc.c echo "return 0;" >> backuppc.c echo "}" >> backuppc.c einfo "gcc backuppc.c -o index.cgi" gcc backuppc.c -o index.cgi } src_test() { einfo "Can not test" } src_install() { local myconf myconf="" if use samba ; then myconf="--bin-path smbclient=$(type -p smbclient)" myconf="${myconf} --bin-path nmblookup=$(type -p nmblookup)" fi webapp_src_preinst einfo ${MY_HTDOCSDIR} dodir ${MY_HTDOCSDIR}/${PN} ./configure.pl \ --batch \ --bin-path perl=$(type -p perl) \ --bin-path tar=$(type -p tar) \ --bin-path rsync=$(type -p rsync) \ --bin-path ping=$(type -p ping) \ --bin-path df=$(type -p df) \ --bin-path ssh=$(type -p ssh) \ --bin-path sendmail=$(type -p sendmail) \ --bin-path hostname=$(type -p hostname) \ --bin-path gzip=$(type -p gzip) \ --bin-path bzip2=$(type -p bzip2) \ --hostname $(hostname) \ --uid-ignore \ --dest-dir ${D} \ --html-dir ${MY_HTDOCSDIR}/image \ --html-dir-url /${PN}/image \ --cgi-dir ${MY_HTDOCSDIR} \ --fhs \ ${myconf} || die "failed the configure.pl script" pod2man \ --section=8 \ --center="BackupPC manual" \ ${S}/doc/BackupPC.pod backuppc.8 || die "failed to generate man page" doman backuppc.8 diropts -m 750 -o backuppc -g backuppc keepdir /etc/BackupPC keepdir /var/log/BackupPC newinitd ${S}/init.d/gentoo-backuppc backuppc newconfd ${S}/init.d/gentoo-backuppc.conf backuppc insopts -m 0755 -o root -g backuppc insinto ${MY_HTDOCSDIR} doins index.cgi doins ${FILESDIR}/.htaccess insopts -g root -o backuppc -m 460 insinto /etc/BackupPC doins ${FILESDIR}/authUser webapp_postinst_txt \ en ${FILESDIR}/postinstall-en.txt || die "webapp_postinst_txt" webapp_hook_script ${FILESDIR}/fixperms webapp_src_install || die "webapp_src_install" } pkg_postinst() { webapp_pkg_postinst ebegin "Adjusting ownership of various things..." chown -Rf backuppc:backuppc /etc/BackupPC eend $? elog "Please read the documentation" elog "It is important to know that the webserver and the backuppc user" elog "*must* be one and the same" }