From f3cd70dcf74983c03776c5166e622afceec1f7a8 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Sat, 3 Mar 2007 21:06:43 +0000 Subject: * added support for cloning existing systems, seems to work, but only for the systems that are generally supported by slxos-setup (suse-10.1, suse-10.2, fedora-6). git-svn-id: http://svn.openslx.org/svn/openslx/trunk@745 95ad53e4-c205-0410-b2fa-d234c58c8868 --- installer/slxos-setup | 43 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) (limited to 'installer/slxos-setup') diff --git a/installer/slxos-setup b/installer/slxos-setup index 6e829894..1d67d5ae 100755 --- a/installer/slxos-setup +++ b/installer/slxos-setup @@ -37,17 +37,18 @@ my ( $helpReq, $manReq, $listReq, + $selection, + $source, $verbose, $versionReq, ); -my $selection = 'default'; - GetOptions( 'help|?' => \$helpReq, 'list' => \$listReq, 'man' => \$manReq, 'selection=s' => \$selection, + 'source=s' => \$source, 'verbose' => \$verbose, 'version' => \$versionReq, ) or pod2usage(2); @@ -72,11 +73,30 @@ if (scalar(@ARGV) != 2) { } my $action = $ARGV[0]; my $distroName = $ARGV[1]; -if ($action !~ m[^import-into-db|install|update$]i) { - print STDERR _tr("You need to specify exactly one action:\n\tinstall, update or import-into-db\n"); +if ($action !~ m[^clone|import-into-db|install|update$]i) { + print STDERR _tr("You need to specify exactly one action:\n\tinstall, update, clone or import-into-db\n"); pod2usage(2); } +if ($action =~ m[clone]i) { + if (!length($source)) { + die _tr("You need to specifiy a source you'd like to clone!\n"); + } + if ($source !~ m[^.+::?.+$]) { + die _tr("Unkown source format given, expected ':' or '::'!\n"); + } + if (!defined $selection) { + $selection = "cloned-from-$source"; + $selection =~ tr[:/][_]; + # mask : and / + $selection =~ s[_+$][]; + # remove any trailing underscores, as they're ugly + } +} else { + $selection = 'default' unless defined $selection; +} + + # we chdir into the script's folder such that all relative paths have # a known starting point: chdir($FindBin::RealBin) @@ -97,6 +117,9 @@ if ($action =~ m[import]i) { } elsif ($action =~ m[install]i) { $engine->initialize($distroName, $selection, 1); $engine->installVendorOS(); +} elsif ($action =~ m[clone]i) { + $engine->initialize($distroName, $selection, 0, 1); + $engine->cloneVendorOS($source); } __END__ @@ -114,9 +137,11 @@ slxos-setup [options] --help brief help message --man show full documentation --selection= specific selection for vendor-OS + --source= (rsync-)source to clone vendor-OS from --version show version Actions: + clone clones an existing system via rsync import-into-db imports a vendor-OS into the openslx-db install installs a vendor-OS into a folder update updates an installed vendor-OS @@ -142,6 +167,16 @@ would like to use. If you pass an unknown selection, you will see a list of the selections that are available. +In clone-mode, the selection specifies the name by which the cloned system +will be known (exact name will be '-' instead of +'-cloned-from-'). + +=item B<--source=> + +When cloning a vendor-OS, slxos-setup needs to know where to fetch +the existing OS-files from. You can specify the rsync-uri with this +option. + =item B<--version> Prints the version and exits. -- cgit v1.2.3-55-g7522