pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/sysutils/rsnapshot Restore the use of lchown(2) that w...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/5c76aab4bb8c
branches:  trunk
changeset: 504853:5c76aab4bb8c
user:      kim <kim%pkgsrc.org@localhost>
date:      Tue Dec 27 08:56:47 2005 +0000

description:
Restore the use of lchown(2) that was lost in the upgrade.
The upgrade instructions are in the INSTALL document, so
install it as well as README.

diffstat:

 sysutils/rsnapshot/Makefile         |    8 +-
 sysutils/rsnapshot/PLIST            |    5 +-
 sysutils/rsnapshot/distinfo         |    3 +-
 sysutils/rsnapshot/patches/patch-aa |  130 ++++++++++++++++++++++++++++++++++++
 4 files changed, 143 insertions(+), 3 deletions(-)

diffs (196 lines):

diff -r 76b31c47142e -r 5c76aab4bb8c sysutils/rsnapshot/Makefile
--- a/sysutils/rsnapshot/Makefile       Mon Dec 26 23:39:30 2005 +0000
+++ b/sysutils/rsnapshot/Makefile       Tue Dec 27 08:56:47 2005 +0000
@@ -1,7 +1,8 @@
-# $NetBSD: Makefile,v 1.6 2005/12/05 23:55:20 rillig Exp $
+# $NetBSD: Makefile,v 1.7 2005/12/27 08:56:47 kim Exp $
 #
 
 DISTNAME=      rsnapshot-1.2.1
+PKGREVISION=   1
 CATEGORIES=    net
 MASTER_SITES=  http://www.rsnapshot.org/downloads/
 
@@ -10,6 +11,7 @@
 COMMENT=       Filesystem snapshot utility
 
 DEPENDS+=      rsync>=2.3.1:../../net/rsync
+DEPENDS+=      p5-Lchown>=0.07:../../sysutils/p5-Lchown
 
 GNU_CONFIGURE= yes
 USE_TOOLS+=    perl:run
@@ -18,6 +20,7 @@
 .include "../../mk/bsd.prefs.mk"
 
 EGDIR=         ${PREFIX}/share/examples/${PKGBASE}
+DOCDIR=                ${PREFIX}/share/doc/${PKGBASE}
 
 CONF_FILES+=   ${EGDIR}/rsnapshot.conf.default \
                ${PKG_SYSCONFDIR}/rsnapshot.conf
@@ -33,5 +36,8 @@
        ${INSTALL_MAN} ${WRKSRC}/rsnapshot.1 ${PREFIX}/man/man1
        ${INSTALL_DATA_DIR} ${EGDIR}
        ${INSTALL_DATA} ${WRKSRC}/rsnapshot.conf.default ${EGDIR}
+       ${INSTALL_DATA_DIR} ${DOCDIR}
+       ${INSTALL_DATA} ${WRKSRC}/INSTALL ${DOCDIR}
+       ${INSTALL_DATA} ${WRKSRC}/README ${DOCDIR}
 
 .include "../../mk/bsd.pkg.mk"
diff -r 76b31c47142e -r 5c76aab4bb8c sysutils/rsnapshot/PLIST
--- a/sysutils/rsnapshot/PLIST  Mon Dec 26 23:39:30 2005 +0000
+++ b/sysutils/rsnapshot/PLIST  Tue Dec 27 08:56:47 2005 +0000
@@ -1,5 +1,8 @@
-@comment $NetBSD: PLIST,v 1.1.1.1 2004/10/10 17:28:14 kim Exp $
+@comment $NetBSD: PLIST,v 1.2 2005/12/27 08:56:47 kim Exp $
 bin/${PKGBASE}
 man/man1/${PKGBASE}.1
+share/doc/${PKGBASE}/INSTALL
+share/doc/${PKGBASE}/README
+@dirrm share/doc/${PKGBASE}
 share/examples/${PKGBASE}/${PKGBASE}.conf.default
 @dirrm share/examples/${PKGBASE}
diff -r 76b31c47142e -r 5c76aab4bb8c sysutils/rsnapshot/distinfo
--- a/sysutils/rsnapshot/distinfo       Mon Dec 26 23:39:30 2005 +0000
+++ b/sysutils/rsnapshot/distinfo       Tue Dec 27 08:56:47 2005 +0000
@@ -1,5 +1,6 @@
-$NetBSD: distinfo,v 1.4 2005/09/13 11:47:49 abs Exp $
+$NetBSD: distinfo,v 1.5 2005/12/27 08:56:47 kim Exp $
 
 SHA1 (rsnapshot-1.2.1.tar.gz) = 4e13d6a828012b869fa0709f651e3b11c40d0c91
 RMD160 (rsnapshot-1.2.1.tar.gz) = 78d365b45c3a7dbe2034d901afe4937b39687946
 Size (rsnapshot-1.2.1.tar.gz) = 137194 bytes
