[Fai-commit] r3077 - in trunk: bin debian

fai-repository at svn.debian.org fai-repository at svn.debian.org
Mon Nov 21 20:39:39 UTC 2005


Author: lange
Date: 2005-11-21 20:39:38 +0000 (Mon, 21 Nov 2005)
New Revision: 3077

Modified:
   trunk/bin/fcopy
   trunk/debian/changelog
Log:
do chroot before using getpwnam (closes: #283475)


Modified: trunk/bin/fcopy
===================================================================
--- trunk/bin/fcopy	2005-11-21 20:29:39 UTC (rev 3076)
+++ trunk/bin/fcopy	2005-11-21 20:39:38 UTC (rev 3077)
@@ -27,7 +27,7 @@
 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 #*********************************************************************
 
-my $version = "Version 2.0, 11-nov-2005";
+my $version = "Version 2.0, 21-nov-2005";
 
 use strict;
 use File::Copy;
@@ -197,8 +197,16 @@
 
   # convert names to numeric uid, gid
   my ($user,$group) = @_;
-  my $uid = ($user  =~ /^\d+$/) ? $user  : getpwnam $user;
-  my $gid = ($group =~ /^\d+$/) ? $group : getgrnam $group;
+  if( !defined( $ENV{ROOTCMD} ) || $ENV{ROOTCMD} =~ /^\s*$/ )
+  {
+    my $uid = ($user  =~ /^\d+$/) ? $user  : getpwnam $user;
+    my $gid = ($group =~ /^\d+$/) ? $group : getgrnam $group;
+  }
+  else
+  {
+    my $uid = ($user  =~ /^\d+$/) ? $user  : `$ENV{ROOTCMD} perl -e '\$uid = getpwnam $user; print \$uid'`;
+    my $gid = ($group =~ /^\d+$/) ? $group : `$ENV{ROOTCMD} perl -e '\$gid = getgrnam $group; print \$gid'`;
+  }
   warn "name2id $user = $uid ; $group = $gid\n" if $debug;
   return ($uid,$gid);
 }

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2005-11-21 20:29:39 UTC (rev 3076)
+++ trunk/debian/changelog	2005-11-21 20:39:38 UTC (rev 3077)
@@ -19,14 +19,15 @@
     DPkg::force-conflicts::=yes (closes: #328138), only aptitude can
     install conflicting packages
   * fai-do-scripts: do not execute S[0-9][0-9]* any more (closes: #310999)
-  * fcopy: add preinst support, fix for inforing .svn dirs (closes: #297550)
+  * fcopy: add preinst support, ignore .svn dirs (closes: #297550), do
+    chroot before using getpwnam (closes: #283475)
   * fai-guide.sgml: include README.disk_config into fai guide, minor
     fixes, (closes: #332295, #332318, #332293, #332291)
   * make-fai-nfsroot: use --one-file-system instead of -l (closes: #308806),
     new test if ssh package is installed (closes: #322759) 
   * subroutines: test if hooks are executable (closes: #338524)
   
- -- Thomas Lange <lange at debian.org>  Mon, 21 Nov 2005 21:26:53 +0100
+ -- Thomas Lange <lange at debian.org>  Mon, 21 Nov 2005 21:39:11 +0100
 
 fai (2.8.4) unstable; urgency=high
 




More information about the Fai-commit mailing list