inherit eutils MAJ=2.1.0 MIN=pl1 DESCRIPTION="BackupPC is a high-performance, enterprise-grade backup system" HOMEPAGE="http://backuppc.sourceforge.net/" SRC_URI="mirror://sourceforge/backuppc/BackupPC-${MAJ}.tar.gz mirror://sourceforge/backuppc/BackupPC-${MAJ}${MIN}.diff" SLOT="0" LICENSE="GPL-2" KEYWORDS="~x86" DEPEND=">=dev-lang/perl-5.6.0" RDEPEND="${DEPEND} app-arch/bzip2 app-arch/par2cmdline virtual/ssh >=dev-perl/Archive-Zip >=dev-perl/Compress-Zlib >=dev-perl/File-RsyncP-0.52 >=net-misc/rsync-2.5.5 >=app-arch/tar-1.13.7 samba? (>=net-fs/samba-2.2.0)" pkg_setup() { enewgroup apache 81 enewuser apache 81 /bin/false /home/httpd apache } src_unpack() { unpack BackupPC-${MAJ}.tar.gz cd BackupPC-${MAJ} # Apply 2.1.0pl1 patch epatch ${DISTDIR}/BackupPC-${MAJ}${MIN}.diff # Apply patch to fix badly written Gentoo init script epatch ${FILESDIR}/init-script.patch # Adjust the configure script to make BackupPC run as the apache user sed -i -r 's/\$Conf\{BackupPCUser\} \|\| "backuppc",/$Conf\{BackupPCUser\} \|\| "apache",/' configure.pl } src_install () { cd ${WORKDIR}/BackupPC-${MAJ} dodir /var/www/localhost/htdocs/backuppc dodir /var/www/localhost/cgi-bin perl configure.pl --batch \ --dest-dir ${D} \ --cgi-dir /var/www/localhost/cgi-bin \ --data-dir /var/lib/backuppc \ --hostname $(hostname) \ --html-dir /var/www/localhost/htdocs/backuppc \ --html-dir-url /backuppc \ --install-dir /usr/lib/backuppc \ --uid-ignore \ &> /dev/null exeinto /etc/init.d newexe init.d/gentoo-backuppc backuppc insinto /etc/conf.d newins init.d/gentoo-backuppc.conf backuppc for x in conf pool cpool pc trash log; do keepdir /var/lib/backuppc/${x} done # CGI script is installed with SUID flag set by default. Turn this off! fperms 550 /var/www/localhost/cgi-bin/BackupPC_Admin } pkg_postinst() { echo "" ewarn "WARNING! BackupPC is configured to run as the apache user" ewarn "by default. This is a potential security hazard! The first" ewarn "alternative is to run the CGI script with the SUID option" ewarn "on. This is even more hazardous. The second option is to" ewarn "host the CGI script on a separate Apache server running as" ewarn "a different user on a different port. For more information," ewarn "visit the following URL." ewarn "" ewarn "http://backuppc.sourceforge.net/faq/BackupPC.html#step_8__cgi_interface" echo "" }