commit:     04f58b0a6b8ab2e71139f20ecbd76cd7673b40d7
Author:     Dennis Eisele <kernlpanic <AT> dennis-eisele <DOT> de>
AuthorDate: Wed Apr  3 23:42:23 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue May 28 01:05:23 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=04f58b0a

app-backup/backuppc: add patch for erroneous config write

Signed-off-by: Dennis Eisele <kernlpanic <AT> dennis-eisele.de>
Closes: https://bugs.gentoo.org/888085
Closes: https://github.com/gentoo/gentoo/pull/36865
Signed-off-by: Sam James <sam <AT> gentoo.org>

 app-backup/backuppc/backuppc-4.4.0-r2.ebuild       | 195 +++++++++++++++++++++
 .../4.4.0/backuppc-4.4.0-fix-config-write.patch    |  48 +++++
 2 files changed, 243 insertions(+)

diff --git a/app-backup/backuppc/backuppc-4.4.0-r2.ebuild 
b/app-backup/backuppc/backuppc-4.4.0-r2.ebuild
new file mode 100644
index 000000000000..f367192beefc
--- /dev/null
+++ b/app-backup/backuppc/backuppc-4.4.0-r2.ebuild
@@ -0,0 +1,195 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+MY_P="BackupPC-${PV}"
+MY_PN="BackupPC"
+
+inherit depend.apache systemd
+
+DESCRIPTION="High-performance backups to a server's disk"
+HOMEPAGE="https://backuppc.github.io/backuppc/index.html";
+SRC_URI="https://github.com/${PN}/${PN}/releases/download/${PV}/${MY_P}.tar.gz";
+S="${WORKDIR}/${MY_P}"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="rss samba"
+
+DEPEND="
+       acct-group/backuppc
+       acct-user/backuppc
+       app-admin/apache-tools
+       app-admin/makepasswd
+       dev-lang/perl
+"
+
+# The CGI modules are handled in ${RDEPEND}.
+APACHE_MODULES="apache2_modules_alias," # RedirectMatch
+APACHE_MODULES+="apache2_modules_authn_core," # AuthType
+APACHE_MODULES+="apache2_modules_authz_core," # Require
+APACHE_MODULES+="apache2_modules_authz_host," # Require host
+APACHE_MODULES+="apache2_modules_authz_user" # Require valid-user
+
+# Older versions of mod_perl think they're compatible with apache-2.4,
+# so we require the new one explicitly.
+RDEPEND="
+       ${DEPEND}
+       app-arch/par2cmdline
+       dev-perl/Archive-Zip
+       dev-perl/CGI
+       dev-perl/File-RsyncP
+       dev-perl/libwww-perl
+       dev-perl/BackupPC-XS
+       net-misc/rsync-bpc
+       virtual/mta
+       virtual/perl-IO-Compress
+       www-apache/mod_perl
+       www-apache/mpm_itk
+       || (
+               >=www-servers/apache-2.4[${APACHE_MODULES},apache2_modules_cgi]
+               >=www-servers/apache-2.4[${APACHE_MODULES},apache2_modules_cgid]
+       )
+       rss? ( dev-perl/XML-RSS )
+       samba? ( net-fs/samba )"
+
+PATCHES=(
+       "${FILESDIR}/4.4.0/${P}-fix-config-write.patch" #888085
+)
+
+CGIDIR="${EROOT}/usr/lib/backuppc/htdocs"
+CONFDIR="${EROOT}/etc/${MY_PN}"
+DATADIR="${EROOT}/var/lib/backuppc"
+DOCDIR="${EROOT}/usr/share/doc/${PF}"
+LOGDIR="${EROOT}/var/log/BackupPC"
+need_apache2_4
+
+src_prepare() {
+       default
+       # Fix docs location using the marker that we've patched in.
+       sed "s+__DOCDIR__+${DOCDIR}+" -i lib/BackupPC/CGI/View.pm || die
+}
+
+src_install() {
+       local myconf
+       if use samba ; then
+               myconf=(
+                       --bin-path smbclient=$(type -p smbclient)
+                       --bin-path nmblookup=$(type -p nmblookup)
+               )
+       fi
+
+       /usr/bin/env perl ./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) \
+               --config-dir "${CONFDIR}" \
+               --install-dir /usr \
+               --data-dir "${DATADIR}" \
+               --hostname 127.0.0.1 \
+               --uid-ignore \
+               --dest-dir "${D}" \
+               --html-dir "${CGIDIR}"/image \
+               --html-dir-url /image \
+               --cgi-dir "${CGIDIR}" \
+               --fhs \
+               ${myconf[@]} || die "failed the configure.pl script"
+
+       ebegin "Installing documentation"
+
+       pod2man \
+               -errors=none \
+               --section=8 \
+               --center="BackupPC manual" \
+               "${S}"/doc/BackupPC.pod backuppc.8 \
+               || die "failed to generate man page"
+
+       doman backuppc.8
+
+       # Place the documentation in the correct location
+       dodoc "${ED}/usr/share/doc/BackupPC/BackupPC.html"
+       dodoc "${ED}/usr/share/doc/BackupPC/BackupPC.pod"
+       rm -rf "${ED}/usr/share/doc" || die
+
+       eend 0
+
+       # Setup directories
+       dodir "${CONFDIR}/pc"
+
+       keepdir "${CONFDIR}"
+       keepdir "${CONFDIR}/pc"
+       keepdir "${DATADIR}"/{trash,pool,pc,cpool}
+       keepdir "${LOGDIR}"
+
+       ebegin "Setting up init.d/conf.d/systemd scripts"
+       newinitd "${S}"/systemd/init.d/gentoo-backuppc backuppc
+       newconfd "${S}"/systemd/init.d/gentoo-backuppc.conf backuppc
+       systemd_dounit "${FILESDIR}/${PN}.service"
+
+       insinto "${APACHE_MODULES_CONFDIR}"
+       doins "${FILESDIR}"/99_backuppc.conf
+
+       # Make sure that the ownership is correct
+       chown -R backuppc:backuppc "${D}${CONFDIR}" || die
+       chown -R backuppc:backuppc "${D}${DATADIR}" || die
+       chown -R backuppc:backuppc "${D}${LOGDIR}"  || die
+
+       eend 0
+}
+
+pkg_postinst() {
+       ewarn "WARNING: The --one-file-system option was added to RsyncArgs."
+       ewarn "If you update from a prior version keep in mind that"
+       ewarn "this prevents data of mounted partitions from being updated."
+       ewarn
+       elog "Installation finished, you may now start using BackupPC."
+       elog
+       elog "- Read the documentation in 
${EROOT}/usr/share/doc/${PF}/BackupPC.html"
+       elog "  Please pay special attention to the security section."
+       elog
+       elog "- You can launch backuppc by running:"
+       elog
+       elog "    # /etc/init.d/backuppc start"
+       elog
+       elog "- To enable the GUI, first edit ${EROOT}/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 
${EROOT}/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
+               adminuser="backuppc"
+               adminpass=$(makepasswd --chars=12)
+               htpasswd -bc "${CONFDIR}/users.htpasswd" ${adminuser} 
${adminpass}
+
+               elog ""
+               elog "- Created admin user ${adminuser} with password 
${adminpass}"
+               elog "  To add new users, run: "
+               elog ""
+               elog "  # htpasswd ${CONFDIR}/users.htpasswd newUser"
+       fi
+}

