[Fai-commit] r3090 - trunk/bin
fai-repository at svn.debian.org
fai-repository at svn.debian.org
Wed Nov 23 21:54:41 UTC 2005
Author: lange
Date: 2005-11-23 21:54:40 +0000 (Wed, 23 Nov 2005)
New Revision: 3090
Modified:
trunk/bin/fcopy
Log:
add option -U, fix syntax errors
Modified: trunk/bin/fcopy
===================================================================
--- trunk/bin/fcopy 2005-11-23 21:10:23 UTC (rev 3089)
+++ trunk/bin/fcopy 2005-11-23 21:54:40 UTC (rev 3090)
@@ -27,7 +27,7 @@
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#*********************************************************************
-my $version = "Version 2.0, 21-nov-2005";
+my $version = "Version 2.1, 23-nov-2005";
use strict;
use File::Copy;
@@ -64,7 +64,7 @@
# getopts:
our ($opt_s, $opt_t, $opt_r, $opt_m, $opt_M, $opt_v, $opt_d, $opt_D, $opt_i);
our ($opt_B, $opt_c, $opt_C, $opt_h, $opt_F, $opt_l, $opt_L, $opt_P, $opt_b);
-our $opt_I;
+our ($opt_I, $opt_U);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub copy_one {
@@ -196,16 +196,18 @@
sub name2num {
# convert names to numeric uid, gid
- my ($user,$group) = @_;
+ my ($user, $group) = @_;
+ my ($uid, $gid);
+
if( !defined( $ENV{ROOTCMD} ) || $ENV{ROOTCMD} =~ /^\s*$/ )
{
- my $uid = ($user =~ /^\d+$/) ? $user : getpwnam $user;
- my $gid = ($group =~ /^\d+$/) ? $group : getgrnam $group;
+ $uid = ($user =~ /^\d+$/) ? $user : getpwnam $user;
+ $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'`;
+ $uid = ($user =~ /^\d+$/) ? $user : `$ENV{ROOTCMD} perl -e '\$uid = getpwnam $user; print \$uid'`;
+ $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);
@@ -372,7 +374,7 @@
# main program
$|=1;
-getopts('Ms:t:rm:vidDc:C:hF:lL:P:Bb:I:');
+getopts('Ms:t:rm:vidDc:C:hF:lL:P:Bb:I:U');
$opt_h && usage;
$opt_M and $opt_m="root,root,0644"; # set default modes
$opt_m && check_mopt();
@@ -386,6 +388,11 @@
$logfile and (open(LOGFILE,">> $logfile") || die("can't open logfile: $!"));
$backupdir = $opt_b || $ENV{FAI_BACKUPDIR};
+if ($opt_U && -f "/var/run/fai/fai_softupdate_is_running" ) {
+ print "Skipping this fcopy command during softupdate." if $verbose;
+ exit 0;
+}
+
if ($ENV{FCOPY_LASTLOG} and $ENV{FCOPY_UPDATELOG}) {
$opt_update = "$ENV{FCOPY_LASTLOG},$ENV{FCOPY_UPDATELOG}";
}
More information about the Fai-commit
mailing list