From 57865ed527ac0a8ed7538a1354c24cb19e735ca9 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Sat, 17 Mar 2007 15:16:33 +0000 Subject: * added support for continuing failed installation attempts, downloads are now being continued in order to speed things up a bit. git-svn-id: http://svn.openslx.org/svn/openslx/trunk@783 95ad53e4-c205-0410-b2fa-d234c58c8868 --- installer/OpenSLX/OSSetup/Distro/Fedora_6.pm | 4 +- installer/OpenSLX/OSSetup/Distro/SUSE_10_1.pm | 4 +- installer/OpenSLX/OSSetup/Distro/SUSE_10_2.pm | 4 +- .../OpenSLX/OSSetup/Distro/SUSE_10_2_x86_64.pm | 4 +- installer/OpenSLX/OSSetup/Engine.pm | 57 ++++++++++++---------- installer/slxos-setup | 8 +-- 6 files changed, 42 insertions(+), 39 deletions(-) (limited to 'installer') diff --git a/installer/OpenSLX/OSSetup/Distro/Fedora_6.pm b/installer/OpenSLX/OSSetup/Distro/Fedora_6.pm index 2113ea99..15a88554 100644 --- a/installer/OpenSLX/OSSetup/Distro/Fedora_6.pm +++ b/installer/OpenSLX/OSSetup/Distro/Fedora_6.pm @@ -48,7 +48,7 @@ sub initDistroInfo $self->{config}->{'repository'} = { 'base' => { 'urls' => " - http://ftp5.gwdg.de/pub/linux/fedora/linux/core/6/i386/os + ftp://ftp5.gwdg.de/pub/linux/fedora/linux/core/6/i386/os http://mirror.linux.duke.edu/pub/fedora/linux/core/6/i386/os ftp://www.las.ic.unicamp.br/pub/fedora/linux/core/6/i386/os ftp://sunsite.mff.cuni.cz/pub/fedora/linux/core/6/i386/os @@ -59,7 +59,7 @@ sub initDistroInfo }, 'base_update' => { 'urls' => ' - http://ftp-1.gwdg.de/pub/linux/fedora/linux/core/updates/$releasever/$basearch/ + ftp://ftp5.gwdg.de/pub/linux/fedora/linux/core/updates/$releasever/$basearch/ ', 'name' => 'Fedora Core 6 updates', 'repo-subdir' => '', diff --git a/installer/OpenSLX/OSSetup/Distro/SUSE_10_1.pm b/installer/OpenSLX/OSSetup/Distro/SUSE_10_1.pm index 9bb50ee1..13510c64 100644 --- a/installer/OpenSLX/OSSetup/Distro/SUSE_10_1.pm +++ b/installer/OpenSLX/OSSetup/Distro/SUSE_10_1.pm @@ -55,7 +55,7 @@ sub initDistroInfo $self->{config}->{'repository'} = { 'base' => { 'urls' => " - http://ftp.gwdg.de/pub/opensuse/distribution/SL-10.1/inst-source + ftp://ftp.gwdg.de/pub/opensuse/distribution/SL-10.1/inst-source ftp://suse.inode.at/opensuse/distribution/SL-10.1/inst-source http://mirrors.uol.com.br/pub/suse/distribution/SL-10.1/inst-source ftp://klid.dk/opensuse/distribution/SL-10.1/inst-source @@ -67,7 +67,7 @@ sub initDistroInfo }, 'base_update' => { 'urls' => " - http://ftp.gwdg.de/pub/suse/update/10.1 + ftp://ftp.gwdg.de/pub/suse/update/10.1 ", 'name' => 'SUSE Linux 10.1 updates', 'repo-subdir' => '', diff --git a/installer/OpenSLX/OSSetup/Distro/SUSE_10_2.pm b/installer/OpenSLX/OSSetup/Distro/SUSE_10_2.pm index 8a482b58..b1515767 100644 --- a/installer/OpenSLX/OSSetup/Distro/SUSE_10_2.pm +++ b/installer/OpenSLX/OSSetup/Distro/SUSE_10_2.pm @@ -55,7 +55,7 @@ sub initDistroInfo $self->{config}->{'repository'} = { 'base' => { 'urls' => " - http://ftp.gwdg.de/pub/opensuse/distribution/10.2/repo/oss + ftp://ftp.gwdg.de/pub/opensuse/distribution/10.2/repo/oss ftp://suse.inode.at/opensuse/distribution/10.2/repo/oss http://mirrors.uol.com.br/pub/suse/distribution/10.2/repo/oss ftp://klid.dk/opensuse/distribution/10.2/repo/oss @@ -67,7 +67,7 @@ sub initDistroInfo }, 'base_update' => { 'urls' => " - http://ftp.gwdg.de/pub/suse/update/10.2 + ftp://ftp.gwdg.de/pub/suse/update/10.2 ", 'name' => 'openSUSE 10.2 updates', 'repo-subdir' => '', diff --git a/installer/OpenSLX/OSSetup/Distro/SUSE_10_2_x86_64.pm b/installer/OpenSLX/OSSetup/Distro/SUSE_10_2_x86_64.pm index b408cb17..4fea1a1f 100644 --- a/installer/OpenSLX/OSSetup/Distro/SUSE_10_2_x86_64.pm +++ b/installer/OpenSLX/OSSetup/Distro/SUSE_10_2_x86_64.pm @@ -55,7 +55,7 @@ sub initDistroInfo $self->{config}->{'repository'} = { 'base' => { 'urls' => " - http://ftp.gwdg.de/pub/opensuse/distribution/10.2/repo/oss + ftp://ftp.gwdg.de/pub/opensuse/distribution/10.2/repo/oss ftp://suse.inode.at/opensuse/distribution/10.2/repo/oss http://mirrors.uol.com.br/pub/suse/distribution/10.2/repo/oss ftp://klid.dk/opensuse/distribution/10.2/repo/oss @@ -67,7 +67,7 @@ sub initDistroInfo }, 'base_update' => { 'urls' => " - http://ftp.gwdg.de/pub/suse/update/10.2 + ftp://ftp.gwdg.de/pub/suse/update/10.2 ", 'name' => 'openSUSE 10.2 updates', 'repo-subdir' => '', diff --git a/installer/OpenSLX/OSSetup/Engine.pm b/installer/OpenSLX/OSSetup/Engine.pm index beef84a7..035ae503 100644 --- a/installer/OpenSLX/OSSetup/Engine.pm +++ b/installer/OpenSLX/OSSetup/Engine.pm @@ -76,7 +76,6 @@ sub initialize { my $self = shift; my $vendorOSName = shift; - my $protectVendorOSPath = shift; my $actionType = shift; if ($vendorOSName !~ m[^([^\-]+\-[^\-]+)(?:\-(.+))?]) { @@ -141,9 +140,6 @@ sub initialize $self->{'vendor-os-path'} = "$openslxConfig{'stage1-path'}/$self->{'vendor-os-name'}"; vlog 1, "vendor-OS will be installed to '$self-vendor-os-path'}'"; - if ($protectVendorOSPath && -e $self->{'vendor-os-path'}) { - die _tr("vendor-OS '%s' already exists, giving up!\n", $self->{'vendor-os-path'}); - } $self->createPackager(); $self->createMetaPackager(); @@ -154,26 +150,24 @@ sub installVendorOS { my $self = shift; + my $installInfoFile = "$self->{'vendor-os-path'}/.openslx-install-info"; + if (-e $installInfoFile) { + die _tr("vendor-OS '%s' already exists, giving up!\n", $self->{'vendor-os-path'}); + } $self->createVendorOSPath(); $self->setupStage1A(); - my $pid = fork(); - if (!$pid) { - # child, execute the tasks that involve a chrooted environment: + executeInSubprocess( sub { + # some tasks that involve a chrooted environment: $self->setupStage1B(); $self->setupStage1C(); - exit 0; - } - - # parent, wait for child to do its work inside the chroot - waitpid($pid, 0); - if ($?) { - exit $?; - } + }); $self->stage1C_cleanupBasicVendorOS(); - $self->setupStage1D(); - my $installInfoFile = "$self->{'vendor-os-path'}/.openslx-install-info"; - system("touch $installInfoFile"); + executeInSubprocess( sub { + # another task that involves a chrooted environment: + $self->setupStage1D(); + }); + slxsystem("touch $installInfoFile"); # just touch the file, in order to indicate a proper installation vlog 0, _tr("Vendor-OS <%s> installed succesfully.\n", $self->{'vendor-os-name'}); @@ -365,7 +359,7 @@ sub createVendorOSPath { my $self = shift; - if (system("mkdir -p $self->{'vendor-os-path'}")) { + if (slxsystem("mkdir -p $self->{'vendor-os-path'}")) { die _tr("unable to create directory '%s', giving up! (%s)\n", $self->{'vendor-os-path'}, $!); } @@ -445,7 +439,7 @@ sub setupStage1A # we create *all* of the above folders by creating stage1cDir: my $stage1cDir = "$self->{'stage1aDir'}/$self->{'stage1bSubdir'}/$self->{'stage1cSubdir'}"; - if (system("mkdir -p $stage1cDir")) { + if (slxsystem("mkdir -p $stage1cDir")) { die _tr("unable to create directory '%s', giving up! (%s)\n", $stage1cDir, $!); } @@ -511,7 +505,7 @@ sub stage1A_copyPrerequiredFiles tar --exclude=.svn -cp -C $self->{'distro-info-dir'}/prereqfiles . \\ | tar -xp -C $stage1cDir ]; - if (system($cmd)) { + if (slxsystem($cmd)) { die _tr("unable to copy folder with pre-required files to folder <%s> (%s)\n", $stage1cDir, $!); } @@ -531,11 +525,11 @@ sub stage1A_copyTrustedPackageKeys tar --exclude=.svn -cp -C $self->{'distro-info-dir'} trusted-package-keys \\ | tar -xp -C $stage1bDir ]; - if (system($cmd)) { + if (slxsystem($cmd)) { die _tr("unable to copy folder with trusted package keys to folder <%s> (%s)\n", $stage1bDir, $!); } - system("chmod 444 $stage1bDir/trusted-package-keys/*"); + slxsystem("chmod 444 $stage1bDir/trusted-package-keys/*"); # install ultimately trusted keys (from distributor): my $stage1cDir @@ -566,7 +560,7 @@ sub stage1A_createRequiredFiles } mkdir "$stage1cDir/dev"; - if (system("mknod $stage1cDir/dev/null c 1 3")) { + if (!-e "$stage1cDir/dev/null" && slxsystem("mknod $stage1cDir/dev/null c 1 3")) { die _tr("unable to create node <%s> (%s)\n", "$stage1cDir/dev/null", $!); } } @@ -670,11 +664,11 @@ sub stage1C_cleanupBasicVendorOS my $stage1cDir = "$self->{'stage1aDir'}/$self->{'stage1bSubdir'}/$self->{'stage1cSubdir'}"; - if (system("mv $stage1cDir/* $self->{'vendor-os-path'}/")) { + if (slxsystem("mv $stage1cDir/* $self->{'vendor-os-path'}/")) { die _tr("unable to move final setup to <%s> (%s)\n", $self->{'vendor-os-path'}, $!); } - if (system("rm -rf $self->{stage1aDir}")) { + if (slxsystem("rm -rf $self->{stage1aDir}")) { die _tr("unable to remove temporary folder <%s> (%s)\n", $self->{stage1aDir}, $!); } @@ -798,15 +792,24 @@ sub downloadFilesFrom my $baseURL = shift; my @foundFiles; + my @contFlags = ('-c'); + # default to trying to continue partial downloads foreach my $fileVariantStr (@$files) { next unless $fileVariantStr =~ m[\S]; my $foundFile; foreach my $file (split '\s+', $fileVariantStr) { vlog 2, "fetching <$file>..."; - if (system("wget", "$baseURL/$file") == 0) { +retry: + if (slxsystem("wget", @contFlags, "$baseURL/$file") == 0) { $foundFile = basename($file); last; } + if (scalar(@contFlags)) { + # server probably doesn't support continuing downloads, so we + # remove the continue-flag and retry: + shift @contFlags; + goto retry; + } } if (!defined $foundFile) { die _tr("unable to fetch <%s> from <%s> (%s)\n", $fileVariantStr, diff --git a/installer/slxos-setup b/installer/slxos-setup index 71a2d948..b43c7e1e 100755 --- a/installer/slxos-setup +++ b/installer/slxos-setup @@ -100,16 +100,16 @@ chdir($FindBin::RealBin) # create ossetup-engine for given distro and start it: my $engine = OpenSLX::OSSetup::Engine->new; if ($action =~ m[import]i) { - $engine->initialize($vendorOSName, 0, 'import'); + $engine->initialize($vendorOSName, 'import'); if (!-e $engine->{'vendor-os-path'}) { die _tr("'%s' doesn't exist, giving up!\n", $engine->{'vendor-os-path'}); } $engine->addInstalledVendorOSToConfigDB(); } elsif ($action =~ m[update]i) { - $engine->initialize($vendorOSName, 0, 'update'); + $engine->initialize($vendorOSName, 'update'); $engine->updateVendorOS(); } elsif ($action =~ m[install]i) { - $engine->initialize($vendorOSName, 1, 'install'); + $engine->initialize($vendorOSName, 'install'); $engine->installVendorOS(); } elsif ($action =~ m[clone]i) { if (!length($source)) { @@ -118,7 +118,7 @@ if ($action =~ m[import]i) { if ($source !~ m[^.+::?.+$]) { die _tr("Unkown source format given, expected ':' or '::'!\n"); } - $engine->initialize($vendorOSName, 0, 'clone'); + $engine->initialize($vendorOSName, 'clone'); $engine->cloneVendorOS($source); } -- cgit v1.2.3-55-g7522