# Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils webapp MY_P=BackupPC-${PV} 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" LICENSE="GPL-2" KEYWORDS="~amd64 ~x86" IUSE="doc samba www" DEPEND="dev-lang/perl" RDEPEND="dev-perl/File-RsyncP dev-perl/Archive-Zip app-arch/par2cmdline app-arch/gzip app-arch/bzip2 app-arch/unzip virtual/mta samba? ( net-fs/samba ) www? ( net-www/apache www-apache/mod_perl )" pkg_setup() { enewgroup backuppc enewuser backuppc -1 -1 /dev/null backuppc if use www ; then webapp_pkg_setup fi } src_unpack() { unpack ${A}; cd ${S} epatch ${FILESDIR}/configure-sheebang.patch } src_compile() { find ./ -name 'CVS' -type d | xargs rm -rf } src_install() { local myconf if use samba ; then myconf="--bin-path smbclient=$(type -p smbclient)" myconf="$myconf --bin-path nmblookup=$(type -p nmblookup)" fi if use www ; then webapp_src_preinst dodir ${MY_HTDOCSDIR}/${PN} myconf="$myconf --html-dir=${MY_HTDOCSDIR}/image" myconf="$myconf --html-dir-url=/image" myconf="$myconf --cgi-dir=${MY_CGIBINDIR}/" fi ./configure.pl \ --batch \ --backuppc-user=backuppc \ --bin-path perl=$(type -p perl) \ --bin-path ptar=$(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) \ --uid-ignore \ --install-dir=/usr \ --config-dir=/etc/BackupPC \ --dest-dir=${D} \ --data-dir=/var/lib/backuppc \ --log-dir=/var/log/BackupPC \ ${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 keepdir /var/lib/backuppc/{trash,pool,pc,log,cpool} diropts -m 770 dodir -p /var/log/BackupPC keepdir /var/log/BackupPC fperms 644 /etc/BackupPC/config.pl fperms 644 /etc/BackupPC/hosts newinitd ${S}/init.d/gentoo-backuppc backuppc newconfd ${S}/init.d/gentoo-backuppc.conf backuppc webapp_postinst_txt en ${FILESDIR}/postinstall-en.txt || die "webapp_postinst_txt" if use www ; then dodir /etc/apache2 dodir /etc/apache2/vhosts.d cp ${FILESDIR}/httpd-backuppc.conf ${D}/etc/apache2/ cp ${FILESDIR}/apache2-backuppc ${D}/etc/init.d/ cp ${FILESDIR}/01_backuppc.conf ${D}/etc/apache2/vhosts.d webapp_postinst_txt en ${FILESDIR}/postinstall-www-en.txt || die "webapp_postinst_txt" webapp_src_install || die "webapp_src_install" fi # chown -R backuppc:backuppc "${D}/var/lib/backuppc" } pkg_postinst() { if use www ; then webapp_pkg_postinst fi ebegin "Adjusting ownership of /etc/BackupPC" chown -R backuppc:backuppc "${ROOT}/etc/BackupPC" eend $? ebegin "Adjusting ownership of /var/lib/backuppc" chown -R backuppc:backuppc "${ROOT}/var/lib/backuppc" eend $? ebegin "Adjusting ownership of /var/log/BackupPC" chown -R backuppc:backuppc "${ROOT}/var/log/BackupPC" eend $? if use www && ! use vhosts ; then if ! test -L /var/www/localhost/htdocs/${PN}/index.html ; then ebegin "Creating symbolic link to CGI" ln -s /var/www/localhost/cgi-bin/BackupPC_Admin /var/www/localhost/htdocs/${PN}/index.html eend $? fi ebegin "Adjusting permissions of symlink" chown backuppc:backuppc /var/www/localhost/htdocs/${PN}/index.html eend $? fi elog "" elog "Please read the documentation:" elog "http://backuppc.sourceforge.net/faq/BackupPC.html" elog "http://gentoo-wiki.com/BackupPC" elog "" elog "To start the daemon automaticaly at startup, run:" elog "# rc-update add backuppc default" elog "" if use www ; then elog "It is important to know that the webserver and the backuppc user" elog "*must* be one and the same, use the provided config file as a" elog "template for this separate instance of apache." elog "If you want it to be run at startup, don't forget to run :" elog "# rc-update add apache2-backuppc default" else elog "You may be interested in the web frontend this package provides," elog "re-emerge this package with USE flag www in this case" elog "# echo \"app-backup/backuppc www\" >> /etc/portage/package.keywords" fi }