X-Git-Url: http://gitweb.michael.orlitzky.com/?p=mjo-overlay.git;a=blobdiff_plain;f=app-backup%2Fbackuppc%2Fbackuppc-3.3.1.ebuild;h=1d4b696c43ec2adfbf0e772e88168cc4356becee;hp=e479b09b5cb8c8c104d4768497d523bedc820284;hb=fd8e9a16fdc11575b47642c030052137874a5ca6;hpb=d5d926a22083589eaea1383a7f4155075526884f diff --git a/app-backup/backuppc/backuppc-3.3.1.ebuild b/app-backup/backuppc/backuppc-3.3.1.ebuild index e479b09..1d4b696 100644 --- a/app-backup/backuppc/backuppc-3.3.1.ebuild +++ b/app-backup/backuppc/backuppc-3.3.1.ebuild @@ -1,22 +1,26 @@ -# Copyright 1999-2014 Gentoo Foundation +# Copyright 1999-2015 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id$ -EAPI="5" +EAPI=5 -inherit eutils systemd webapp user +inherit depend.apache eutils user MY_P="BackupPC-${PV}" -DESCRIPTION="A high-performance system for backing up computers to a server's disk" +DESCRIPTION="High-performance backups to a server's disk" HOMEPAGE="http://backuppc.sourceforge.net/" SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.gz" LICENSE="GPL-2" -KEYWORDS="amd64 x86" +KEYWORDS="~amd64 ~x86" IUSE="rss samba" +APACHE_MODULES="apache2_modules_alias," +APACHE_MODULES+="apache2_modules_unixd," +APACHE_MODULES+="apache2_modules_authz_user" + DEPEND="dev-lang/perl app-admin/apache-tools app-admin/makepasswd" @@ -30,23 +34,28 @@ RDEPEND="${DEPEND} app-arch/bzip2 virtual/mta www-apache/mod_perl - www-servers/apache + www-apache/mpm_itk + || ( >=www-servers/apache-2.4[${APACHE_MODULES},apache2_modules_cgi] + >=www-servers/apache-2.4[${APACHE_MODULES},apache2_modules_cgid] + >=www-servers/apache-2.4[${APACHE_MODULES},apache2_modules_fcgid] ) net-misc/rsync >=dev-perl/File-RsyncP-0.68 rss? ( dev-perl/XML-RSS ) samba? ( net-fs/samba )" -WEBAPP_MANUAL_SLOT="yes" +need_apache2_4 + SLOT="0" -S=${WORKDIR}/${MY_P} +S="${WORKDIR}/${MY_P}" +CGIDIR="/usr/lib/backuppc/htdocs" CONFDIR="/etc/BackupPC" DATADIR="/var/lib/backuppc" +DOCDIR="/usr/share/doc/${PF}" LOGDIR="/var/log/BackupPC" pkg_setup() { - webapp_pkg_setup enewgroup backuppc enewuser backuppc -1 /bin/bash /var/lib/backuppc backuppc } @@ -56,21 +65,15 @@ src_prepare() { epatch "${FILESDIR}/3.3.0/02-fix-config.pl-formatting.patch" epatch "${FILESDIR}/3.3.0/03-reasonable-config.pl-defaults.patch" - # Fix the documentation location in the CGI interface epatch "${FILESDIR}/3.2.0/04-add-docdir-marker.patch" - sed -i "s+__DOCDIR__+/usr/share/doc/${PF}+" "lib/BackupPC/CGI/View.pm" - epatch "${FILESDIR}/3.2.0/05-nicelevel.patch" - sed -i -e 's/--chuid ${USER}//' "${S}"/init.d/src/gentoo-backuppc || die "Failed to fix the init script" -} -src_test() { - true + # Fix docs location using the marker that we've patched in. + sed -i "s+__DOCDIR__+${DOCDIR}+" "lib/BackupPC/CGI/View.pm" \ + || die "failed to sed the documentation location" } src_install() { - webapp_src_preinst - local myconf myconf="" if use samba ; then @@ -90,15 +93,15 @@ src_install() { --bin-path hostname=$(type -p hostname) \ --bin-path gzip=$(type -p gzip) \ --bin-path bzip2=$(type -p bzip2) \ - --config-dir ${CONFDIR} \ + --config-dir "${CONFDIR}" \ --install-dir /usr \ - --data-dir ${DATADIR} \ - --hostname $(hostname) \ + --data-dir "${DATADIR}" \ + --hostname 127.0.0.1 \ --uid-ignore \ --dest-dir "${D%/}" \ - --html-dir ${MY_HTDOCSDIR}/image \ + --html-dir "${CGIDIR}"/image \ --html-dir-url /image \ - --cgi-dir ${MY_HTDOCSDIR} \ + --cgi-dir "${CGIDIR}" \ --fhs \ ${myconf} || die "failed the configure.pl script" @@ -108,100 +111,67 @@ src_install() { -errors=none \ --section=8 \ --center="BackupPC manual" \ - "${S}"/doc/BackupPC.pod backuppc.8 || die "failed to generate man page" + "${S}"/doc/BackupPC.pod backuppc.8 \ + || die "failed to generate man page" doman backuppc.8 # Place the documentation in the correct location dodoc "${D}/usr/doc/BackupPC.html" dodoc "${D}/usr/doc/BackupPC.pod" - rm -rf "${D}/usr/doc" + rm -rf "${D}/usr/doc" || die eend 0 # Setup directories - dodir ${CONFDIR}/pc + dodir "${CONFDIR}/pc" - keepdir ${CONFDIR} - keepdir ${CONFDIR}/pc - keepdir ${DATADIR}/{trash,pool,pc,cpool} - keepdir ${LOGDIR} + keepdir "${CONFDIR}" + keepdir "${CONFDIR}/pc" + keepdir "${DATADIR}"/{trash,pool,pc,cpool} + keepdir "${LOGDIR}" - ebegin "Setting up init.d/conf.d/systemd scripts" + ebegin "Setting up init.d/conf.d scripts" newinitd "${S}"/init.d/gentoo-backuppc backuppc newconfd "${S}"/init.d/gentoo-backuppc.conf backuppc - systemd_dounit "${FILESDIR}/${PN}.service" - eend 0 - - ebegin "Setting up an apache instance for backuppc" - - cp "${FILESDIR}/apache2-backuppc."{conf,init} "${WORKDIR}/" - cp "${FILESDIR}/httpd.conf" "${WORKDIR}/httpd.conf" - sed -i -e "s+HTDOCSDIR+${MY_HTDOCSDIR}+g" "${WORKDIR}/httpd.conf" - sed -i -e "s+AUTHFILE+${CONFDIR}/users.htpasswd+g" "${WORKDIR}/httpd.conf" - - moduledir="/usr/lib/apache2/modules" - - # Check if the Apache ServerRoot is real. - # This is sometimes broken on older amd64 systems. - # In this case we just patch our config file appropriately. - if [[ ! -d "/usr/lib/apache2" ]]; then - if [[ -d "/usr/lib64/apache2" ]]; then - sed -i -e "s+/usr/lib/apache2+/usr/lib64/apache2+g" "${WORKDIR}/httpd.conf" - sed -i -e "s+/usr/lib/apache2+/usr/lib64/apache2+g" "${WORKDIR}/apache2-backuppc.conf" - moduledir="/usr/lib64/apache2/modules" - fi - fi - - # Check if we're using mod_cgid instead of mod_cgi - # This happens if you install apache with USE="threads" - if [[ -f "${moduledir}/mod_cgid.so" ]]; then - sed -i -e "s+mod_cgi+mod_cgid+g" "${WORKDIR}/httpd.conf" - sed -i -e "s+cgi_module+cgid_module+g" "${WORKDIR}/httpd.conf" - fi - - # Install conf.d/init.d files for apache2-backuppc - if [ -e /etc/init.d/apache2 ]; then - newconfd "${WORKDIR}/apache2-backuppc.conf" apache2-backuppc - newinitd /etc/init.d/apache2 apache2-backuppc - else - newconfd "${WORKDIR}/apache2-backuppc.conf" apache2-backuppc - newinitd "${WORKDIR}/apache2-backuppc.init" apache2-backuppc - fi - insopts -m 0644 - insinto ${CONFDIR} - doins "${WORKDIR}/httpd.conf" - - eend $? - - webapp_src_install || die "webapp_src_install" + insinto "${APACHE_MODULES_CONFDIR}" + doins "${FILESDIR}"/99_backuppc.conf # Make sure that the ownership is correct - chown -R backuppc:backuppc "${D}${CONFDIR}" - chown -R backuppc:backuppc "${D}${DATADIR}" - chown -R backuppc:backuppc "${D}${LOGDIR}" + chown -R backuppc:backuppc "${D}${CONFDIR}" || die + chown -R backuppc:backuppc "${D}${DATADIR}" || die + chown -R backuppc:backuppc "${D}${LOGDIR}" || die } pkg_postinst() { - # This is disabled since BackupPC doesn't need it - # webapp_pkg_postinst - - elog "Installation finished, now may now start using BackupPC." - elog "" + elog "Installation finished, you may now start using BackupPC." + elog elog "- Read the documentation in /usr/share/doc/${PF}/BackupPC.html" elog " Please pay special attention to the security section." - elog "" - elog "- You can launch backuppc and it's apache web interface by running:" - elog " # /etc/init.d/backuppc start" - elog " # /etc/init.d/apache2-backuppc start" - - if [[ ! -e /etc/runlevels/default/backuppc ]]; then - elog "" - elog "- You also might want to add these scripts to your default runlevel:" - elog " # rc-update add backuppc default" - elog " # rc-update add apache2-backuppc default" - fi + elog + elog "- You can launch backuppc by running:" + elog + elog " # /etc/init.d/backuppc start" + elog + elog "- To enable the GUI, first edit ${ROOT}etc/conf.d/apache2 and add," + elog + elog " \"-D BACKUPPC -D PERL -D MPM_ITK\"" + elog + elog " to the APACHE2_OPTS line." + elog + elog " Then you must edit ${ROOT}etc/apache2/modules.d/00_mpm_itk.conf" + elog " and adjust the values of LimitUIDRange/LimitGIDRange to include" + elog " the UID and GID of the backuppc user." + elog + elog " Finally, start apache:" + elog + elog " # /etc/init.d/apache2 start" + elog + elog " The web interface should now be running on," + elog + elog " http://127.0.0.1:8080/" + elog # Generate a new password if there's no auth file if [[ ! -f "${CONFDIR}/users.htpasswd" ]]; then @@ -212,12 +182,7 @@ pkg_postinst() { elog "" elog "- Created admin user $adminuser with password $adminpass" elog " To add new users, run: " + elog "" elog " # htpasswd ${CONFDIR}/users.htpasswd newUser" fi - - if [[ -d "/etc/backuppc" ]]; then - ewarn "" - ewarn "Detected old config directory in /etc/backuppc" - ewarn "Please migrate relevant config files to ${CONFDIR} before starting backuppc" - fi }