Subject: [alpine-devel]

From: k0r10n <[email-masked]>
Date: Fri, 28 Nov 2014 20:50:21 +0400

>From 6f8b6a96a138761d18e5d942006752d183f772a8 Mon Sep 17 00:00:00 2001
From: k0r10n <[email-masked]>
Date: Fri, 28 Nov 2014 20:27:12 +0400
Subject: [PATCH] main/backuppc: Fix permissions and edited patch

Hi, there is fix for BackupPC aport. I noticed $Conf{BackupPCUser} variable
was not set after installing in /etc/BackupPC/config.pl, i added this to configure patch.
Also after installing i've got o-rx on /etc,/var/lib and /var/log folders (fix is in APKBUILD file). And i added initd script, because it wasn't in package and added samba-client to depends, because initd script failed to start without smbclient.

---
 main/backuppc/APKBUILD              | 50 ++++++++++++++++++++++++++-----------
 main/backuppc/backuppc.initd        |  4 +++
 main/backuppc/backuppc.post-install |  7 ------
 main/backuppc/configure.pl.patch    | 15 ++++++-----
 4 files changed, 49 insertions(+), 27 deletions(-)
 delete mode 100644 main/backuppc/backuppc.post-install

diff --git a/main/backuppc/APKBUILD b/main/backuppc/APKBUILD
index 08f8206..e05a817 100644
--- a/main/backuppc/APKBUILD
+++ b/main/backuppc/APKBUILD
@@ -4,25 +4,34 @@ pkgname="backuppc"
 _realname="BackupPC"
 pkgver=3.3.0
 _realver=$pkgver
-pkgrel=1
+pkgrel=2
 pkgdesc="High-performance, enterprise-grade backup system"
 url="http://backuppc.sourceforge.net/"
 arch="noarch"
 license="GPL2+"
 depends="perl busybox rsync perl-archive-zip perl-io-compress 
-	perl-libwww perl-file-rsync"
+	perl-libwww perl-file-rsync samba-client"
+pkgusers="backuppc"
+pkggroups="backuppc"
 makedepends=""
-install="$pkgname.pre-install $pkgname.post-install"
+install="$pkgname.pre-install"
 subpackages=""
 source="http://downloads.sourceforge.net/project/$pkgname/$pkgname/$_realver/$_realname-$_realver.tar.gz
-	configure.pl.patch"
+	configure.pl.patch
+	backuppc.initd
+	"
 
 _builddir="$srcdir/$_realname-$_realver"