diff --git 
a/app-backup/backuppc/files/4.4.0/backuppc-4.4.0-fix-config-write.patch 
b/app-backup/backuppc/files/4.4.0/backuppc-4.4.0-fix-config-write.patch
new file mode 100644
index 000000000000..d659c036ce45
--- /dev/null
+++ b/app-backup/backuppc/files/4.4.0/backuppc-4.4.0-fix-config-write.patch
@@ -0,0 +1,48 @@
+From 2c9270b9b849b2c86ae6301dd722c97757bc9256 Mon Sep 17 00:00:00 2001
+From: Craig Barratt <[email protected]>
+Date: Fri, 15 Apr 2022 11:45:57 -0700
+Subject: [PATCH] remove erroneous 2nd argument to Data::Dumper; see #466
+
+---
+ configure.pl                 | 2 +-
+ lib/BackupPC/Storage/Text.pm | 4 ++--
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/configure.pl b/configure.pl
+index 6826ebc..d5deef5 100755
+--- a/configure.pl
++++ b/configure.pl
+@@ -668,7 +668,7 @@ if ( defined($Conf{CgiUserConfigEdit}) ) {
+           if ( defined($Conf{CgiUserConfigEdit}{$p}) );
+     }
+     $Conf{CgiUserConfigEdit} = $new;
+-    my $d = Data::Dumper->new([$new], [*value]);
++    my $d = Data::Dumper->new([$new]);
+     $d->Indent(1);
+     $d->Terse(1);
+     $d->Sortkeys(1);
+diff --git a/lib/BackupPC/Storage/Text.pm b/lib/BackupPC/Storage/Text.pm
+index e9df664..09fcb24 100644
+--- a/lib/BackupPC/Storage/Text.pm
++++ b/lib/BackupPC/Storage/Text.pm
+@@ -422,7 +422,7 @@ sub ConfigFileMerge
+                 my $var = $1;
+                 $skipExpr = "\$fakeVar = $2\n";
+                 if ( exists($newConf->{$var}) ) {
+-                    my $d = Data::Dumper->new([$newConf->{$var}], [*value]);
++                    my $d = Data::Dumper->new([$newConf->{$var}]);
+                     $d->Indent(1);
+                     $d->Terse(1);
+                     $d->Sortkeys(1);
+@@ -454,7 +454,7 @@ sub ConfigFileMerge
+     #
+     foreach my $var ( sort(keys(%$newConf)) ) {
+         next if ( $done->{$var} );
+-        my $d = Data::Dumper->new([$newConf->{$var}], [*value]);
++        my $d = Data::Dumper->new([$newConf->{$var}]);
+         $d->Indent(1);
+         $d->Terse(1);
+         $d->Sortkeys(1);
+-- 
+2.43.2
+

Reply via email to