2006-08-20 01:19:56 by steve
Whitespace fixups.
This commit is contained in:
parent
905614a34d
commit
b30c4daa64
@ -96,7 +96,7 @@ xt-create-config - Create a Xen configuration file for a new guest
|
||||
--
|
||||
http://www.steve.org.uk/
|
||||
|
||||
$Id: xt-create-xen-config,v 1.16 2006-08-19 08:19:27 steve Exp $
|
||||
$Id: xt-create-xen-config,v 1.17 2006-08-20 01:19:56 steve Exp $
|
||||
|
||||
=cut
|
||||
|
||||
@ -189,13 +189,13 @@ sub parseCommandLineArguments
|
||||
# Parse options.
|
||||
#
|
||||
GetOptions(
|
||||
"output=s", \$CONFIG{'output'},
|
||||
"template=s", \$CONFIG{'template'},
|
||||
"verbose", \$CONFIG{'verbose'},
|
||||
"help", \$HELP,
|
||||
"manual", \$MANUAL,
|
||||
"version", \$VERSION
|
||||
);
|
||||
"output=s", \$CONFIG{'output'},
|
||||
"template=s", \$CONFIG{'template'},
|
||||
"verbose", \$CONFIG{'verbose'},
|
||||
"help", \$HELP,
|
||||
"manual", \$MANUAL,
|
||||
"version", \$VERSION
|
||||
);
|
||||
|
||||
pod2usage(1) if $HELP;
|
||||
pod2usage(-verbose => 2 ) if $MANUAL;
|
||||
@ -203,8 +203,7 @@ sub parseCommandLineArguments
|
||||
|
||||
if ( $VERSION )
|
||||
{
|
||||
my $REVISION = '$Revision: 1.16 $';
|
||||
|
||||
my $REVISION = '$Revision: 1.17 $';
|
||||
if ( $REVISION =~ /1.([0-9.]+) / )
|
||||
{
|
||||
$REVISION = $1;
|
||||
@ -212,7 +211,6 @@ sub parseCommandLineArguments
|
||||
|
||||
print "xt-create-xen-config release $RELEASE - CVS: $REVISION\n";
|
||||
exit;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -233,8 +231,8 @@ sub checkArguments
|
||||
#
|
||||
if ( ! defined( $CONFIG{'output'} ) )
|
||||
{
|
||||
print "The '--output' argument is mandatory\n";
|
||||
exit 1;
|
||||
print "The '--output' argument is mandatory\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
#
|
||||
@ -298,7 +296,7 @@ sub createXenConfig
|
||||
my $device = 'sda';
|
||||
if ( defined( $ENV{'ide'} ) )
|
||||
{
|
||||
$device = 'hda';
|
||||
$device = 'hda';
|
||||
}
|
||||
$ENV{'device'} = $device;
|
||||
|
||||
@ -308,7 +306,7 @@ sub createXenConfig
|
||||
#
|
||||
if ( $ENV{'memory'} =~ /([0-9]+)/ )
|
||||
{
|
||||
$ENV{'memory'} = $1;
|
||||
$ENV{'memory'} = $1;
|
||||
}
|
||||
|
||||
|
||||
@ -320,13 +318,13 @@ sub createXenConfig
|
||||
|
||||
if ( $ENV{'lvm'} )
|
||||
{
|
||||
$image_vbd = "phy:$ENV{'lvm'}/$ENV{'hostname'}-disk";
|
||||
$swap_vbd = "phy:$ENV{'lvm'}/$ENV{'hostname'}-swap";
|
||||
$image_vbd = "phy:$ENV{'lvm'}/$ENV{'hostname'}-disk";
|
||||
$swap_vbd = "phy:$ENV{'lvm'}/$ENV{'hostname'}-swap";
|
||||
}
|
||||
else
|
||||
{
|
||||
$image_vbd = "file:$ENV{'dir'}/domains/$ENV{'hostname'}/disk.img";
|
||||
$swap_vbd = "file:$ENV{'dir'}/domains/$ENV{'hostname'}/swap.img";
|
||||
$image_vbd = "file:$ENV{'dir'}/domains/$ENV{'hostname'}/disk.img";
|
||||
$swap_vbd = "file:$ENV{'dir'}/domains/$ENV{'hostname'}/swap.img";
|
||||
}
|
||||
$ENV{'image_vbd'} = $image_vbd;
|
||||
$ENV{'swap_vbd'} = $swap_vbd;
|
||||
|
||||
@ -66,7 +66,7 @@ xt-customize-image - Customize a freshly installed copy of GNU/Linux
|
||||
--
|
||||
http://www.steve.org.uk/
|
||||
|
||||
$Id: xt-customize-image,v 1.15 2006-08-16 09:42:44 steve Exp $
|
||||
$Id: xt-customize-image,v 1.16 2006-08-20 01:19:56 steve Exp $
|
||||
|
||||
=cut
|
||||
|
||||
@ -151,12 +151,12 @@ sub parseCommandLineArguments
|
||||
# Parse options.
|
||||
#
|
||||
GetOptions(
|
||||
"location=s", \$CONFIG{'location'},
|
||||
"dist=s", \$CONFIG{'dist'},
|
||||
"verbose", \$CONFIG{'verbose'},
|
||||
"help", \$HELP,
|
||||
"manual", \$MANUAL,
|
||||
"version", \$VERSION
|
||||
"location=s", \$CONFIG{'location'},
|
||||
"dist=s", \$CONFIG{'dist'},
|
||||
"verbose", \$CONFIG{'verbose'},
|
||||
"help", \$HELP,
|
||||
"manual", \$MANUAL,
|
||||
"version", \$VERSION
|
||||
);
|
||||
|
||||
pod2usage(1) if $HELP;
|
||||
@ -165,8 +165,7 @@ sub parseCommandLineArguments
|
||||
|
||||
if ( $VERSION )
|
||||
{
|
||||
my $REVISION = '$Revision: 1.15 $';
|
||||
|
||||
my $REVISION = '$Revision: 1.16 $';
|
||||
if ( $REVISION =~ /1.([0-9.]+) / )
|
||||
{
|
||||
$REVISION = $1;
|
||||
@ -174,7 +173,6 @@ sub parseCommandLineArguments
|
||||
|
||||
print "xt-customize-image release $RELEASE - CVS: $REVISION\n";
|
||||
exit;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -195,8 +193,8 @@ sub checkArguments
|
||||
#
|
||||
if ( ! defined( $CONFIG{'location'} ) )
|
||||
{
|
||||
print "The '--location' argument is mandatory\n";
|
||||
exit 1;
|
||||
print "The '--location' argument is mandatory\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
|
||||
@ -205,9 +203,9 @@ sub checkArguments
|
||||
#
|
||||
if ( ! -d $CONFIG{'location'} )
|
||||
{
|
||||
print "The installation directory we've been given doesn't exist\n";
|
||||
print "We tried to use : $CONFIG{'location'}\n";
|
||||
exit 1;
|
||||
print "The installation directory we've been given doesn't exist\n";
|
||||
print "We tried to use : $CONFIG{'location'}\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
|
||||
@ -216,8 +214,8 @@ sub checkArguments
|
||||
#
|
||||
if ( ! defined( $CONFIG{'dist'} ) )
|
||||
{
|
||||
print "The '--dist' argument is mandatory\n";
|
||||
exit 1;
|
||||
print "The '--dist' argument is mandatory\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
|
||||
@ -232,7 +230,7 @@ sub checkArguments
|
||||
|
||||
if ( ! -d $dir )
|
||||
{
|
||||
print <<E_OR;
|
||||
print <<E_OR;
|
||||
|
||||
We're trying to configure an installation of $CONFIG{'dist'} in
|
||||
$CONFIG{'location'} - but there is no hook directory for us to use.
|
||||
@ -243,7 +241,7 @@ sub checkArguments
|
||||
|
||||
Aborting.
|
||||
E_OR
|
||||
exit 1;
|
||||
exit 1;
|
||||
}
|
||||
|
||||
}
|
||||
@ -285,7 +283,7 @@ sub runDistributionHooks
|
||||
#
|
||||
if ( $CONFIG{'verbose'} )
|
||||
{
|
||||
$ENV{'verbose'} = 1;
|
||||
$ENV{'verbose'} = 1;
|
||||
}
|
||||
|
||||
#
|
||||
@ -298,43 +296,43 @@ sub runDistributionHooks
|
||||
next if ( $file =~ /\.dpkg-(new|old)/ );
|
||||
next if ( $file =~ /~$/ );
|
||||
|
||||
#
|
||||
# Only run executable files.
|
||||
#
|
||||
if ( ( -x $file ) && ( -f $file ) )
|
||||
{
|
||||
#
|
||||
# Just display the name - no need to see the full path.
|
||||
#
|
||||
my $name = $file;
|
||||
if ( $file =~ /(.*)\/(.*)/ )
|
||||
{
|
||||
$name = $2;
|
||||
}
|
||||
#
|
||||
# Only run executable files.
|
||||
#
|
||||
if ( ( -x $file ) && ( -f $file ) )
|
||||
{
|
||||
#
|
||||
# Just display the name - no need to see the full path.
|
||||
#
|
||||
my $name = $file;
|
||||
if ( $file =~ /(.*)\/(.*)/ )
|
||||
{
|
||||
$name = $2;
|
||||
}
|
||||
|
||||
#
|
||||
# Complete path to the file.
|
||||
#
|
||||
my $cmd = $hooks . $name . " $CONFIG{'location'}";
|
||||
#
|
||||
# Complete path to the file.
|
||||
#
|
||||
my $cmd = $hooks . $name . " $CONFIG{'location'}";
|
||||
|
||||
#
|
||||
# Run the command. This has different prolog and epilog
|
||||
# depending on whether we're running verbosely or not.
|
||||
#
|
||||
if ( $CONFIG{'verbose'} )
|
||||
{
|
||||
print "Running hook $name ['$cmd']\n";
|
||||
print "--\n";
|
||||
system( $cmd );
|
||||
print "--\n";
|
||||
print "Done\n\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Running hook $name";
|
||||
system( $cmd );
|
||||
print " - done.\n";
|
||||
}
|
||||
}
|
||||
#
|
||||
# Run the command. This has different prolog and epilog
|
||||
# depending on whether we're running verbosely or not.
|
||||
#
|
||||
if ( $CONFIG{'verbose'} )
|
||||
{
|
||||
print "Running hook $name ['$cmd']\n";
|
||||
print "--\n";
|
||||
system( $cmd );
|
||||
print "--\n";
|
||||
print "Done\n\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Running hook $name\n";
|
||||
system( $cmd );
|
||||
print "hook $name: done.\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ Install the distribution specified by the B<--dist> argument using the debootstr
|
||||
--
|
||||
http://www.steve.org.uk/
|
||||
|
||||
$Id: xt-install-image,v 1.30 2006-08-18 13:16:55 steve Exp $
|
||||
$Id: xt-install-image,v 1.31 2006-08-20 01:19:56 steve Exp $
|
||||
|
||||
=cut
|
||||
|
||||
@ -170,15 +170,16 @@ else
|
||||
#
|
||||
# However errors have been known to happen ;)
|
||||
#
|
||||
# Test that we have some standard files.
|
||||
# Test that we have some standard files present.
|
||||
#
|
||||
foreach my $file ( qw( /bin/ls /bin/cp ) )
|
||||
{
|
||||
if ( ! -x $CONFIG{'location'} . $file )
|
||||
{
|
||||
print "The installation of the new system appears to have failed.\n";
|
||||
print "\n";
|
||||
print "There is no '$file' installed in the new installation directory\n"; exit 1;
|
||||
print "The installation of the new system appears to have failed.\n";
|
||||
print "\n";
|
||||
print "There is no '$file' installed in the new installation directory\n";
|
||||
exit 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -209,27 +210,27 @@ sub parseCommandLineArguments
|
||||
# Parse options.
|
||||
#
|
||||
GetOptions(
|
||||
# Mandatory
|
||||
"location=s", \$CONFIG{'location'},
|
||||
"dist=s", \$CONFIG{'dist'},
|
||||
"hostname=s", \$CONFIG{'hostname'},
|
||||
# Mandatory
|
||||
"location=s", \$CONFIG{'location'},
|
||||
"dist=s", \$CONFIG{'dist'},
|
||||
"hostname=s", \$CONFIG{'hostname'},
|
||||
|
||||
# Exclusive.
|
||||
"tar=s", \$CONFIG{'tar'},
|
||||
"copy=s", \$CONFIG{'copy'},
|
||||
"rpmstrap", \$CONFIG{'rpmstrap'},
|
||||
"debootstrap", \$CONFIG{'debootstrap'},
|
||||
# Exclusive.
|
||||
"tar=s", \$CONFIG{'tar'},
|
||||
"copy=s", \$CONFIG{'copy'},
|
||||
"rpmstrap", \$CONFIG{'rpmstrap'},
|
||||
"debootstrap", \$CONFIG{'debootstrap'},
|
||||
|
||||
# Misc
|
||||
"arch=s", \$CONFIG{'arch'},
|
||||
"cache=s", \$CONFIG{'cache'},
|
||||
"mirror=s", \$CONFIG{'mirror'},
|
||||
# Misc
|
||||
"arch=s", \$CONFIG{'arch'},
|
||||
"cache=s", \$CONFIG{'cache'},
|
||||
"mirror=s", \$CONFIG{'mirror'},
|
||||
|
||||
# Help.
|
||||
"verbose", \$CONFIG{'verbose'},
|
||||
"help", \$HELP,
|
||||
"manual", \$MANUAL,
|
||||
"version", \$VERSION
|
||||
# Help.
|
||||
"verbose", \$CONFIG{'verbose'},
|
||||
"help", \$HELP,
|
||||
"manual", \$MANUAL,
|
||||
"version", \$VERSION
|
||||
);
|
||||
|
||||
pod2usage(1) if $HELP;
|
||||
@ -238,16 +239,14 @@ sub parseCommandLineArguments
|
||||
|
||||
if ( $VERSION )
|
||||
{
|
||||
my $REVISION = '$Revision: 1.30 $';
|
||||
|
||||
if ( $REVISION =~ /1.([0-9.]+) / )
|
||||
{
|
||||
$REVISION = $1;
|
||||
}
|
||||
|
||||
print "xt-install-image release $RELEASE - CVS: $REVISION\n";
|
||||
exit;
|
||||
my $REVISION = '$Revision: 1.31 $';
|
||||
if ( $REVISION =~ /1.([0-9.]+) / )
|
||||
{
|
||||
$REVISION = $1;
|
||||
}
|
||||
|
||||
print "xt-install-image release $RELEASE - CVS: $REVISION\n";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
@ -268,8 +267,8 @@ sub checkArguments
|
||||
#
|
||||
if ( ! defined( $CONFIG{'location'} ) )
|
||||
{
|
||||
print "The '--location' argument is mandatory\n";
|
||||
exit 1;
|
||||
print "The '--location' argument is mandatory\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
|
||||
@ -278,9 +277,9 @@ sub checkArguments
|
||||
#
|
||||
if ( ! -d $CONFIG{'location'} )
|
||||
{
|
||||
print "The installation directory we've been given doesn't exist\n";
|
||||
print "We tried to use : $CONFIG{'location'}\n";
|
||||
exit 1;
|
||||
print "The installation directory we've been given doesn't exist\n";
|
||||
print "We tried to use : $CONFIG{'location'}\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
|
||||
@ -289,8 +288,8 @@ sub checkArguments
|
||||
#
|
||||
if ( ! defined( $CONFIG{'dist'} ) )
|
||||
{
|
||||
print "The '--dist' argument is mandatory\n";
|
||||
exit 1;
|
||||
print "The '--dist' argument is mandatory\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
|
||||
@ -305,7 +304,7 @@ sub checkArguments
|
||||
|
||||
if ( ! -d $dir )
|
||||
{
|
||||
print <<E_OR;
|
||||
print <<E_OR;
|
||||
|
||||
We're trying to configure an installation of $CONFIG{'dist'} in
|
||||
$CONFIG{'location'} - but there is no hook directory for us to use.
|
||||
@ -316,7 +315,7 @@ sub checkArguments
|
||||
|
||||
Aborting.
|
||||
E_OR
|
||||
exit 1;
|
||||
exit 1;
|
||||
}
|
||||
|
||||
|
||||
@ -326,10 +325,10 @@ E_OR
|
||||
my $count = 0;
|
||||
foreach my $key ( qw(copy debootstrap rpmstrap tar ) )
|
||||
{
|
||||
if ( defined( $CONFIG{$key} ) )
|
||||
{
|
||||
$count += 1;
|
||||
}
|
||||
if ( defined( $CONFIG{$key} ) )
|
||||
{
|
||||
$count += 1;
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
@ -337,7 +336,7 @@ E_OR
|
||||
#
|
||||
if ( $count == 0 )
|
||||
{
|
||||
print <<EOF;
|
||||
print <<EOF;
|
||||
You did not specify an installation method.
|
||||
|
||||
One of the following must be given. (Run "xt-install-image --manual" for details)
|
||||
@ -354,7 +353,7 @@ EOF
|
||||
}
|
||||
elsif ( $count > 1 )
|
||||
{
|
||||
print <<EOF;
|
||||
print <<EOF;
|
||||
You specify multiple installation methods.
|
||||
|
||||
Only one of the following must be given:
|
||||
@ -366,7 +365,7 @@ EOF
|
||||
|
||||
Aborting.
|
||||
EOF
|
||||
exit 1;
|
||||
exit 1;
|
||||
}
|
||||
|
||||
}
|
||||
@ -390,10 +389,10 @@ sub installDebootstrapImage
|
||||
#
|
||||
if ( $CONFIG{'cache'} eq "yes" )
|
||||
{
|
||||
print "\nCopying files from host to image.\n";
|
||||
runCommand( "mkdir -p $CONFIG{'location'}/var/cache/apt/archives" );
|
||||
copyDebFiles( "/var/cache/apt/archives", "$CONFIG{'location'}/var/cache/apt/archives" );
|
||||
print( "Done\n" );
|
||||
print "\nCopying files from host to image.\n";
|
||||
runCommand( "mkdir -p $CONFIG{'location'}/var/cache/apt/archives" );
|
||||
copyDebFiles( "/var/cache/apt/archives", "$CONFIG{'location'}/var/cache/apt/archives" );
|
||||
print( "Done\n" );
|
||||
}
|
||||
|
||||
#
|
||||
@ -422,9 +421,6 @@ sub installDebootstrapImage
|
||||
#
|
||||
# Run the command.
|
||||
#
|
||||
# NOTE: runCommand has special logic to display the debootstrap log
|
||||
# if the command files it will be displayed.
|
||||
#
|
||||
runCommand( $command );
|
||||
|
||||
|
||||
@ -434,10 +430,10 @@ sub installDebootstrapImage
|
||||
#
|
||||
if ( $CONFIG{'cache'} eq "yes" )
|
||||
{
|
||||
print "\nCopying files from new installation to host.\n";
|
||||
copyDebFiles( "$CONFIG{'location'}/var/cache/apt/archives",
|
||||
"/var/cache/apt/archives" );
|
||||
print( "Done\n" );
|
||||
print "\nCopying files from new installation to host.\n";
|
||||
copyDebFiles( "$CONFIG{'location'}/var/cache/apt/archives",
|
||||
"/var/cache/apt/archives" );
|
||||
print( "Done\n" );
|
||||
}
|
||||
|
||||
|
||||
@ -461,8 +457,8 @@ sub installRPMStrapImage
|
||||
#
|
||||
if ( ! -x '/usr/bin/rpmstrap' )
|
||||
{
|
||||
print "You've chosen to use the rpmstrap program, but it isn't installed.\n";
|
||||
exit;
|
||||
print "You've chosen to use the rpmstrap program, but it isn't installed.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
#
|
||||
@ -471,7 +467,7 @@ sub installRPMStrapImage
|
||||
my $EXTRA='';
|
||||
if ( $CONFIG{'verbose'} )
|
||||
{
|
||||
$EXTRA .= " --verbose";
|
||||
$EXTRA .= " --verbose";
|
||||
}
|
||||
|
||||
#
|
||||
@ -522,9 +518,9 @@ sub runCommand
|
||||
|
||||
if ( $? != 0 )
|
||||
{
|
||||
print "Running command '$cmd' failed.\n";
|
||||
print "Aborting\n";
|
||||
exit;
|
||||
print "Running command '$cmd' failed.\n";
|
||||
print "Aborting\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
#
|
||||
@ -559,19 +555,19 @@ sub copyDebFiles
|
||||
#
|
||||
foreach my $file ( sort ( glob( $source . "/*.deb" ) ) )
|
||||
{
|
||||
my $name = $file;
|
||||
if ( $name =~ /(.*)\/(.*)/ )
|
||||
{
|
||||
$name = $2;
|
||||
}
|
||||
my $name = $file;
|
||||
if ( $name =~ /(.*)\/(.*)/ )
|
||||
{
|
||||
$name = $2;
|
||||
}
|
||||
|
||||
#
|
||||
# Only copy if the file doesn't already exist.
|
||||
#
|
||||
if ( ! ( -e $dest . "/" . $name ) )
|
||||
{
|
||||
File::Copy::cp( $file, $dest );
|
||||
}
|
||||
#
|
||||
# Only copy if the file doesn't already exist.
|
||||
#
|
||||
if ( ! ( -e $dest . "/" . $name ) )
|
||||
{
|
||||
File::Copy::cp( $file, $dest );
|
||||
}
|
||||
}
|
||||
|
||||
print "Done\n";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user