[arch-commits] Commit in backuppc/trunk (9 files)

Sébastien Luttringer seblu at nymeria.archlinux.org
Wed Apr 17 00:13:19 UTC 2013


    Date: Wednesday, April 17, 2013 @ 02:13:19
  Author: seblu
Revision: 88389

upgpkg: backuppc 3.3.0-1

- bump upstream version
- add socket systemd unit
- move patch into prepare function
- move backuppc.{pid,sock} into /run/backuppc
- add tmpfiles

Added:
  backuppc/trunk/01-move-socket-into-run.patch
  backuppc/trunk/02-move-socket-into-run.patch
  backuppc/trunk/04-fix-cve-2011-4923.patch
    (from rev 87939, backuppc/trunk/02-fix-cve-2011-4923.patch)
  backuppc/trunk/backuppc.socket
Modified:
  backuppc/trunk/PKGBUILD
  backuppc/trunk/backuppc.install
  backuppc/trunk/backuppc.service
Deleted:
  backuppc/trunk/01-fix-parenthesis-warnings.patch
  backuppc/trunk/02-fix-cve-2011-4923.patch

-----------------------------------+
 01-fix-parenthesis-warnings.patch |   20 -------------
 01-move-socket-into-run.patch     |   55 ++++++++++++++++++++++++++++++++++++
 02-fix-cve-2011-4923.patch        |   14 ---------
 02-move-socket-into-run.patch     |   43 ++++++++++++++++++++++++++++
 04-fix-cve-2011-4923.patch        |   14 +++++++++
 PKGBUILD                          |   44 ++++++++++++++++++----------
 backuppc.install                  |   11 ++++---
 backuppc.service                  |    1 
 backuppc.socket                   |    8 +++++
 9 files changed, 157 insertions(+), 53 deletions(-)