-prepare () {
+prepare() {
 	cd "$_builddir"
-	mkdir -p "$pkgdir"/etc/BackupPC
-	mkdir -p "$pkgdir"/var/www/cgi-bin
-	patch -p2 < ../../configure.pl.patch
+	for i in $source; do
+		case $i in
+		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+		esac
+	done
+	mkdir -p "$pkgdir"/etc/BackupPC \
+		 "$pkgdir"/var/www/cgi-bin \
+		 "$pkgdir"/var/www/htdocs/BackupPC || return 1
 }
 
 build() {
@@ -43,7 +52,7 @@ package() {
 	 --bin-path perl=/usr/bin/perl \
 	 --bin-path ping=/bin/ping \
 	 --bin-path rsync=/usr/bin/rsync \
-	 --bin-path sendmail=/usr/bin/sendmail \
+	 --bin-path sendmail=/usr/sbin/sendmail \
 	 --bin-path smbclient=/usr/bin/smbclient \
 	 --bin-path split=/usr/bin/split \
 	 --bin-path ssh=/usr/bin/ssh \
@@ -60,15 +69,28 @@ package() {
 	 --uid-ignore \
 	 --no-set-perms || return 1
 
-	install -m755 configure.pl "$pkgdir"/usr/lib/BackupPC/bin/configure.pl
+	install -m755 configure.pl \
+		"$pkgdir"/usr/lib/BackupPC/bin/configure.pl || return 1
+	install -D -m755 "$srcdir"/backuppc.initd \
+		"$pkgdir"/etc/init.d/backuppc || return 1
 
-	chmod 774 "$pkgdir"/usr/lib/BackupPC/bin/*
+	chmod 775 "$pkgdir"/usr/lib/BackupPC/bin/*
+
+	for dir in etc var/log var/lib;do
+		chown -R backuppc.backuppc ${pkgdir}/${dir}/BackupPC
+		chmod 755 "$pkgdir/$dir"
+	done
+
+	ln -s /var/www/cgi-bin/BackupPC_Admin "$pkgdir"/var/www/htdocs/index.cgi || return 1
 
 }
 
 md5sums="2942a31daeec7c7bb227d843b7846f38  BackupPC-3.3.0.tar.gz
-f57ad7fdcce804f20f2fe82bee91e813  configure.pl.patch"
+2a25b036d273ea67b69aa62e4cd7c28f  configure.pl.patch
+5f27ed84a9ca11cba0bb5665faddca4b  backuppc.initd"
 sha256sums="8a9c1b6faa4502b4c40617be97e806813815d9e22544854d99983c3da7c1f69b  BackupPC-3.3.0.tar.gz
-f07039e6bf25fc19bc0bc894d6dd6ff0348612a95a24e68b181da94b9f5ddd0c  configure.pl.patch"
+86988fbe8e8763abee8861f5bb03bf6bb7fd2430623f78fc921502b6759ad48d  configure.pl.patch
+ae3c6080c1ff4f5a42efbe533b20f02b9770e21f0e36c66879576683fcdda6b1  backuppc.initd"
 sha512sums="67ec1ca4d22ab1e81f9c0f409c758347a6c772e3d1aa39c93207f9d328176ac7b4e679d0b03972fc5870c37dde0480d28c61ae19975d54e144235ea0e84e9901  BackupPC-3.3.0.tar.gz
-7ea98de0960cd0ea4f64e71c61e4565a73db2fd872d2f102dc08543ad60eb1cf986b9c0a32b7b4694dc9a8ffe2cd6bd7ca3ff2cc0b4d91961952664b62881faf  configure.pl.patch"
+a38361fd0e54a4c0100a7bf94b09483e5ba246dc45d6955d275542dd5662d8da11d9580685195b7d4dfa9a07c0487a52a14a95340737e70889ffe5c5e26d5ff8  configure.pl.patch
+96583fa711e1a92979d6ad60936d430e0b2b8138b8923d3727e86310ed73b93ae25306294c230c9e7a4560379b58c6ecccf37591d3fe5f920e29b0c7525b488b  backuppc.initd"
diff --git a/main/backuppc/backuppc.initd b/main/backuppc/backuppc.initd
index 850e6ae..ac1f36a 100644
--- a/main/backuppc/backuppc.initd
+++ b/main/backuppc/backuppc.initd
@@ -1,4 +1,8 @@
 #!/sbin/runscript
+BACKUPPC_BINDIR=/usr/lib/BackupPC/bin
+DAEMON=BackupPC
+BACKUPPC_LOGDIR=/var/log/BackupPC
+USER=backuppc
 
 depend() {
 	after firewall modules
diff --git a/main/backuppc/backuppc.post-install b/main/backuppc/backuppc.post-install
deleted file mode 100644
index f4b5a58..0000000
--- a/main/backuppc/backuppc.post-install
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-for dir in /etc /var/log /var/lib
-do
-  chown -R backuppc.backuppc ${dir}/BackupPC &>/dev/null
-done
-
-ln -s /var/www/htdocs/BackupPC/index.cgi /var/www/cgi-bin/BackupPC_Admin &>/dev/null
diff --git a/main/backuppc/configure.pl.patch b/main/backuppc/configure.pl.patch
index 24d5e3b..67c2892 100644
--- a/main/backuppc/configure.pl.patch
+++ b/main/backuppc/configure.pl.patch
@@ -1,6 +1,6 @@
---- src/BackupPC-3.2.0beta1/configure.pl
-+++ configure.pl
-@@ -327,25 +327,8 @@
+--- BackupPC-3.3.0.orig/configure.pl
++++ BackupPC-3.3.0/configure.pl
+@@ -327,25 +327,11 @@
  
  EOF
  my($name, $passwd, $Uid, $Gid);
@@ -9,6 +9,9 @@
 -                                 $Conf{BackupPCUser} || "backuppc",
 -                                 "backuppc-user");
 -    if ( $opts{"set-perms"} ) {
++	$Conf{BackupPCUser} = prompt("--> BackupPC should run as user",
++				     $Conf{BackupPCUser} || "backuppc",
++				     "backuppc-user");
          ($name, $passwd, $Uid, $Gid) = getpwnam($Conf{BackupPCUser});
 -        last if ( $name ne "" );
 -        print <<EOF;
@@ -26,7 +29,7 @@
  print <<EOF;
  
  Please specify an install directory for BackupPC.  This is where the
-@@ -532,12 +515,6 @@
+@@ -532,12 +518,6 @@
  		 ) ) {
      next if ( -d "$DestDir$Conf{InstallDir}/$dir" );
      mkpath("$DestDir$Conf{InstallDir}/$dir", 0, 0755);
@@ -39,7 +42,7 @@
  }
  
  #
-@@ -546,11 +523,6 @@
+@@ -546,11 +526,6 @@
  foreach my $dir ( ($Conf{CgiImageDir}) ) {
      next if ( $dir eq "" || -d "$DestDir$dir" );
      mkpath("$DestDir$dir", 0, 0755);
@@ -51,7 +54,7 @@
  }
  
  #
-@@ -566,12 +538,6 @@
+@@ -566,12 +541,6 @@
              "$Conf{LogDir}",
          ) ) {
      mkpath("$DestDir$dir", 0, 0750) if ( !-d "$DestDir$dir" );
-- 
2.0.0

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---