1
0
mirror of synced 2026-01-13 15:17:30 +00:00
This commit is contained in:
Steve Kemp 2009-01-11 23:23:59 +00:00
parent 3e120099d7
commit 5c899053cd
10 changed files with 732 additions and 746 deletions

View File

@ -196,7 +196,7 @@ install: fixup-perms install-bin install-etc install-hooks install-libraries ins
# Build our manpages via the `pod2man` command.
#
manpages:
mkdir man
-mkdir man
cd bin; for i in *-*; do pod2man --release=${VERSION} --official --section=8 $$i ../man/$$i.8; done
for i in man/*.8; do gzip --force -9 $$i; done

File diff suppressed because it is too large Load Diff

View File

@ -124,7 +124,7 @@ my %CONFIG;
#
# Default options
#
$CONFIG{'template'} = '/etc/xen-tools/xm-nfs.tmpl';
$CONFIG{ 'template' } = '/etc/xen-tools/xm-nfs.tmpl';
#
@ -134,7 +134,7 @@ my $RELEASE = '4.1';
# store version number away.
$CONFIG{'xen_tools_version'} = $RELEASE;
$CONFIG{ 'xen_tools_version' } = $RELEASE;
#
@ -161,13 +161,13 @@ testArguments();
if ( -e "/etc/xen/$CONFIG{'hostname'}.cfg" )
{
die "Configuration file for $CONFIG{'hostname'} already exists"
unless ( $CONFIG{'force'} );
unless ( $CONFIG{ 'force' } );
}
#
# If we've been given any administrators then set them up.
#
if ( $CONFIG{'admins'} )
if ( $CONFIG{ 'admins' } )
{
setupAdminUsers();
}
@ -258,7 +258,7 @@ sub readConfigurationFile
}
# Store value.
$CONFIG{$key} = $val;
$CONFIG{ $key } = $val;
}
}
@ -288,30 +288,30 @@ sub parseCommandLineArguments
GetOptions(
# Networking options
"dhcp", \$CONFIG{'dhcp'},
"gateway=s", \$CONFIG{'gateway'},
"broadcast=s", \$CONFIG{'broadcast'},
"ip=s", \$CONFIG{'ip'},
"netmask=s", \$CONFIG{'netmask'},
"hostname=s", \$CONFIG{'hostname'},
"memory=s", \$CONFIG{'memory'},
"mac=s", \$CONFIG{'mac'},
"dhcp", \$CONFIG{ 'dhcp' },
"gateway=s", \$CONFIG{ 'gateway' },
"broadcast=s", \$CONFIG{ 'broadcast' },
"ip=s", \$CONFIG{ 'ip' },
"netmask=s", \$CONFIG{ 'netmask' },
"hostname=s", \$CONFIG{ 'hostname' },
"memory=s", \$CONFIG{ 'memory' },
"mac=s", \$CONFIG{ 'mac' },
# NFS options.
"nfs_server=s", \$CONFIG{'nfs_server'},
"nfs_root=s", \$CONFIG{'nfs_root'},
"nfs_server=s", \$CONFIG{ 'nfs_server' },
"nfs_root=s", \$CONFIG{ 'nfs_root' },
# Misc. options
"admins=s", \$CONFIG{'admins'},
"kernel=s", \$CONFIG{'kernel'},
"initrd=s", \$CONFIG{'initrd'},
"force", \$CONFIG{'force'},
"template=s", \$CONFIG{'template'},
"admins=s", \$CONFIG{ 'admins' },
"kernel=s", \$CONFIG{ 'kernel' },
"initrd=s", \$CONFIG{ 'initrd' },
"force", \$CONFIG{ 'force' },
"template=s", \$CONFIG{ 'template' },
# Help options
"help", \$HELP,
"manual", \$MANUAL,
"verbose", \$CONFIG{'verbose'},
"verbose", \$CONFIG{ 'verbose' },
"version", \$VERSION
);
@ -349,33 +349,33 @@ sub testArguments
#
# Hostname is mandatory
#
die "No hostname" unless ( $CONFIG{'hostname'} );
die "No hostname" unless ( $CONFIG{ 'hostname' } );
my @network = qw/ ip gateway netmask /;
#
# If DHCP then all the other options aren't needed
#
if ( $CONFIG{'dhcp'} )
if ( $CONFIG{ 'dhcp' } )
{
foreach my $f (@network)
{
delete( $CONFIG{$f} );
delete( $CONFIG{ $f } );
}
}
else
{
foreach my $f (@network)
{
die "Missing --$f" unless ( $CONFIG{$f} );
die "Missing --$f" unless ( $CONFIG{ $f } );
}
}
#
# We need an NFS server + root
#
die "Missing NFS server." unless ( $CONFIG{'nfs_server'} );
die "Missing NFS root." unless ( $CONFIG{'nfs_root'} );
die "Missing NFS server." unless ( $CONFIG{ 'nfs_server' } );
die "Missing NFS root." unless ( $CONFIG{ 'nfs_root' } );
# All OK.
@ -420,7 +420,7 @@ sub setupAdminUsers
# For each user make sure they exist, and setup the
# login shell for them.
#
foreach my $user ( split( /,/, $ENV{'admins'} ) )
foreach my $user ( split( /,/, $ENV{ 'admins' } ) )
{
# Strip leading and trailing whitespace.
@ -435,22 +435,22 @@ sub setupAdminUsers
{
# Change shell.
$CONFIG{'verbose'} && print "Changing shell for $user: $shell\n";
$CONFIG{ 'verbose' } && print "Changing shell for $user: $shell\n";
system( "chsh", "-s", $shell, $user );
}
else
{
# Add a new user.
$CONFIG{'verbose'} && print "Adding new user: $user\n";
$CONFIG{ 'verbose' } && print "Adding new user: $user\n";
system( "useradd", "-s", $shell, $user );
}
#
# Add the entry to /etc/sudoers.
#
open( SUDOERS, ">>", "/etc/sudoers" )
or warn "Failed to add user to sudoers file : $user - $!";
open( SUDOERS, ">>", "/etc/sudoers" ) or
warn "Failed to add user to sudoers file : $user - $!";
print SUDOERS
"$user ALL = NOPASSWD: /usr/sbin/xm, /usr/bin/xen-create-image\n";
close(SUDOERS);
@ -470,13 +470,13 @@ sub setupAdminUsers
sub createNewConfigurationFile
{
die "Template file missing: $CONFIG{'template'}"
unless ( -e $CONFIG{'template'} );
unless ( -e $CONFIG{ 'template' } );
#
# Load the template.
#
my $template = new Text::Template( TYPE => 'FILE',
SOURCE => $CONFIG{'template'} );
SOURCE => $CONFIG{ 'template' } );
my $result = $template->fill_in( HASH => \%CONFIG );

View File

@ -198,7 +198,7 @@ checkArguments();
#
# Abort if non-root user.
#
if ( ( !$CONFIG{'test'} ) && ( $EFFECTIVE_USER_ID != 0 ) )
if ( ( !$CONFIG{ 'test' } ) && ( $EFFECTIVE_USER_ID != 0 ) )
{
print <<E_O_ROOT;
@ -231,7 +231,7 @@ while ( my $name = shift )
#
# Also delete any which were specified using the --hostname flag
#
my $hosts = $CONFIG{'hostname'};
my $hosts = $CONFIG{ 'hostname' };
foreach my $name (@$hosts)
{
if ( !xenRunning($name) )
@ -318,7 +318,7 @@ sub readConfigurationFile
}
# Store value.
$CONFIG{$key} = $val;
$CONFIG{ $key } = $val;
}
}
@ -343,17 +343,16 @@ sub parseCommandLineArguments
# Parse options.
#
GetOptions(
"dir=s", \$CONFIG{'dir'},
"lvm=s", \$CONFIG{'lvm'},
"evms=s", \$CONFIG{'evms'},
"hostname=s@", \$CONFIG{'hostname'},
"test", \$CONFIG{'test'},
"verbose", \$CONFIG{'verbose'},
GetOptions( "dir=s", \$CONFIG{ 'dir' },
"lvm=s", \$CONFIG{ 'lvm' },
"evms=s", \$CONFIG{ 'evms' },
"hostname=s@", \$CONFIG{ 'hostname' },
"test", \$CONFIG{ 'test' },
"verbose", \$CONFIG{ 'verbose' },
"help", \$HELP,
"manual", \$MANUAL,
"version", \$VERSION
);
);
pod2usage(1) if $HELP;
pod2usage( -verbose => 2 ) if $MANUAL;
@ -390,10 +389,10 @@ sub checkArguments
#
# When testing we only care about loopback images, not disk images.
#
if ( $CONFIG{'test'} )
if ( $CONFIG{ 'test' } )
{
$CONFIG{'lvm'} = undef;
$CONFIG{'evms'} = undef;
$CONFIG{ 'lvm' } = undef;
$CONFIG{ 'evms' } = undef;
}
#
@ -402,7 +401,7 @@ sub checkArguments
my $count = 0;
foreach my $type (qw/dir lvm evms/)
{
$count += 1 if defined( $CONFIG{$type} );
$count += 1 if defined( $CONFIG{ $type } );
}
#
@ -435,8 +434,8 @@ sub xenRunning
my $running = 0;
open( CMD, "xm list $hostname 2>/dev/null |" )
or die "Failed to run 'xm list $hostname'";
open( CMD, "xm list $hostname 2>/dev/null |" ) or
die "Failed to run 'xm list $hostname'";
while (<CMD>)
{
my $line = $_;
@ -499,9 +498,9 @@ sub deleteXenImage
}
if ( defined( $CONFIG{'dir'} ) )
if ( defined( $CONFIG{ 'dir' } ) )
{
my $prefix = $CONFIG{'dir'} . "/domains/";
my $prefix = $CONFIG{ 'dir' } . "/domains/";
#
# Now remove the directory.
@ -512,7 +511,7 @@ sub deleteXenImage
rmdir( $prefix . $hostname );
}
}
elsif ( defined( $CONFIG{'lvm'} ) )
elsif ( defined( $CONFIG{ 'lvm' } ) )
{
#
@ -535,7 +534,7 @@ sub deleteXenImage
}
}
elsif ( defined( $CONFIG{'evms'} ) )
elsif ( defined( $CONFIG{ 'evms' } ) )
{
#
@ -589,12 +588,12 @@ sub runCommand
#
# Header.
#
$CONFIG{'verbose'} && print "Executing : $cmd\n";
$CONFIG{ 'verbose' } && print "Executing : $cmd\n";
#
# Hide output unless running with --debug.
#
if ( $CONFIG{'verbose'} )
if ( $CONFIG{ 'verbose' } )
{
#
@ -624,10 +623,10 @@ sub runCommand
#
# All done.
#
$CONFIG{'verbose'} && print "Output\n";
$CONFIG{'verbose'} && print "======\n";
$CONFIG{'verbose'} && print $output . "\n";
$CONFIG{'verbose'} && print "Finished : $cmd\n";
$CONFIG{ 'verbose' } && print "Output\n";
$CONFIG{ 'verbose' } && print "======\n";
$CONFIG{ 'verbose' } && print $output . "\n";
$CONFIG{ 'verbose' } && print "Finished : $cmd\n";
return ($output);
}

View File

@ -97,7 +97,7 @@ my %CONFIG;
#
# Default prefix
#
$CONFIG{'prefix'} = "/etc/xen";
$CONFIG{ 'prefix' } = "/etc/xen";
#
# Release number.
@ -131,7 +131,7 @@ my @instances = findXenInstances();
my $count = 0;
foreach my $instance (@instances)
{
if ($count) { print "\n"; }
if ($count) {print "\n";}
displayInstance($instance);
$count += 1;
@ -214,7 +214,7 @@ sub readConfigurationFile
}
# Store value.
$CONFIG{$key} = $val;
$CONFIG{ $key } = $val;
}
}
close(FILE);
@ -238,8 +238,8 @@ sub parseCommandLineArguments
# Parse options.
#
GetOptions( "test=s", \$CONFIG{'prefix'}, "help", \$HELP, "manual",
\$MANUAL, "version", \$VERSION );
GetOptions( "test=s", \$CONFIG{ 'prefix' },
"help", \$HELP, "manual", \$MANUAL, "version", \$VERSION );
pod2usage(1) if $HELP;
pod2usage( -verbose => 2 ) if $MANUAL;
@ -273,7 +273,7 @@ sub findXenInstances
{
my @found;
foreach my $file ( sort( glob( $CONFIG{'prefix'} . "/*.cfg" ) ) )
foreach my $file ( sort( glob( $CONFIG{ 'prefix' } . "/*.cfg" ) ) )
{
push @found, $file if ( -e $file );
}

View File

@ -143,13 +143,14 @@ testArguments();
#
my $path = undef;
if ( $CONFIG{'dir'} )
if ( $CONFIG{ 'dir' } )
{
#
# Make sure we can find the disk
#
$path = $CONFIG{'dir'} . "/domains/" . $CONFIG{'hostname'} . "/disk.img";
$path =
$CONFIG{ 'dir' } . "/domains/" . $CONFIG{ 'hostname' } . "/disk.img";
if ( !-e $path )
{
print <<EOF;
@ -187,7 +188,7 @@ EOF
#
# Allow panic
#
if ( !$CONFIG{'force'} )
if ( !$CONFIG{ 'force' } )
{
foreach my $i ( 1 .. 10 )
{
@ -202,13 +203,13 @@ EOF
my $cmd = "dd if=/dev/zero bs=1M count=$CONFIG{'add'}k >> $path";
system($cmd );
}
elsif ( $CONFIG{'lvm'} )
elsif ( $CONFIG{ 'lvm' } )
{
#
# Make sure we can find the disk
#
$path = "/dev/" . $CONFIG{'lvm'} . "/" . $CONFIG{'hostname'} . "-disk";
$path = "/dev/" . $CONFIG{ 'lvm' } . "/" . $CONFIG{ 'hostname' } . "-disk";
if ( !-e $path )
{
print <<EOF;
@ -246,7 +247,7 @@ EOF
#
# Allow panic
#
if ( !$CONFIG{'force'} )
if ( !$CONFIG{ 'force' } )
{
foreach my $i ( 1 .. 10 )
{
@ -355,7 +356,7 @@ sub readConfigurationFile
}
# Store value.
$CONFIG{$key} = $val;
$CONFIG{ $key } = $val;
}
}
@ -389,16 +390,16 @@ sub parseCommandLineArguments
GetOptions(
# Misc. options
"add=s", \$CONFIG{'add'},
"dir=s", \$install{'dir'},
"lvm=s", \$install{'lvm'},
"hostname=s", \$CONFIG{'hostname'},
"force", \$CONFIG{'force'},
"add=s", \$CONFIG{ 'add' },
"dir=s", \$install{ 'dir' },
"lvm=s", \$install{ 'lvm' },
"hostname=s", \$CONFIG{ 'hostname' },
"force", \$CONFIG{ 'force' },
# Help options
"help", \$HELP,
"manual", \$MANUAL,
"verbose", \$CONFIG{'verbose'},
"verbose", \$CONFIG{ 'verbose' },
"version", \$VERSION
);
@ -417,17 +418,17 @@ sub parseCommandLineArguments
# they will allow the configuration values to be overriden by
# the command line.
#
if ( $install{'lvm'} )
if ( $install{ 'lvm' } )
{
$CONFIG{'lvm'} = $install{'lvm'};
$CONFIG{'dir'} = undef;
delete $CONFIG{'dir'};
$CONFIG{ 'lvm' } = $install{ 'lvm' };
$CONFIG{ 'dir' } = undef;
delete $CONFIG{ 'dir' };
}
if ( $install{'dir'} )
if ( $install{ 'dir' } )
{
$CONFIG{'dir'} = $install{'dir'};
$CONFIG{'lvm'} = undef;
delete $CONFIG{'lvm'};
$CONFIG{ 'dir' } = $install{ 'dir' };
$CONFIG{ 'lvm' } = undef;
delete $CONFIG{ 'lvm' };
}
}
@ -447,7 +448,7 @@ sub testArguments
#
# Make sure we received a hostname.
#
if ( !$CONFIG{'hostname'} )
if ( !$CONFIG{ 'hostname' } )
{
print <<EOF;
@ -462,7 +463,7 @@ EOF
#
# Make sure we received a size.
#
if ( !$CONFIG{'add'} )
if ( !$CONFIG{ 'add' } )
{
print <<EOF;
@ -478,7 +479,7 @@ EOF
#
# Make sure the guest isn't running
#
if ( xenRunning( $CONFIG{'hostname'} ) )
if ( xenRunning( $CONFIG{ 'hostname' } ) )
{
print "The guest $CONFIG{'hostname'} appears to be running!\n";
exit 1;
@ -488,8 +489,10 @@ EOF
# We should either have LVM *or* directory - not neither or both.
#
my $options = 0;
$options += 1 if ( defined( $CONFIG{'lvm'} ) && length( $CONFIG{'lvm'} ) );
$options += 1 if ( defined( $CONFIG{'dir'} ) && length( $CONFIG{'dir'} ) );
$options += 1
if ( defined( $CONFIG{ 'lvm' } ) && length( $CONFIG{ 'lvm' } ) );
$options += 1
if ( defined( $CONFIG{ 'dir' } ) && length( $CONFIG{ 'dir' } ) );
#
# Report
@ -508,13 +511,13 @@ EOF
#
# Convert from Gb -> Mb;
#
if ( $CONFIG{'add'} =~ /^([0-9.]+)Gb*$/i )
if ( $CONFIG{ 'add' } =~ /^([0-9.]+)Gb*$/i )
{
$CONFIG{'add'} = $1 * 1024;
$CONFIG{ 'add' } = $1 * 1024;
}
if ( $CONFIG{'add'} =~ /^([0-9.]+)Mb*$/i )
if ( $CONFIG{ 'add' } =~ /^([0-9.]+)Mb*$/i )
{
$CONFIG{'add'} = $1;
$CONFIG{ 'add' } = $1;
}
}
@ -534,8 +537,8 @@ sub xenRunning
my $running = 0;
open( CMD, "xm list $hostname 2>/dev/null |" )
or die "Failed to run 'xm list $hostname'";
open( CMD, "xm list $hostname 2>/dev/null |" ) or
die "Failed to run 'xm list $hostname'";
while (<CMD>)
{
my $line = $_;

View File

@ -210,11 +210,11 @@ sub updateXenImage
# If we're dealing with loopback images find the main one,
# and mount it.
#
if ( $CONFIG{'dir'} )
if ( $CONFIG{ 'dir' } )
{
# The loopback image.
$img = $CONFIG{'dir'} . "/domains/" . $name . "/disk.img";
$img = $CONFIG{ 'dir' } . "/domains/" . $name . "/disk.img";
if ( !-e $img )
{
@ -224,11 +224,11 @@ sub updateXenImage
$mount_cmd = "mount -t auto -o loop $img $tmp";
}
elsif ( $CONFIG{'lvm'} )
elsif ( $CONFIG{ 'lvm' } )
{
# The LVM volume
$img = "/dev/" . $CONFIG{'lvm'} . "/$name-disk";
$img = "/dev/" . $CONFIG{ 'lvm' } . "/$name-disk";
# make sure it exists.
if ( !-e $img )
@ -239,22 +239,22 @@ sub updateXenImage
$mount_cmd = "mount -t auto $img $tmp";
}
elsif ( $CONFIG{'evms'} )
elsif ( $CONFIG{ 'evms' } )
{
# The EVMS volume -- note, unlike LVM, you don't need the $CONFIG{'evms'}
# to see it and mount the volume. $CONFIG{'evms'} is only used for manipulating
# the underlying object. Still, I don't want to mess with the parse code and
# make it confusing - otherwise --evms takes an argument everywhere but here,
# which will confuse users. The better solution is to make it so that --evms can
# take a following container, but doesn't require it. For the moment, it is
# better to leave it as it is, take a container, and then ignore it.
# The EVMS volume -- note, unlike LVM, you don't need the $CONFIG{'evms'}
# to see it and mount the volume. $CONFIG{'evms'} is only used for manipulating
# the underlying object. Still, I don't want to mess with the parse code and
# make it confusing - otherwise --evms takes an argument everywhere but here,
# which will confuse users. The better solution is to make it so that --evms can
# take a following container, but doesn't require it. For the moment, it is
# better to leave it as it is, take a container, and then ignore it.
# The best way to do it is to just read it out of the configuration file,
# tell the user what you got and where you got it from, and not bother the user
# with picking --dir or --lvm or --evms at all, but infer it from the config
# file's disk = parameter. xen-delete-image might work the same way, but
# it could be *slightly* more dangerous in the context of deleting.
# The best way to do it is to just read it out of the configuration file,
# tell the user what you got and where you got it from, and not bother the user
# with picking --dir or --lvm or --evms at all, but infer it from the config
# file's disk = parameter. xen-delete-image might work the same way, but
# it could be *slightly* more dangerous in the context of deleting.
$img = "/dev/evms/$name-disk";
# make sure it exists.
@ -279,8 +279,8 @@ sub updateXenImage
#
# Make sure this is a Debian image.
#
if ( ( -e $tmp . "/usr/bin/apt-get" )
&& ( -x $tmp . "/usr/bin/apt-get" ) )
if ( ( -e $tmp . "/usr/bin/apt-get" ) &&
( -x $tmp . "/usr/bin/apt-get" ) )
{
#
@ -293,7 +293,7 @@ sub updateXenImage
# Now upgrade
#
system(
"DEBIAN_FRONTEND=noninteractive chroot $tmp /usr/bin/apt-get upgrade --yes --force-yes"
"DEBIAN_FRONTEND=noninteractive chroot $tmp /usr/bin/apt-get upgrade --yes --force-yes"
);
}
else
@ -326,8 +326,8 @@ sub xenRunning
my $running = 0;
open( CMD, "xm list 2>/dev/null |" )
or die "Failed to run 'xm list $hostname'";
open( CMD, "xm list 2>/dev/null |" ) or
die "Failed to run 'xm list $hostname'";
while (<CMD>)
{
my $line = $_;
@ -407,7 +407,7 @@ sub readConfigurationFile
}
# Store value.
$CONFIG{$key} = $val;
$CONFIG{ $key } = $val;
}
}
@ -432,11 +432,10 @@ sub parseCommandLineArguments
# Parse options.
#
GetOptions(
"dir=s", \$CONFIG{'dir'}, "lvm=s", \$CONFIG{'lvm'},
"evms=s", \$CONFIG{'evms'}, "help", \$HELP,
"manual", \$MANUAL, "version", \$VERSION
);
GetOptions( "dir=s", \$CONFIG{ 'dir' }, "lvm=s", \$CONFIG{ 'lvm' },
"evms=s", \$CONFIG{ 'evms' }, "help", \$HELP,
"manual", \$MANUAL, "version", \$VERSION
);
pod2usage(1) if $HELP;
pod2usage( -verbose => 2 ) if $MANUAL;
@ -475,7 +474,7 @@ sub checkArguments
my $count = 0;
foreach my $type (qw/dir lvm evms/)
{
$count += 1 if defined( $CONFIG{$type} );
$count += 1 if defined( $CONFIG{ $type } );
}
#

View File

@ -150,7 +150,7 @@ my @PARTITIONS = undef;
#
# Default options
#
$CONFIG{'template'} = '/etc/xen-tools/xm.tmpl';
$CONFIG{ 'template' } = '/etc/xen-tools/xm.tmpl';
#
@ -175,7 +175,7 @@ checkArguments();
#
# If we've been given any administrators then set them up.
#
if ( $ENV{'admins'} )
if ( $ENV{ 'admins' } )
{
setupAdminUsers();
}
@ -213,16 +213,15 @@ sub parseCommandLineArguments
#
# Parse options.
#
GetOptions(
"admins=s", \$ENV{'admins'},
"output=s", \$CONFIG{'output'},
"extension=s", \$CONFIG{'extension'},
"template=s", \$CONFIG{'template'},
"verbose", \$CONFIG{'verbose'},
GetOptions( "admins=s", \$ENV{ 'admins' },
"output=s", \$CONFIG{ 'output' },
"extension=s", \$CONFIG{ 'extension' },
"template=s", \$CONFIG{ 'template' },
"verbose", \$CONFIG{ 'verbose' },
"help", \$HELP,
"manual", \$MANUAL,
"version", \$VERSION
);
);
pod2usage(1) if $HELP;
pod2usage( -verbose => 2 ) if $MANUAL;
@ -257,7 +256,7 @@ sub checkArguments
#
# We require an output location.
#
if ( !defined( $CONFIG{'output'} ) )
if ( !defined( $CONFIG{ 'output' } ) )
{
print "The '--output' argument is mandatory\n";
exit 1;
@ -266,10 +265,10 @@ sub checkArguments
#
# The output location should be a directory which exists.
#
if ( !-d $CONFIG{'output'} )
if ( !-d $CONFIG{ 'output' } )
{
print
"The output directory we've been given, $CONFIG{'output'}, doesnt exist\n";
"The output directory we've been given, $CONFIG{'output'}, doesnt exist\n";
print "Aborting\n";
exit 1;
}
@ -277,12 +276,12 @@ sub checkArguments
#
# Make sure that any specified template file exists.
#
if ( defined( $CONFIG{'template'} ) )
if ( defined( $CONFIG{ 'template' } ) )
{
if ( !-e $CONFIG{'template'} )
if ( !-e $CONFIG{ 'template' } )
{
print
"The specified template file, $CONFIG{'template'} does not exist.\n";
"The specified template file, $CONFIG{'template'} does not exist.\n";
exit 1;
}
}
@ -306,21 +305,17 @@ sub importPartitionsFromEnvironment
{
@PARTITIONS = ();
for ( my $i = 1 ; $i <= $ENV{'NUMPARTITIONS'} ; $i++ )
for ( my $i = 1 ; $i <= $ENV{ 'NUMPARTITIONS' } ; $i++ )
{
my @parts = split( /:/, $ENV{'PARTITION' . $i}, 7 );
push(
@PARTITIONS,
{
'name' => $parts[0],
'size' => $parts[1],
'type' => $parts[2],
'mountpoint' => $parts[3],
'options' => $parts[4],
'imagetype' => $parts[5],
'image' => $parts[6]
}
);
my @parts = split( /:/, $ENV{ 'PARTITION' . $i }, 7 );
push( @PARTITIONS,
{ 'name' => $parts[0],
'size' => $parts[1],
'type' => $parts[2],
'mountpoint' => $parts[3],
'options' => $parts[4],
'imagetype' => $parts[5],
'image' => $parts[6] } );
}
}
@ -342,26 +337,27 @@ sub createXenConfig
#
# The output file we're going to process.
#
my $file = $CONFIG{'output'} . '/' . $ENV{'hostname'} . $ENV{'extension'};
my $file =
$CONFIG{ 'output' } . '/' . $ENV{ 'hostname' } . $ENV{ 'extension' };
#
# The template we're going to read from.
#
my $template = new Text::Template( TYPE => 'FILE',
SOURCE => $CONFIG{'template'} );
SOURCE => $CONFIG{ 'template' } );
#
# The device we're using.
#
my $device = 'sda';
if ( defined( $ENV{'ide'} ) )
if ( defined( $ENV{ 'ide' } ) )
{
$device = 'hda';
}
elsif ( defined( $ENV{'disk_device'} ) )
elsif ( defined( $ENV{ 'disk_device' } ) )
{
$device = $ENV{'disk_device'};
$device = $ENV{ 'disk_device' };
# strip /dev/, if present.
if ( $device =~ /^(.*)\/(.*)$/ )
@ -369,65 +365,65 @@ sub createXenConfig
$device = $2;
}
}
$ENV{'device'} = $device;
$ENV{ 'device' } = $device;
#
# The memory size: Convert Gb -> Mb.
#
if ( $ENV{'memory'} =~ /^(\d+)Gb*$/i )
if ( $ENV{ 'memory' } =~ /^(\d+)Gb*$/i )
{
$ENV{'memory'} = $1 * 1024;
$ENV{ 'memory' } = $1 * 1024;
}
#
# Remove any trailing Mb.
#
if ( $ENV{'memory'} =~ /^(\d+)Mb*$/i )
if ( $ENV{ 'memory' } =~ /^(\d+)Mb*$/i )
{
$ENV{'memory'} = $1;
$ENV{ 'memory' } = $1;
}
#
# Images as presented to Xen - either loopback images, or LVM partitions.
#
if ( $ENV{'lvm'} )
if ( $ENV{ 'lvm' } )
{
$ENV{'image_prefix'} = "phy:$ENV{'lvm'}/$ENV{'hostname'}-";
$ENV{'image_suffix'} = '';
$ENV{ 'image_prefix' } = "phy:$ENV{'lvm'}/$ENV{'hostname'}-";
$ENV{ 'image_suffix' } = '';
importPartitionsFromEnvironment();
}
elsif ( $ENV{'evms'} )
elsif ( $ENV{ 'evms' } )
{
$ENV{'image_prefix'} = "phy:/dev/evms/$ENV{'hostname'}-";
$ENV{'image_suffix'} = '';
$ENV{ 'image_prefix' } = "phy:/dev/evms/$ENV{'hostname'}-";
$ENV{ 'image_suffix' } = '';
importPartitionsFromEnvironment();
}
elsif ( $ENV{'image-dev'} )
elsif ( $ENV{ 'image-dev' } )
{
$ENV{'image_vbd'} = "phy:$ENV{'image-dev'}";
$ENV{ 'image_vbd' } = "phy:$ENV{'image-dev'}";
if ( $ENV{'swap-dev'} )
if ( $ENV{ 'swap-dev' } )
{
$ENV{'swap_vbd'} = "phy:$ENV{'swap-dev'}";
$ENV{ 'swap_vbd' } = "phy:$ENV{'swap-dev'}";
}
else
{
$ENV{'swap_vbd'} = undef;
$ENV{ 'swap_vbd' } = undef;
}
}
else
{
$ENV{'image_prefix'} = "file:$ENV{'dir'}/domains/$ENV{'hostname'}/";
$ENV{'image_suffix'} = '.img';
$ENV{ 'image_prefix' } = "file:$ENV{'dir'}/domains/$ENV{'hostname'}/";
$ENV{ 'image_suffix' } = '.img';
importPartitionsFromEnvironment();
}
#
# The xen-tools version.
#
$ENV{'xen_tools_version'} = $RELEASE;
$ENV{ 'xen_tools_version' } = $RELEASE;
#
@ -438,9 +434,9 @@ sub createXenConfig
my %vars;
foreach my $key ( sort keys %ENV )
{
$vars{$key} = $ENV{$key};
$vars{ $key } = $ENV{ $key };
}
$vars{'PARTITIONS'} = \@PARTITIONS;
$vars{ 'PARTITIONS' } = \@PARTITIONS;
#
# Now output the data.
@ -510,7 +506,7 @@ sub setupAdminUsers
# For each user make sure they exist, and setup the
# login shell for them.
#
foreach my $user ( split( /,/, $ENV{'admins'} ) )
foreach my $user ( split( /,/, $ENV{ 'admins' } ) )
{
# Strip leading and trailing whitespace.
@ -525,22 +521,22 @@ sub setupAdminUsers
{
# Change shell.
$CONFIG{'verbose'} && print "Changing shell for $user: $shell\n";
$CONFIG{ 'verbose' } && print "Changing shell for $user: $shell\n";
system( "chsh", "-s", $shell, $user );
}
else
{
# Add a new user.
$CONFIG{'verbose'} && print "Adding new user: $user\n";
$CONFIG{ 'verbose' } && print "Adding new user: $user\n";
system( "useradd", "-s", $shell, $user );
}
#
# Add the entry to /etc/sudoers.
#
open( SUDOERS, ">>", "/etc/sudoers" )
or warn "Failed to add user to sudoers file : $user - $!";
open( SUDOERS, ">>", "/etc/sudoers" ) or
warn "Failed to add user to sudoers file : $user - $!";
print SUDOERS
"$user ALL = NOPASSWD: /usr/sbin/xm, /usr/bin/xen-create-image\n";
close(SUDOERS);

View File

@ -144,14 +144,13 @@ sub parseCommandLineArguments
#
# Parse options.
#
GetOptions(
"location=s", \$CONFIG{'location'},
"dist=s", \$CONFIG{'dist'},
"verbose", \$CONFIG{'verbose'},
GetOptions( "location=s", \$CONFIG{ 'location' },
"dist=s", \$CONFIG{ 'dist' },
"verbose", \$CONFIG{ 'verbose' },
"help", \$HELP,
"manual", \$MANUAL,
"version", \$VERSION
);
);
pod2usage(1) if $HELP;
pod2usage( -verbose => 2 ) if $MANUAL;
@ -186,7 +185,7 @@ sub checkArguments
#
# We require a location.
#
if ( !defined( $CONFIG{'location'} ) )
if ( !defined( $CONFIG{ 'location' } ) )
{
print "The '--location' argument is mandatory\n";
exit 1;
@ -196,7 +195,7 @@ sub checkArguments
#
# Test that the location we've been given exists
#
if ( !-d $CONFIG{'location'} )
if ( !-d $CONFIG{ 'location' } )
{
print "The installation directory we've been given doesn't exist\n";
print "We tried to use : $CONFIG{'location'}\n";
@ -207,7 +206,7 @@ sub checkArguments
#
# We require a distribution name.
#
if ( !defined( $CONFIG{'dist'} ) )
if ( !defined( $CONFIG{ 'dist' } ) )
{
print "The '--dist' argument is mandatory\n";
exit 1;
@ -221,7 +220,7 @@ sub checkArguments
# If there are no scripts then we clearly cannot
# customise it!
#
my $dir = "/usr/lib/xen-tools/" . $CONFIG{'dist'} . ".d";
my $dir = "/usr/lib/xen-tools/" . $CONFIG{ 'dist' } . ".d";
if ( !-d $dir )
{
@ -263,12 +262,12 @@ sub runDistributionHooks
#
# Hook directory.
#
my $hooks = "/usr/lib/xen-tools/" . $CONFIG{'dist'} . ".d/";
my $hooks = "/usr/lib/xen-tools/" . $CONFIG{ 'dist' } . ".d/";
#
# Installation prefix
#
my $prefix = $CONFIG{'location'};
my $prefix = $CONFIG{ 'location' };
#
# If we're running verbosely then setup the client environment
@ -277,9 +276,9 @@ sub runDistributionHooks
# This is useful in case this script is called outwith the usual
# xen-create-image framework.
#
if ( $CONFIG{'verbose'} )
if ( $CONFIG{ 'verbose' } )
{
$ENV{'verbose'} = 1;
$ENV{ 'verbose' } = 1;
}
#
@ -317,7 +316,7 @@ sub runDistributionHooks
# Run the command. This has different prolog and epilog
# depending on whether we're running verbosely or not.
#
if ( $CONFIG{'verbose'} )
if ( $CONFIG{ 'verbose' } )
{
print "Running hook $name ['$cmd']\n";
print "--\n";

View File

@ -128,33 +128,26 @@ my $RELEASE = '4.1';
#
#
my %dispatch = (
"copy" => {
sub => \&do_copy,
needBinary => "/bin/cp",
needDirectory => 1,
},
"debootstrap" => {
sub => \&do_debootstrap,
needBinary => "/usr/sbin/debootstrap",
},
"image-server" => {
sub => \&do_image_server,
needURL => 1,
},
"rinse" => {
sub => \&do_rinse,
needBinary => "/usr/bin/rinse",
},
"rpmstrap" => {
sub => \&do_rpmstrap,
needBinary => "/usr/bin/rpmstrap",
},
"tar" => {
sub => \&do_tar,
needBinary => "/bin/tar",
needFile => 1,
}
);
"copy" => { sub => \&do_copy,
needBinary => "/bin/cp",
needDirectory => 1,
},
"debootstrap" => { sub => \&do_debootstrap,
needBinary => "/usr/sbin/debootstrap",
},
"image-server" => { sub => \&do_image_server,
needURL => 1,
},
"rinse" => { sub => \&do_rinse,
needBinary => "/usr/bin/rinse",
},
"rpmstrap" => { sub => \&do_rpmstrap,
needBinary => "/usr/bin/rpmstrap",
},
"tar" => { sub => \&do_tar,
needBinary => "/bin/tar",
needFile => 1,
} );
@ -173,9 +166,9 @@ parseCommandLineArguments();
#
# If we received a configuration file then read it.
#
if ( $CONFIG{'config'} )
if ( $CONFIG{ 'config' } )
{
my $path = $CONFIG{'config'};
my $path = $CONFIG{ 'config' };
# If not fully-qualified then read from /etc/xen-tools.
if ( $path !~ /^[\/]/ )
@ -197,14 +190,14 @@ checkArguments();
#
# Now lookup our installation type and dispatch control to it.
#
if ( defined( $CONFIG{'install-method'} )
&& length( $CONFIG{'install-method'} ) )
if ( defined( $CONFIG{ 'install-method' } ) &&
length( $CONFIG{ 'install-method' } ) )
{
#
# Get the entry from the dispatch table.
#
my $installer = $dispatch{lc( $CONFIG{'install-method'} )};
my $installer = $dispatch{ lc( $CONFIG{ 'install-method' } ) };
if ( defined($installer) )
{
@ -214,48 +207,48 @@ if ( defined( $CONFIG{'install-method'} )
#
# Do we need to test for a binary.
if ( ( $installer->{'needBinary'} )
&& ( !-x $installer->{'needBinary'} ) )
if ( ( $installer->{ 'needBinary' } ) &&
( !-x $installer->{ 'needBinary' } ) )
{
print
"The following required binary for the installation was not found\n";
print "\t" . $installer->{'needBinary'} . "\n";
"The following required binary for the installation was not found\n";
print "\t" . $installer->{ 'needBinary' } . "\n";
exit 1;
}
# Do we need a directory specified as the installation source?
if ( ( $installer->{'needDirectory'} )
&& ( !$CONFIG{'install-source'} || !-d $CONFIG{'install-source'} ) )
if ( ( $installer->{ 'needDirectory' } ) &&
( !$CONFIG{ 'install-source' } || !-d $CONFIG{ 'install-source' } )
)
{
print "Please specify the source directory with --install-source\n";
if ( $CONFIG{'install-source'} )
if ( $CONFIG{ 'install-source' } )
{
print
"The specified directory $CONFIG{'install-source'} does not exist.\n";
"The specified directory $CONFIG{'install-source'} does not exist.\n";
}
exit 1;
}
# Do we need a file specified as the installation source?
if ( ( $installer->{'needFile'} )
&& ( !$CONFIG{'install-source'} || !-e $CONFIG{'install-source'} ) )
if ( ( $installer->{ 'needFile' } ) &&
( !$CONFIG{ 'install-source' } || !-e $CONFIG{ 'install-source' } )
)
{
print "Please specify the source file with --install-source\n";
if ( $CONFIG{'install-source'} )
if ( $CONFIG{ 'install-source' } )
{
print
"The specified file $CONFIG{'install-source'} does not exist.\n";
"The specified file $CONFIG{'install-source'} does not exist.\n";
}
exit 1;
}
# Do we need an URL specified as the installation source?
if (
( $installer->{'needURL'} )
&& ( !$CONFIG{'install-source'}
|| ( $CONFIG{'install-source'} !~ /^http/i ) )
)
if ( ( $installer->{ 'needURL' } ) &&
( !$CONFIG{ 'install-source' } ||
( $CONFIG{ 'install-source' } !~ /^http/i ) ) )
{
print "Please specify the image server URL with --install-source\n";
exit 1;
@ -266,7 +259,7 @@ if ( defined( $CONFIG{'install-method'} )
#
# Now we can call the appropriate handler.
#
$installer->{'sub'}->();
$installer->{ 'sub' }->();
#
# Did the operation succeed?
@ -275,7 +268,7 @@ if ( defined( $CONFIG{'install-method'} )
#
foreach my $file (qw( /bin/ls /bin/cp ))
{
if ( !-x $CONFIG{'location'} . $file )
if ( !-x $CONFIG{ 'location' } . $file )
{
print "The installation of the new system has failed.\n";
print "\n";
@ -375,7 +368,7 @@ sub readConfigurationFile
}
# Store value.
$CONFIG{$key} = $val;
$CONFIG{ $key } = $val;
}
}
@ -404,22 +397,22 @@ sub parseCommandLineArguments
GetOptions(
# Mandatory
"location=s", \$CONFIG{'location'},
"dist=s", \$CONFIG{'dist'},
"hostname=s", \$CONFIG{'hostname'},
"location=s", \$CONFIG{ 'location' },
"dist=s", \$CONFIG{ 'dist' },
"hostname=s", \$CONFIG{ 'hostname' },
# Installation method
"install-method=s", \$CONFIG{'install-method'},
"install-source=s", \$CONFIG{'install-source'},
"install-method=s", \$CONFIG{ 'install-method' },
"install-source=s", \$CONFIG{ 'install-source' },
# Misc
"arch=s", \$CONFIG{'arch'},
"cache=s", \$CONFIG{'cache'},
"config=s", \$CONFIG{'config'},
"mirror=s", \$CONFIG{'mirror'},
"arch=s", \$CONFIG{ 'arch' },
"cache=s", \$CONFIG{ 'cache' },
"config=s", \$CONFIG{ 'config' },
"mirror=s", \$CONFIG{ 'mirror' },
# Help.
"verbose", \$CONFIG{'verbose'},
"verbose", \$CONFIG{ 'verbose' },
"help", \$HELP,
"manual", \$MANUAL,
"version", \$VERSION
@ -458,7 +451,7 @@ sub checkArguments
#
# We require a location.
#
if ( !defined( $CONFIG{'location'} ) )
if ( !defined( $CONFIG{ 'location' } ) )
{
print "The '--location' argument is mandatory\n";
exit 1;
@ -468,7 +461,7 @@ sub checkArguments
#
# Test that the location we've been given exists
#
if ( !-d $CONFIG{'location'} )
if ( !-d $CONFIG{ 'location' } )
{
print "The installation directory we've been given doesn't exist\n";
print "We tried to use : $CONFIG{'location'}\n";
@ -479,7 +472,7 @@ sub checkArguments
#
# We require a distribution name.
#
if ( !defined( $CONFIG{'dist'} ) )
if ( !defined( $CONFIG{ 'dist' } ) )
{
print "The '--dist' argument is mandatory\n";
exit 1;
@ -493,7 +486,7 @@ sub checkArguments
# If there are no scripts then we clearly cannot
# customise it!
#
my $dir = "/usr/lib/xen-tools/" . $CONFIG{'dist'} . ".d";
my $dir = "/usr/lib/xen-tools/" . $CONFIG{ 'dist' } . ".d";
if ( !-d $dir )
{
@ -516,12 +509,12 @@ E_OR
# Test that we received a valid installation type.
#
my $valid = 0;
if ( defined( $CONFIG{'install-method'} ) )
if ( defined( $CONFIG{ 'install-method' } ) )
{
foreach my $recognised ( keys %dispatch )
{
$valid = 1
if ( lc( $CONFIG{'install-method'} ) eq lc($recognised) );
if ( lc( $CONFIG{ 'install-method' } ) eq lc($recognised) );
}
}
else
@ -567,7 +560,7 @@ sub runCommand
#
# Command start.
#
$CONFIG{'verbose'} && print "Executing : $cmd\n";
$CONFIG{ 'verbose' } && print "Executing : $cmd\n";
#
# Copy stderr to stdout, so we can see it, and make sure we log it.
@ -589,7 +582,7 @@ sub runCommand
#
# Command finished.
#
$CONFIG{'verbose'} && print "Finished : $cmd\n";
$CONFIG{ 'verbose' } && print "Finished : $cmd\n";
return ($output);
}
@ -659,7 +652,7 @@ sub do_copy
#
# Find the copy command to run from the configuration file.
#
my $cmd = $CONFIG{'copy-cmd'};
my $cmd = $CONFIG{ 'copy-cmd' };
if ( !defined($cmd) )
{
print "Falling back to default copy command\n";
@ -695,7 +688,7 @@ sub do_debootstrap
# The command is a little configurable - mostly to allow you
# to use cdebootstrap.
#
my $cmd = $CONFIG{'debootstrap-cmd'};
my $cmd = $CONFIG{ 'debootstrap-cmd' };
if ( !defined($cmd) )
{
print "Falling back to default debootstrap command\n";
@ -707,7 +700,7 @@ sub do_debootstrap
# Cache from host -> new installation if we've got caching
# enabled.
#
if ( $CONFIG{'cache'} eq "yes" )
if ( $CONFIG{ 'cache' } eq "yes" )
{
print "\nCopying files from host to image.\n";
runCommand("mkdir -p $CONFIG{'location'}/var/cache/apt/archives");
@ -720,7 +713,7 @@ sub do_debootstrap
# Propogate --verbose appropriately.
#
my $EXTRA = '';
if ( $CONFIG{'verbose'} )
if ( $CONFIG{ 'verbose' } )
{
$EXTRA = ' --verbose';
}
@ -728,7 +721,7 @@ sub do_debootstrap
#
# Propogate the --arch argument
#
if ( $CONFIG{'arch'} )
if ( $CONFIG{ 'arch' } )
{
$EXTRA .= " --arch $CONFIG{'arch'}";
}
@ -750,7 +743,7 @@ sub do_debootstrap
# Cache from the new installation -> the host if we've got caching
# enabled.
#
if ( $CONFIG{'cache'} eq "yes" )
if ( $CONFIG{ 'cache' } eq "yes" )
{
print "\nCopying files from new installation to host.\n";
copyDebFiles( "$CONFIG{'location'}/var/cache/apt/archives",
@ -806,16 +799,16 @@ sub do_image_server
#
# Build up the request we're going to send.
#
my $request = $CONFIG{'install-source'} . "/create.cgi?submit=1";
my $request = $CONFIG{ 'install-source' } . "/create.cgi?submit=1";
#
# Some parameters are hard-wired.
#
$request .= "&arch=amd64";
$request .= "&root_device=/dev/sda";
$request .= "&ip1=" . $ENV{'ip1'};
$request .= "&dist=" . CGI::escapeHTML( $CONFIG{'dist'} );
$request .= "&hostname=" . CGI::escapeHTML( $CONFIG{'hostname'} );
$request .= "&ip1=" . $ENV{ 'ip1' };
$request .= "&dist=" . CGI::escapeHTML( $CONFIG{ 'dist' } );
$request .= "&hostname=" . CGI::escapeHTML( $CONFIG{ 'hostname' } );
#
# We only care about some keys
@ -824,10 +817,10 @@ sub do_image_server
{
# Skip values which aren't defined.
next unless defined $ENV{$k};
next unless defined $ENV{ $k };
# CGI encode.
my $val = CGI::escapeHTML( $ENV{$k} );
my $val = CGI::escapeHTML( $ENV{ $k } );
# Add on to the request
$request .= "&$k=$val";
@ -852,14 +845,14 @@ sub do_image_server
if ( $content =~ /fetch.cgi\?session=([^"]+)"/ )
{
my $session = $1;
my $new = $CONFIG{'install-source'};
my $new = $CONFIG{ 'install-source' };
$new .= "/fetch.cgi?session=$session";
my $attempt = 1;
# Make sure we don't wait indefinitely.
while ( $attempt < $attempts )
{
$CONFIG{'verbose'} && print "Request: [$attempt/$attempts]\n";
$CONFIG{ 'verbose' } && print "Request: [$attempt/$attempts]\n";
#
# Make a request to see if our tar file is ready yet.
@ -872,7 +865,7 @@ sub do_image_server
# Get the headers
#
my $header = $response->headers();
my $type = $header->{'content-type'};
my $type = $header->{ 'content-type' };
#
# OK our file is correct.
@ -884,14 +877,14 @@ sub do_image_server
# Download it to the installation root.
#
$ua->get( $new,
":content_file" => $CONFIG{'location'}
. "/$session.tar" );
":content_file" => $CONFIG{ 'location' } .
"/$session.tar" );
#
# If it worked .. then untar, remove, and return.
#
system(
"cd $CONFIG{'location'} && tar --numeric-owner -xf $session.tar && rm -f $CONFIG{'location'}/$session.tar"
"cd $CONFIG{'location'} && tar --numeric-owner -xf $session.tar && rm -f $CONFIG{'location'}/$session.tar"
);
return 1;
}
@ -913,8 +906,8 @@ sub do_image_server
}
else
{
print( "ERROR: Submitting the image create request failed:\n"
. $response->status_line );
print( "ERROR: Submitting the image create request failed:\n" .
$response->status_line );
return 0;
}
}
@ -941,7 +934,7 @@ sub do_rinse
#
# Propogate the --arch argument
#
if ( $CONFIG{'arch'} )
if ( $CONFIG{ 'arch' } )
{
$command .= " --arch $CONFIG{'arch'}";
}
@ -950,7 +943,7 @@ sub do_rinse
#
# Propogate the verbosity setting.
#
if ( $CONFIG{'verbose'} )
if ( $CONFIG{ 'verbose' } )
{
$command .= " --verbose";
}
@ -975,7 +968,7 @@ sub do_rpmstrap
# Propogate the verbosity setting.
#
my $EXTRA = '';
if ( $CONFIG{'verbose'} )
if ( $CONFIG{ 'verbose' } )
{
$EXTRA .= " --verbose";
}
@ -983,7 +976,7 @@ sub do_rpmstrap
#
# Propogate any arch setting we might have.
#
if ( $CONFIG{'arch'} )
if ( $CONFIG{ 'arch' } )
{
$EXTRA .= " --arch $CONFIG{'arch'}";
}
@ -992,7 +985,7 @@ sub do_rpmstrap
# Setup mirror if present.
#
my $mirror = "";
$mirror = $CONFIG{'mirror'} if ( $CONFIG{'mirror'} );
$mirror = $CONFIG{ 'mirror' } if ( $CONFIG{ 'mirror' } );
#
# The command we're going to run.
@ -1017,7 +1010,7 @@ sub do_tar
#
# Find the tar command to run from the configuration file.
#
my $cmd = $CONFIG{'tar-cmd'};
my $cmd = $CONFIG{ 'tar-cmd' };
if ( !defined($cmd) )
{
print "Falling back to default tar command\n";