Deleted: 01-fix-parenthesis-warnings.patch
===================================================================
--- 01-fix-parenthesis-warnings.patch	2013-04-16 23:52:19 UTC (rev 88388)
+++ 01-fix-parenthesis-warnings.patch	2013-04-17 00:13:19 UTC (rev 88389)
@@ -1,20 +0,0 @@
-# http://svnweb.mageia.org/packages/cauldron/backuppc/current/SOURCES/BackupPC-3.2.1-CVE-2011-170886.diff?view=markup
-
---- a/lib/BackupPC/Storage/Text.pm	2011-04-25 05:31:55.000000000 +0200
-+++ b/lib/BackupPC/Storage/Text.pm	2011-11-28 17:25:44.579141456 +0100
-@@ -299,5 +299,5 @@
-     # Promote BackupFilesOnly and BackupFilesExclude to hashes
-     #
--    foreach my $param qw(BackupFilesOnly BackupFilesExclude) {
-+    foreach my $param ( qw(BackupFilesOnly BackupFilesExclude) ) {
-         next if ( !defined($conf->{$param}) || ref($conf->{$param}) eq "HASH" );
-         $conf->{$param} = [ $conf->{$param} ]
---- a/lib/BackupPC/Lib.pm	2011-04-25 05:31:55.000000000 +0200
-+++ b/lib/BackupPC/Lib.pm	2011-11-28 17:28:01.830700902 +0100
-@@ -1410,5 +1410,5 @@
-     $conf->{$shareName} = [ $conf->{$shareName} ]
-                     if ( ref($conf->{$shareName}) ne "ARRAY" );
--    foreach my $param qw(BackupFilesOnly BackupFilesExclude) {
-+    foreach my $param ( qw(BackupFilesOnly BackupFilesExclude) ) {
-         next if ( !defined($conf->{$param}) );
-         if ( ref($conf->{$param}) eq "HASH" ) {

Added: 01-move-socket-into-run.patch
===================================================================
--- 01-move-socket-into-run.patch	                        (rev 0)
+++ 01-move-socket-into-run.patch	2013-04-17 00:13:19 UTC (rev 88389)
@@ -0,0 +1,55 @@
+From 1cba5f001533ec6d0a728847bdc4fc57e5fed0a3 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?S=C3=A9bastien=20Luttringer?= <seblu at seblu.net>
+Date: Tue, 16 Apr 2013 22:39:15 +0200
+Subject: [PATCH] Move pid file into /run
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This is not a clean patch but it doesn't targeted to upstream inclusion
+
+Signed-off-by: Sébastien Luttringer <seblu at seblu.net>
+---
+ bin/BackupPC | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/bin/BackupPC b/bin/BackupPC
+index c6fc7d2..d9f3dbc 100755
+--- a/bin/BackupPC
++++ b/bin/BackupPC
+@@ -363,11 +363,11 @@ sub Main_Initialize
+     # Write out our initial status and save our PID
+     #
+     StatusWrite();
+-    unlink("$LogDir/BackupPC.pid");
+-    if ( open(PID, ">", "$LogDir/BackupPC.pid") ) {
++    unlink("/run/backuppc/backuppc.pid");
++    if ( open(PID, ">", "/run/backuppc/backuppc.pid") ) {
+         print(PID $$);
+         close(PID);
+-        chmod(0444, "$LogDir/BackupPC.pid");
++        chmod(0444, "/run/backuppc/backuppc.pid");
+     }
+ 
+     #
+@@ -1846,7 +1846,7 @@ sub catch_signal
+         close(LOG);
+         LogFileOpen();
+         print(LOG "Fatal error: unhandled signal $SigName\n");
+-        unlink("$LogDir/BackupPC.pid");
++        unlink("/run/backuppc/backuppc.pid");
+         confess("Got new signal $SigName... quitting\n");
+     } else {
+ 	$SigName = shift;
+@@ -1968,7 +1968,7 @@ sub ServerShutdown
+     }
+     delete($Info{pid});
+     StatusWrite();
+-    unlink("$LogDir/BackupPC.pid");
++    unlink("/run/backuppc/backuppc.pid");
+     exit(1);
+ }
+ 
+-- 
+1.8.2.1
+

Deleted: 02-fix-cve-2011-4923.patch
===================================================================
--- 02-fix-cve-2011-4923.patch	2013-04-16 23:52:19 UTC (rev 88388)
+++ 02-fix-cve-2011-4923.patch	2013-04-17 00:13:19 UTC (rev 88389)
@@ -1,14 +0,0 @@
-# http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2011-4923
-# http://www.openwall.com/lists/oss-security/2011/10/27/8
-
---- a/lib/BackupPC/CGI/View.pm
-+++ b/lib/BackupPC/CGI/View.pm
-@@ -46,7 +46,7 @@
-     my $compress = 0;
-     my $fh;
-     my $host = $In{host};
--    my $num  = $In{num};
-+    my $num  = ${EscHTML($In{num})};
-     my $type = $In{type};
-     my $linkHosts = 0;
-     my($file, $comment);

Added: 02-move-socket-into-run.patch
===================================================================
--- 02-move-socket-into-run.patch	                        (rev 0)
+++ 02-move-socket-into-run.patch	2013-04-17 00:13:19 UTC (rev 88389)
@@ -0,0 +1,43 @@
+From f545d6cd391fb2329068d54e5b5ac90973259cb8 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?S=C3=A9bastien=20Luttringer?= <seblu at seblu.net>
+Date: Tue, 16 Apr 2013 22:50:38 +0200
+Subject: [PATCH] Move socket into /run
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Sébastien Luttringer <seblu at seblu.net>
+---
+ bin/BackupPC        | 2 +-
+ lib/BackupPC/Lib.pm | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/bin/BackupPC b/bin/BackupPC
+index c6fc7d2..818f68e 100755
+--- a/bin/BackupPC
++++ b/bin/BackupPC
+@@ -1885,7 +1885,7 @@ sub ServerSocketInit
+             print(LOG $bpc->timeStamp, "unix socket() failed: $!\n");
+             exit(1);
+         }
+-        my $sockFile = "$LogDir/BackupPC.sock";
++        my $sockFile = "/run/backuppc/backuppc.sock";
+         unlink($sockFile);
+         if ( !bind(SERVER_UNIX, sockaddr_un($sockFile)) ) {
+             print(LOG $bpc->timeStamp, "unix bind() failed: $!\n");
+diff --git a/lib/BackupPC/Lib.pm b/lib/BackupPC/Lib.pm
+index b83a90c..8ffb227 100644
+--- a/lib/BackupPC/Lib.pm
++++ b/lib/BackupPC/Lib.pm
+@@ -686,7 +686,7 @@ sub ServerConnect
+     #
+     # First try the unix-domain socket
+     #
+-    my $sockFile = "$bpc->{LogDir}/BackupPC.sock";
++    my $sockFile = "/run/backuppc/backuppc.sock";
+     socket(*FH, PF_UNIX, SOCK_STREAM, 0)     || return "unix socket: $!";
+     if ( !connect(*FH, sockaddr_un($sockFile)) ) {
+         my $err = "unix connect: $!";
+-- 
+1.8.2.1
+

Copied: backuppc/trunk/04-fix-cve-2011-4923.patch (from rev 87939, backuppc/trunk/02-fix-cve-2011-4923.patch)
===================================================================
--- 04-fix-cve-2011-4923.patch	                        (rev 0)
+++ 04-fix-cve-2011-4923.patch	2013-04-17 00:13:19 UTC (rev 88389)
@@ -0,0 +1,14 @@
+# http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2011-4923
+# http://www.openwall.com/lists/oss-security/2011/10/27/8
+
+--- a/lib/BackupPC/CGI/View.pm
++++ b/lib/BackupPC/CGI/View.pm
+@@ -46,7 +46,7 @@
+     my $compress = 0;
+     my $fh;
+     my $host = $In{host};
+-    my $num  = $In{num};
++    my $num  = ${EscHTML($In{num})};
+     my $type = $In{type};
+     my $linkHosts = 0;
+     my($file, $comment);

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2013-04-16 23:52:19 UTC (rev 88388)
+++ PKGBUILD	2013-04-17 00:13:19 UTC (rev 88389)
@@ -2,8 +2,8 @@
 # Maintainer: Sébastien Luttringer
 
 pkgname=backuppc
-pkgver=3.2.1
-pkgrel=10
+pkgver=3.3.0
+pkgrel=1
 pkgdesc='Enterprise-grade system for backing up Linux, Windows and MacOS PCs'
 url='http://backuppc.sourceforge.net/'
 license=('GPL2')
@@ -26,32 +26,42 @@
 )
 source=("http://downloads.sourceforge.net/project/$pkgname/$pkgname/$pkgver/BackupPC-$pkgver.tar.gz"
         "$pkgname.service"
+        "$pkgname.socket"
         "$pkgname.profile.sh"
         "$pkgname.profile.csh"
         "$pkgname.httpd"
-        '01-fix-parenthesis-warnings.patch'
-        '02-fix-cve-2011-4923.patch'
-        '03-fix-FS#32642.patch')
+        '01-move-socket-into-run.patch'
+        '02-move-socket-into-run.patch'
+        '03-fix-FS#32642.patch'
+        '04-fix-cve-2011-4923.patch'
+)
 install=$pkgname.install
 backup=("etc/$pkgname/config.pl"
         "etc/$pkgname/hosts"
         "etc/httpd/conf/extra/$pkgname.conf"
         "etc/$pkgname/$pkgname.users")
-md5sums=('2334fafb8e03284225a9b8a7fb230012'
-         'fa5da622f87d8801065ba312f4d547b6'
+md5sums=('2942a31daeec7c7bb227d843b7846f38'
+         'ffb8827bbefcf5f0cd959d08fdf64fc1'
+         '88344dbc5f8777e04fc8e0d250a2db82'
          '67a939aa63740c52d12bbdca72d37891'
          'ef09e4dae5b4197998f5c3a74e0ec86d'
          'c61dea98b2a2a0c944a0a6be44e4caf3'
-         'dff7ae1530929ae49f8b34a240a04131'
-         'aca8392c5dea60c3cceeb02ebcc63497'
-         '3917c474a275e262fde246daf59ffe31')
+         'ec087e8b899450e9e7ab18bff77cb1f3'
+         'b468820ed542023e1fec7ce8c88a0c3b'
+         '3917c474a275e262fde246daf59ffe31'
+         'aca8392c5dea60c3cceeb02ebcc63497')
 
+prepare() {
+  pwd
+ls
+  for _p in *.patch; do
+    msg2 "Applying patch $_p"
+    patch -p1 -d BackupPC-$pkgver < "$_p"
+  done
+}
+
 package() {
   cd BackupPC-$pkgver
-  for _p in "$srcdir"/*.patch; do
-    msg2 "Applying patch $_p"
-    patch -p1 -N -i "$_p"
-  done
   perl configure.pl \
     --batch \
     --no-set-perms \
@@ -71,6 +81,9 @@
   cd "$srcdir"
   # systemd
   install -D -m 644 $pkgname.service "$pkgdir/usr/lib/systemd/system/$pkgname.service"
+  install -D -m 644 $pkgname.socket "$pkgdir/usr/lib/systemd/system/$pkgname.socket"
+  install -D -m 644 /dev/null "$pkgdir/usr/lib/tmpfiles.d/$pkgname.conf"
+  echo 'd /run/backuppc 0750 backuppc backuppc' > "$pkgdir/usr/lib/tmpfiles.d/$pkgname.conf"
   # install shell profiles
   install -D -m 755 $pkgname.profile.sh "$pkgdir/etc/profile.d/$pkgname.sh"
   install -D -m 755 $pkgname.profile.csh "$pkgdir/etc/profile.d/$pkgname.csh"
@@ -83,7 +96,8 @@
   chown 126:126 -R var/{log,lib}/$pkgname
   chmod 755 etc
   chmod 755 -R var usr/share/$pkgname/{cgi-,}bin
-  chmod 750 var/log/$pkgname etc/$pkgname var/lib/$pkgname
+  chmod 750 var/log/$pkgname etc/$pkgname
+  chmod 750 -R var/lib/$pkgname
   chmod 640 etc/$pkgname/{config.pl,hosts}
 }
 

Modified: backuppc.install
===================================================================
--- backuppc.install	2013-04-16 23:52:19 UTC (rev 88388)
+++ backuppc.install	2013-04-17 00:13:19 UTC (rev 88389)
@@ -1,9 +1,10 @@
-#/bin/sh
+#/bin/bash
 
 # arg 1:  the new package version
 post_install() {
   getent group backuppc >/dev/null || groupadd -g 126 backuppc
   getent passwd backuppc >/dev/null || useradd -d /var/lib/backuppc -u 126 -g 126 backuppc
+  systemd-tmpfiles --create backuppc.conf
   true
 }
 
@@ -11,7 +12,7 @@
 # arg 2:  the old package version
 post_upgrade() {
   # change uid of old version
-  if [ "`vercmp $2 3.2.1-8`" -lt 0 ]; then
+  if (( $(vercmp $2 3.2.1-8) < 0 )); then
     if pgrep -u backuppc >/dev/null; then
       echo '==> backuppc user is running.'
       echo '==> You must manually change uid and gid of backuppc!'
@@ -21,13 +22,15 @@
       echo '==> backuppc uid/gid have changed. Check your filesystem permissions.'
     fi
   fi
+  # ensure /run/backuppc exists
+  systemd-tmpfiles --create backuppc.conf
   true
 }
 
 # arg 1:  the old package version
 post_remove() {
-  userdel -f backuppc >/dev/null 2>&1
-  groupdel backuppc >/dev/null 2>&1
+  userdel -f backuppc &>/dev/null
+  groupdel backuppc &>/dev/null
   true
 }
 

Modified: backuppc.service
===================================================================
--- backuppc.service	2013-04-16 23:52:19 UTC (rev 88388)
+++ backuppc.service	2013-04-17 00:13:19 UTC (rev 88389)
@@ -3,6 +3,7 @@
 
 [Service]
 User=backuppc
+PIDFile=/run/backuppc/backuppc.pid
 ExecStart=/usr/share/backuppc/bin/BackupPC
 ExecReload=/bin/kill -HUP $MAINPID
 

Added: backuppc.socket
===================================================================
--- backuppc.socket	                        (rev 0)
+++ backuppc.socket	2013-04-17 00:13:19 UTC (rev 88389)
@@ -0,0 +1,8 @@
+[Unit]
+Description=BackupPC Socket
+
+[Socket]
+ListenStream=/run/backuppc/backuppc.sock
+
+[Install]
+WantedBy=sockets.target




More information about the arch-commits mailing list