+SHA1 (patch-aa) = 7b6fb79ce5e47cc552ee3634598b2e2101dc8919
diff -r 76b31c47142e -r 5c76aab4bb8c sysutils/rsnapshot/patches/patch-aa
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/rsnapshot/patches/patch-aa       Tue Dec 27 08:56:47 2005 +0000
@@ -0,0 +1,130 @@
+$NetBSD: patch-aa,v 1.3 2005/12/27 08:56:47 kim Exp $
+
+--- rsnapshot-program.pl.orig  2005-04-10 01:22:29.000000000 +0300
++++ rsnapshot-program.pl       2005-12-25 11:16:47.000000000 +0200
+@@ -32,6 +32,7 @@
+ use File::Path;                       # mkpath(), rmtree()
+ use File::stat;                       # stat(), lstat()
+ use POSIX qw(locale_h);       # setlocale()
++use Lchown qw(lchown LCHOWN_AVAILABLE);
+ 
+ ########################################
+ ###     DECLARE GLOBAL VARIABLES     ###
+@@ -3277,24 +3278,9 @@
+       
+       # CHOWN DEST (if root)
+       if (0 == $<) {
+-              # make sure destination is not a symlink
+-              if ( ! -l "$dest" ) {
+-                      # print and/or log this if necessary
+-                      if (($verbose > 4) or ($loglevel > 4)) {
+-                              my $cmd_string = "chown(" . $st->uid . ", " . $st->gid . ", \"$dest\")";
+-                      
+-                              if ($verbose > 4) {
+-                                      print_cmd($cmd_string);
+-                              } elsif ($loglevel > 4) {
+-                                      log_msg($cmd_string, 4);
+-                              }
+-                      }
+-                      
+-                      $result = chown($st->uid, $st->gid, "$dest");
+-                      if (! $result) {
+-                              print_err("Warning! Could not chown(" . $st->uid . ", " . $st->gid . ", \"$dest\");", 2);
+-                              return(0);
+-                      }
++              $result = safe_chown($st->uid, $st->gid, $dest);
++              if (! $result) {
++                      return(0);
+               }
+       }
+       
+@@ -3501,6 +3487,43 @@
+       return (1);
+ }
+ 
++# choose between lchown or chown
++sub safe_chown {
++      my $uid = shift(@_);
++      my $gid = shift(@_);
++      my $dest = shift(@_);
++
++      my $result = 0;
++
++      # logging
++      if (LCHOWN_AVAILABLE || ! -l $dest) {
++              # print and/or log this if necessary
++              if (($verbose > 4) or ($loglevel > 4)) {
++                      my $cmd_string = 'chown(' . $uid . ', ' . $gid . ', "' . $dest . '")';
++                      if ($verbose > 4) {
++                              print_cmd($cmd_string);
++                      } elsif ($loglevel > 4) {
++                              log_msg($cmd_string, 4);
++                      }
++              }
++      }
++
++      if (LCHOWN_AVAILABLE) {
++              $result = lchown($uid, $gid, $dest);
++      } else {
++              # make sure destination is not a symlink
++              if ( ! -l $dest ) {
++                      $result = chown($uid, $gid, $dest);
++              }
++      }
++
++      if (! $result) {
++              print_err('Warning! Could not safe_chown(' . $uid . ', ' . $gid . ', "' . $dest . '")', 2);
++      }
++
++      return($result);
++}
++
+ # accepts a path
+ # displays the rm command according to the config file
+ sub display_rm_rf {
+@@ -3777,13 +3800,9 @@
+       
+       # CHOWN DEST (if root)
+       if (0 == $<) {
+-              # make sure dest is not a symlink
+-              if ( ! -l "$dest" ) {
+-                      $result = chown($st->uid, $st->gid, "$dest");
+-                      if (! $result) {
+-                              print_err("Warning! Could not chown(" . $st->uid . ", " . $st->gid . ", \"$dest\");", 2);
+-                              return(0);
+-                      }
++              $result = safe_chown($st->uid, $st->gid, $dest);
++              if (! $result) {
++                      return(0);
+               }
+       }
+       
+@@ -3998,25 +4017,9 @@
+       # CHOWN DEST (if root)
+       if (0 == $<) {
+               if ( -e "$dest" ) {
+-                      # make sure destination is not a symlink
+-                      if ( ! -l "$dest" ) {
+-                              # print and/or log this if necessary
+-                              if (($verbose > 4) or ($loglevel > 4)) {
+-                                      my $cmd_string = "chown(" . $st->uid . ", " . $st->gid . ", \"$dest\");";
+-                              
+-                                      if ($verbose > 4) {
+-                                              print_cmd($cmd_string);
+-                                      } elsif ($loglevel > 4) {
+-                                              log_msg($cmd_string, 4);
+-                                      }
+-                              }
+-                              
+-                              $result = chown($st->uid, $st->gid, "$dest");
+-                              
+-                              if (! $result) {
+-                                      print_err("Warning! Could not chown(" . $st->uid . ", " . $st->gid . ", \"$dest\")", 2);
+-                                      return (0);
+-                              }
++                      $result = safe_chown($st->uid, $st->gid, $dest);
++                      if (! $result) {
++                              return (0);
+                       }
+               }
+       }



Home | Main Index | Thread Index | Old Index