Compare commits
2 Commits
febootstra
...
proper-del
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a81f9ddb5 | ||
|
|
e1a620237a |
14
Makefile
14
Makefile
@@ -150,13 +150,13 @@ install-hooks:
|
|||||||
cp -R hooks/fedora-core-6/*-* ${prefix}/usr/lib/xen-tools/fedora-core-6.d
|
cp -R hooks/fedora-core-6/*-* ${prefix}/usr/lib/xen-tools/fedora-core-6.d
|
||||||
-cd ${prefix}/usr/lib/xen-tools/ && ln -s fedora-core-6.d fedora-core-4.d
|
-cd ${prefix}/usr/lib/xen-tools/ && ln -s fedora-core-6.d fedora-core-4.d
|
||||||
-cd ${prefix}/usr/lib/xen-tools/ && ln -s fedora-core-6.d fedora-core-5.d
|
-cd ${prefix}/usr/lib/xen-tools/ && ln -s fedora-core-6.d fedora-core-5.d
|
||||||
-cd ${prefix}/usr/lib/xen-tools/ && ln -s fedora-core-6.d fedora-7.d
|
-cd ${prefix}/usr/lib/xen-tools/ && ln -s fedora-core-6.d fedora-core-7.d
|
||||||
-cd ${prefix}/usr/lib/xen-tools/ && ln -s fedora-core-6.d fedora-8.d
|
-cd ${prefix}/usr/lib/xen-tools/ && ln -s fedora-core-6.d fedora-core-8.d
|
||||||
-cd ${prefix}/usr/lib/xen-tools/ && ln -s fedora-core-6.d fedora-9.d
|
-cd ${prefix}/usr/lib/xen-tools/ && ln -s fedora-core-6.d fedora-core-9.d
|
||||||
-cd ${prefix}/usr/lib/xen-tools/ && ln -s fedora-core-6.d fedora-10.d
|
-cd ${prefix}/usr/lib/xen-tools/ && ln -s fedora-core-6.d fedora-core-10.d
|
||||||
-cd ${prefix}/usr/lib/xen-tools/ && ln -s fedora-core-6.d fedora-11.d
|
-cd ${prefix}/usr/lib/xen-tools/ && ln -s fedora-core-6.d fedora-core-11.d
|
||||||
-cd ${prefix}/usr/lib/xen-tools/ && ln -s fedora-core-6.d fedora-12.d
|
-cd ${prefix}/usr/lib/xen-tools/ && ln -s fedora-core-6.d fedora-core-12.d
|
||||||
-cd ${prefix}/usr/lib/xen-tools/ && ln -s fedora-core-6.d fedora-13.d
|
-cd ${prefix}/usr/lib/xen-tools/ && ln -s fedora-core-6.d fedora-core-13.d
|
||||||
mkdir -p ${prefix}/usr/lib/xen-tools/debian.d/
|
mkdir -p ${prefix}/usr/lib/xen-tools/debian.d/
|
||||||
cp -R hooks/debian/*-* ${prefix}/usr/lib/xen-tools/debian.d
|
cp -R hooks/debian/*-* ${prefix}/usr/lib/xen-tools/debian.d
|
||||||
-cd ${prefix}/usr/lib/xen-tools/ && ln -s debian.d sarge.d
|
-cd ${prefix}/usr/lib/xen-tools/ && ln -s debian.d sarge.d
|
||||||
|
|||||||
4
TODO
4
TODO
@@ -153,10 +153,6 @@ Maybe for a 4.3 or 5.0 release
|
|||||||
"type" of configuration you want, and a set of options specific to
|
"type" of configuration you want, and a set of options specific to
|
||||||
that flag could be parsed from xen-tools.conf
|
that flag could be parsed from xen-tools.conf
|
||||||
|
|
||||||
* Do not run copyDebFiles on RPM based installations.
|
|
||||||
|
|
||||||
Write a proper clone of it for caching RPMs.
|
|
||||||
|
|
||||||
Stuff from Steve's TODO list / Generic TODOs
|
Stuff from Steve's TODO list / Generic TODOs
|
||||||
--------------------------------------------
|
--------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ xen-create-image - Easily create new Xen instances with networking and OpenSSH.
|
|||||||
Installation options:
|
Installation options:
|
||||||
|
|
||||||
--arch=arch Pass the given architecture to debootstrap, rinse,
|
--arch=arch Pass the given architecture to debootstrap, rinse,
|
||||||
or febootstrap when installing the system. This argument
|
or rpmstrap when installing the system. This argument
|
||||||
is ignored for other install methods.
|
is ignored for other install methods.
|
||||||
|
|
||||||
--dist=dist Specify the distribution you wish to install.
|
--dist=dist Specify the distribution you wish to install.
|
||||||
@@ -347,7 +347,7 @@ Create a Xen configuration file in so that xm can start the new domain.
|
|||||||
|
|
||||||
#
|
#
|
||||||
# Installation method:
|
# Installation method:
|
||||||
# One of "copy", "debootstrap", "rinse", "febootstrap", or "tar".
|
# One of "copy", "debootstrap", "rinse", "rpmstrap", or "tar".
|
||||||
#
|
#
|
||||||
install-method = debootstrap
|
install-method = debootstrap
|
||||||
|
|
||||||
@@ -523,7 +523,7 @@ Create a Xen configuration file in so that xm can start the new domain.
|
|||||||
The new guest images may be installed in several different ways:
|
The new guest images may be installed in several different ways:
|
||||||
|
|
||||||
1. Using the debootstrap command, which must be installed and present.
|
1. Using the debootstrap command, which must be installed and present.
|
||||||
2. Using the febootstrap command, which must be installed and present.
|
2. Using the rpmstrap command, which must be installed and present.
|
||||||
3. using the rinse command, which must be installed and present.
|
3. using the rinse command, which must be installed and present.
|
||||||
4. By copying an existing installation.
|
4. By copying an existing installation.
|
||||||
5. By untarring a file containing a previous installation.
|
5. By untarring a file containing a previous installation.
|
||||||
@@ -758,25 +758,6 @@ my $RELEASE = '4.2rc1';
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Release Aliases
|
|
||||||
#
|
|
||||||
my %RELEASE_ALIASES = (qw(
|
|
||||||
stentz fedora-core-4
|
|
||||||
bordeaux fedora-core-5
|
|
||||||
zod fedora-core-6
|
|
||||||
moonshine fedora-7
|
|
||||||
werewolf fedora-8
|
|
||||||
sulphur fedora-9
|
|
||||||
cambridge fedora-10
|
|
||||||
leonidas fedora-11
|
|
||||||
constantine fedora-12
|
|
||||||
goddard fedora-13
|
|
||||||
laughlin fedora-14
|
|
||||||
));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Setup default options.
|
# Setup default options.
|
||||||
#
|
#
|
||||||
@@ -1706,10 +1687,11 @@ sub checkArguments
|
|||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Check for release alias names
|
# NOTE: FAKE!
|
||||||
#
|
#
|
||||||
if (exists $RELEASE_ALIASES{$CONFIG{ 'dist' }}) {
|
if ( $CONFIG{ 'dist' } eq 'fedora-core4' )
|
||||||
$CONFIG{ 'dist' } = $RELEASE_ALIASES{$CONFIG{ 'dist' }};
|
{
|
||||||
|
$CONFIG{ 'dist' } = 'stentz';
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -1770,7 +1752,7 @@ E_OR
|
|||||||
if ( defined( $CONFIG{ 'install-method' } ) )
|
if ( defined( $CONFIG{ 'install-method' } ) )
|
||||||
{
|
{
|
||||||
foreach my $recognised (
|
foreach my $recognised (
|
||||||
qw/ copy debootstrap rinse febootstrap tar /)
|
qw/ copy debootstrap rinse rpmstrap tar /)
|
||||||
{
|
{
|
||||||
$valid = 1
|
$valid = 1
|
||||||
if ( lc( $CONFIG{ 'install-method' } ) eq lc($recognised) );
|
if ( lc( $CONFIG{ 'install-method' } ) eq lc($recognised) );
|
||||||
@@ -1803,7 +1785,7 @@ E_OR
|
|||||||
--install-method=copy --install-source=/some/path
|
--install-method=copy --install-source=/some/path
|
||||||
--install-method=debootstrap
|
--install-method=debootstrap
|
||||||
--install-method=rinse
|
--install-method=rinse
|
||||||
--install-method=febootstrap
|
--install-method=rpmstrap
|
||||||
--install-method=tar --install-source=/some/file.tar
|
--install-method=tar --install-source=/some/file.tar
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|||||||
@@ -172,7 +172,6 @@ my %CONFIG;
|
|||||||
my $RELEASE = '4.2rc1';
|
my $RELEASE = '4.2rc1';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Read the global configuration file if it exists.
|
# Read the global configuration file if it exists.
|
||||||
#
|
#
|
||||||
@@ -220,7 +219,21 @@ while ( my $name = shift )
|
|||||||
{
|
{
|
||||||
if ( !xenRunning($name) )
|
if ( !xenRunning($name) )
|
||||||
{
|
{
|
||||||
deleteXenImage($name);
|
#
|
||||||
|
# Partition layout information values read from the
|
||||||
|
# partitions file, or constructed automatically if no
|
||||||
|
# partitions file is specified.
|
||||||
|
#
|
||||||
|
|
||||||
|
my @PARTITIONS = undef;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Check for partitions to delete by reading the DomU's
|
||||||
|
# configuration file
|
||||||
|
#
|
||||||
|
my @PARTITIONS = findPartitions($host
|
||||||
|
|
||||||
|
deleteXenImage($name, @PARTITIONS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -449,6 +462,70 @@ sub xenRunning
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
=begin doc
|
||||||
|
|
||||||
|
Read the (usually to be deleted) DomU configuration file specified
|
||||||
|
and returns the list of used partitions found in the file.
|
||||||
|
|
||||||
|
=end doc
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub findPartitions
|
||||||
|
{
|
||||||
|
my ($hostname) = (@_);
|
||||||
|
my $file = "/etc/xen/$hostname.cfg";
|
||||||
|
|
||||||
|
if ( -e $file )
|
||||||
|
{
|
||||||
|
open( FILE, "<", $file ) or die "Cannot read file '$file' - $!";
|
||||||
|
|
||||||
|
my $line = "";
|
||||||
|
my $contents = "";
|
||||||
|
|
||||||
|
while ( defined( $line = <FILE> ) )
|
||||||
|
{
|
||||||
|
chomp $line;
|
||||||
|
if ( $line =~ s/\\$// )
|
||||||
|
{
|
||||||
|
$line .= <FILE>;
|
||||||
|
redo unless eof(FILE);
|
||||||
|
}
|
||||||
|
|
||||||
|
# Skip lines beginning with comments
|
||||||
|
next if ( $line =~ /^([ \t]*)\#/ );
|
||||||
|
|
||||||
|
# Skip blank lines
|
||||||
|
next if ( length($line) < 1 );
|
||||||
|
|
||||||
|
# Strip trailing comments.
|
||||||
|
if ( $line =~ /(.*)\#(.*)/ )
|
||||||
|
{
|
||||||
|
$line = $1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$contents .= $line;
|
||||||
|
}
|
||||||
|
|
||||||
|
close(FILE);
|
||||||
|
|
||||||
|
if ($contents =~ /\ndisk\s*=\s*\[\s*(.*?)\s*\]\s*\n/) {
|
||||||
|
my $disks = $1;
|
||||||
|
my @disks = split(/\n/, $disks);
|
||||||
|
foreach (@disks) {
|
||||||
|
s/^\s*'phy:(.*),\w*,\w*',\s*$/$1/;
|
||||||
|
}
|
||||||
|
return @disks;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
warn "Couldn't find $file. May start guessing based on further parameters.\n";
|
||||||
|
return qw(GUESSING);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
=begin doc
|
=begin doc
|
||||||
|
|
||||||
Delete the named image, and the corresponding configuration file
|
Delete the named image, and the corresponding configuration file
|
||||||
@@ -460,7 +537,11 @@ sub xenRunning
|
|||||||
|
|
||||||
sub deleteXenImage
|
sub deleteXenImage
|
||||||
{
|
{
|
||||||
my ($hostname) = (@_);
|
my $hostname = shift;
|
||||||
|
my @partitions = @_;
|
||||||
|
my $guessing = ($#partitions == 0 and $partitions[0] eq 'GUESSING');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Collect the names of files to delete.
|
# Collect the names of files to delete.
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ xt-install-image - Install a fresh copy of GNU/Linux into a directory
|
|||||||
--dist The name of the distribution which has been installed.
|
--dist The name of the distribution which has been installed.
|
||||||
|
|
||||||
Misc Options:
|
Misc Options:
|
||||||
--arch Pass the given arch setting to debootstrap or febootstrap.
|
--arch Pass the given arch setting to debootstrap or rpmstrap.
|
||||||
--config Read the specified config file in addition to the global
|
--config Read the specified config file in addition to the global
|
||||||
configuration file.
|
configuration file.
|
||||||
--mirror The mirror to use when installing with 'debootstrap'.
|
--mirror The mirror to use when installing with 'debootstrap'.
|
||||||
@@ -69,8 +69,8 @@ Copy the given directory recursively. This local directory is assumed to contai
|
|||||||
=item B<rinse>
|
=item B<rinse>
|
||||||
Install the distribution specified by B<--dist> using the rinse command.
|
Install the distribution specified by B<--dist> using the rinse command.
|
||||||
|
|
||||||
=item B<febootstrap>
|
=item B<rpmstrap>
|
||||||
Install the distribution specified by B<--dist> using the febootstrap command.
|
Install the distribution specified by B<--dist> using the rpmstrap command.
|
||||||
|
|
||||||
=item B<tar>
|
=item B<tar>
|
||||||
Untar a .tar file into the new installation location. This tarfile is assumed to contain a complete archived system. Specify the directory to copy with the B<--install-source> argument.
|
Untar a .tar file into the new installation location. This tarfile is assumed to contain a complete archived system. Specify the directory to copy with the B<--install-source> argument.
|
||||||
@@ -141,8 +141,8 @@ my %dispatch = (
|
|||||||
"rinse" => { sub => \&do_rinse,
|
"rinse" => { sub => \&do_rinse,
|
||||||
needBinary => "/usr/sbin/rinse",
|
needBinary => "/usr/sbin/rinse",
|
||||||
},
|
},
|
||||||
"febootstrap" => { sub => \&do_febootstrap,
|
"rpmstrap" => { sub => \&do_rpmstrap,
|
||||||
needBinary => "/usr/bin/febootstrap",
|
needBinary => "/usr/bin/rpmstrap",
|
||||||
},
|
},
|
||||||
"tar" => { sub => \&do_tar,
|
"tar" => { sub => \&do_tar,
|
||||||
needBinary => "/bin/tar",
|
needBinary => "/bin/tar",
|
||||||
@@ -532,7 +532,7 @@ E_OR
|
|||||||
|
|
||||||
--install-method=copy --install-source=/some/path
|
--install-method=copy --install-source=/some/path
|
||||||
--install-method=debootstrap
|
--install-method=debootstrap
|
||||||
--install-method=febootstrap
|
--install-method=rpmstrap
|
||||||
--install-method=tar --install-source=/some/file.tar
|
--install-method=tar --install-source=/some/file.tar
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
@@ -717,13 +717,29 @@ sub do_debootstrap
|
|||||||
print("Done\n");
|
print("Done\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Propogate --verbose appropriately.
|
||||||
|
#
|
||||||
|
my $EXTRA = '';
|
||||||
|
if ( $CONFIG{ 'verbose' } )
|
||||||
|
{
|
||||||
|
$EXTRA = ' --verbose';
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Propogate the --arch argument
|
||||||
|
#
|
||||||
|
if ( $CONFIG{ 'arch' } )
|
||||||
|
{
|
||||||
|
$EXTRA .= " --arch $CONFIG{'arch'}";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# This is the command we'll run
|
# This is the command we'll run
|
||||||
#
|
#
|
||||||
my $dist = $CONFIG{'dist'};
|
my $command =
|
||||||
$dist =~ s/fedora-core/fedora/;
|
"$cmd $EXTRA $CONFIG{'dist'} $CONFIG{'location'} $CONFIG{'mirror'}";
|
||||||
|
|
||||||
my $command = "$cmd $dist $CONFIG{'location'}";
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Run the command.
|
# Run the command.
|
||||||
@@ -789,13 +805,13 @@ sub do_rinse
|
|||||||
|
|
||||||
=begin doc
|
=begin doc
|
||||||
|
|
||||||
Install a new distribution of GNU/Linux using the febootstrap tool.
|
Install a new distribution of GNU/Linux using the rpmstrap tool.
|
||||||
|
|
||||||
=end doc
|
=end doc
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
sub do_febootstrap
|
sub do_rpmstrap
|
||||||
{
|
{
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -824,7 +840,7 @@ sub do_febootstrap
|
|||||||
#
|
#
|
||||||
# The command we're going to run.
|
# The command we're going to run.
|
||||||
#
|
#
|
||||||
my $command = "febootstrap $EXTRA $CONFIG{'dist'} $CONFIG{'location'} $mirror";
|
my $command = "rpmstrap $EXTRA $CONFIG{'dist'} $CONFIG{'location'} $mirror";
|
||||||
runCommand($command);
|
runCommand($command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ _xen_create_image()
|
|||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
--install-method)
|
--install-method)
|
||||||
COMPREPLY=( $( compgen -W 'copy debootstrap rinse febootstrap tar' -- "${COMP_WORDS[COMP_CWORD]}" ) )
|
COMPREPLY=( $( compgen -W 'copy debootstrap rinse rpmstrap tar' -- "${COMP_WORDS[COMP_CWORD]}" ) )
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
--ip)
|
--ip)
|
||||||
@@ -360,7 +360,7 @@ complete -F _xt-create-xen-config xt-create-xen-config
|
|||||||
#
|
#
|
||||||
_xt-customize-image()
|
_xt-customize-image()
|
||||||
{
|
{
|
||||||
local cur prev
|
local cur prev dists
|
||||||
|
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
cur=${COMP_WORDS[COMP_CWORD]}
|
cur=${COMP_WORDS[COMP_CWORD]}
|
||||||
@@ -369,9 +369,16 @@ _xt-customize-image()
|
|||||||
# Determine arguments dynamically. Avoids out-of-dateness.
|
# Determine arguments dynamically. Avoids out-of-dateness.
|
||||||
opts=$(xt-customize-image --help|grep -- --|awk '{print $1}'|grep -- -- | sort -u)
|
opts=$(xt-customize-image --help|grep -- --|awk '{print $1}'|grep -- -- | sort -u)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Available distributions, from rpmstrap
|
||||||
|
#
|
||||||
|
if [ -d /usr/lib/rpmstrap/scripts ]; then
|
||||||
|
dists=`/bin/ls -1 /usr/lib/rpmstrap/scripts`
|
||||||
|
fi
|
||||||
|
|
||||||
case "$prev" in
|
case "$prev" in
|
||||||
--dist)
|
--dist)
|
||||||
COMPREPLY=( $( compgen -W 'sid sarge etch lenny' -- "${COMP_WORDS[COMP_CWORD]}" ) )
|
COMPREPLY=( $( compgen -W '${dists} sid sarge etch lenny' -- "${COMP_WORDS[COMP_CWORD]}" ) )
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
--location)
|
--location)
|
||||||
@@ -394,7 +401,7 @@ complete -F _xt-customize-image xt-customize-image
|
|||||||
#
|
#
|
||||||
_xt-install-image()
|
_xt-install-image()
|
||||||
{
|
{
|
||||||
local cur prev
|
local cur prev dists
|
||||||
|
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
cur=${COMP_WORDS[COMP_CWORD]}
|
cur=${COMP_WORDS[COMP_CWORD]}
|
||||||
@@ -404,6 +411,14 @@ _xt-install-image()
|
|||||||
opts=$(xt-install-image --help|grep -- --|awk '{print $1}'|grep -- -- | sort -u)
|
opts=$(xt-install-image --help|grep -- --|awk '{print $1}'|grep -- -- | sort -u)
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Available distributions, from rpmstrap
|
||||||
|
#
|
||||||
|
if [ -d /usr/lib/rpmstrap/scripts ]; then
|
||||||
|
dists=`/bin/ls -1 /usr/lib/rpmstrap/scripts`
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
case "$prev" in
|
case "$prev" in
|
||||||
--cache)
|
--cache)
|
||||||
COMPREPLY=( $( compgen -W 'yes no' -- "${COMP_WORDS[COMP_CWORD]}" ) )
|
COMPREPLY=( $( compgen -W 'yes no' -- "${COMP_WORDS[COMP_CWORD]}" ) )
|
||||||
@@ -414,11 +429,11 @@ _xt-install-image()
|
|||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
--dist)
|
--dist)
|
||||||
COMPREPLY=( $( compgen -W 'sid sarge etch lenny' -- "${COMP_WORDS[COMP_CWORD]}" ) )
|
COMPREPLY=( $( compgen -W '${dists} sid sarge etch lenny' -- "${COMP_WORDS[COMP_CWORD]}" ) )
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
--install-method)
|
--install-method)
|
||||||
COMPREPLY=( $( compgen -W 'copy debootstrap rinse febootstrap tar' -- "${COMP_WORDS[COMP_CWORD]}" ) )
|
COMPREPLY=( $( compgen -W 'copy debootstrap rinse rpmstrap tar' -- "${COMP_WORDS[COMP_CWORD]}" ) )
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
--location)
|
--location)
|
||||||
|
|||||||
Reference in New Issue
Block a user