[Fai-commit] r3054 - people/michael/bugfixes/283475/scripts

fai-repository at svn.debian.org fai-repository at svn.debian.org
Sun Nov 13 09:28:33 UTC 2005


Author: michael-guest
Date: 2005-11-13 09:28:33 +0000 (Sun, 13 Nov 2005)
New Revision: 3054

Modified:
   people/michael/bugfixes/283475/scripts/fcopy
Log:
test, whether or not a chroot should be performed


Modified: people/michael/bugfixes/283475/scripts/fcopy
===================================================================
--- people/michael/bugfixes/283475/scripts/fcopy	2005-11-13 08:22:20 UTC (rev 3053)
+++ people/michael/bugfixes/283475/scripts/fcopy	2005-11-13 09:28:33 UTC (rev 3054)
@@ -178,8 +178,16 @@
 
   # convert names to numeric uid, gid
   my ($user,$group) = @_;
-  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'`;
+  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);
 }




More information about the Fai-commit mailing list