summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--installer/OpenSLX/OSSetup/Engine.pm65
-rw-r--r--lib/OpenSLX/Basics.pm22
-rw-r--r--lib/distro-info/fedora-6/settings.local.example8
-rw-r--r--lib/distro-info/fedora-6_x86_64/settings.local.example8
-rw-r--r--lib/distro-info/suse-10.1/settings.local.example7
-rw-r--r--lib/distro-info/suse-10.1_x86_64/settings.local.example7
-rw-r--r--lib/distro-info/suse-10.2/settings.local.example7
-rw-r--r--lib/distro-info/suse-10.2_x86_64/settings.local.example7
8 files changed, 106 insertions, 25 deletions
diff --git a/installer/OpenSLX/OSSetup/Engine.pm b/installer/OpenSLX/OSSetup/Engine.pm
index 82c93648..9d7d31ab 100644
--- a/installer/OpenSLX/OSSetup/Engine.pm
+++ b/installer/OpenSLX/OSSetup/Engine.pm
@@ -79,6 +79,20 @@ sub new
return bless $self, $class;
}
+sub DESTROY
+{
+ my $self = shift;
+
+ if ($self->{'local-http-server-master-pid'} == $$) {
+ # we are the master process, so we clean up all the servers that we
+ # have started:
+ while(my ($localURL, $pid) = each %{$self->{'local-http-servers'}}) {
+ vlog 1, _tr("stopping local HTTP-server for URL '%s'.", $localURL);
+ kill TERM => $pid;
+ }
+ }
+}
+
sub initialize
{
my $self = shift;
@@ -160,13 +174,15 @@ sub installVendorOS
}
$self->createVendorOSPath();
+ $self->startLocalURLServersAsNeeded();
+
my $baseSystemFile = "$self->{'vendor-os-path'}/.openslx-base-system";
if (-e $baseSystemFile) {
vlog 0, _tr("found existing base system, continuing...\n");
} else {
# basic setup, stage1a-c:
$self->setupStage1A();
- executeInSubprocess( sub {
+ callInSubprocess( sub {
# some tasks that involve a chrooted environment:
$self->changePersonalityIfNeeded();
$self->setupStage1B();
@@ -176,7 +192,7 @@ sub installVendorOS
slxsystem("touch $baseSystemFile");
# just touch the file, in order to indicate a basic system
}
- executeInSubprocess( sub {
+ callInSubprocess( sub {
# another task that involves a chrooted environment:
$self->changePersonalityIfNeeded();
$self->setupStage1D();
@@ -268,7 +284,10 @@ sub updateVendorOS
die _tr("can't update vendor-OS '%s', since it doesn't exist!\n",
$self->{'vendor-os-path'});
}
- executeInSubprocess( sub {
+
+ $self->startLocalURLServersAsNeeded();
+
+ callInSubprocess( sub {
$self->changePersonalityIfNeeded();
$self->updateStage1D();
});
@@ -489,6 +508,14 @@ sub sortRepositoryURLs
my $self = shift;
my $repoInfo = shift;
+ if ($repoInfo->{'url'} =~ m[^local:]) {
+ # a local URL blocks all the others, in order to avoid causing
+ # (external) network traffic:
+ my $localURL = $repoInfo->{'url'};
+ $localURL =~ s[^local:][http:];
+ return [ $localURL ];
+ }
+
my %urlInfo;
# specified URL always has highest precedence:
$urlInfo{$repoInfo->{url}} = 0 if defined $repoInfo->{url};
@@ -546,6 +573,38 @@ try_next_url:
return @foundFiles;
}
+sub startLocalURLServersAsNeeded
+{
+ my $self = shift;
+
+ $self->{'local-http-server-master-pid'} = $$;
+
+ foreach my $repoInfo (values %{$self->{'distro-info'}->{repository}}) {
+
+ next unless $repoInfo->{'url'} =~ m[^local:];
+ my $localURL = $repoInfo->{url};
+ if (!exists $self->{'local-http-servers'}->{$localURL}) {
+ my $busyboxName
+ = $self->hostIs64Bit()
+ ? 'busybox.x86_64'
+ : 'busybox.i586';
+ my $busybox = "$openslxConfig{'share-path'}/busybox/$busyboxName";
+ my $port = 5080;
+ if ($localURL =~ m[:(\d+)/]) {
+ $port = $1;
+ }
+ my $pid = executeInSubprocess(
+ $busybox, "httpd",
+ '-p', $port,
+ '-h', '/',
+ '-f'
+ );
+ vlog 1, _tr("started local HTTP-server for URL '%s'.", $localURL);
+ $self->{'local-http-servers'}->{$localURL} = $pid;
+ }
+ }
+}
+
sub setupStage1A
{
my $self = shift;
diff --git a/lib/OpenSLX/Basics.pm b/lib/OpenSLX/Basics.pm
index 937c99c7..f673d279 100644
--- a/lib/OpenSLX/Basics.pm
+++ b/lib/OpenSLX/Basics.pm
@@ -23,7 +23,8 @@ $VERSION = 1.01;
@EXPORT = qw(
&openslxInit %openslxConfig %cmdlineConfig
&_tr &trInit
- &warn &die &executeInSubprocess &slxsystem
+ &warn &die
+ &callInSubprocess &executeInSubprocess &slxsystem
&vlog
&instantiateClass
&addCleanupFunction &removeCleanupFunction
@@ -298,7 +299,7 @@ sub _tr
}
# ------------------------------------------------------------------------------
-sub executeInSubprocess
+sub callInSubprocess
{
my $childFunc = shift;
@@ -324,6 +325,23 @@ sub executeInSubprocess
}
# ------------------------------------------------------------------------------
+sub executeInSubprocess
+{
+ my @cmdlineArgs = @_;
+
+ my $pid = fork();
+ if (!$pid) {
+ # child...
+ # ...exec the given cmdline:
+ exec(@cmdlineArgs);
+ die _tr("error in exec('%s')! (%s)", join(' ', @cmdlineArgs), $!);
+ }
+
+ # parent...
+ return $pid;
+}
+
+# ------------------------------------------------------------------------------
sub addCleanupFunction
{
my $name = shift;
diff --git a/lib/distro-info/fedora-6/settings.local.example b/lib/distro-info/fedora-6/settings.local.example
index 75115e1a..b41c94f8 100644
--- a/lib/distro-info/fedora-6/settings.local.example
+++ b/lib/distro-info/fedora-6/settings.local.example
@@ -1,7 +1,7 @@
-# Use local installation sources.
-# $repository{base}->{url} = 'ftp://localhost/pub/opensuse/distribution/SL-10.1/inst-source';
-# $repository{base_update}->{url} = 'ftp://localhost/pub/suse/update/10.1';
-#
+# use local installation sources
+$repository{'base'}->{'url'} = "local://localhost:5080/srv/ftp/pub/opensuse/distribution/SL-10.1/inst-source";
+$repository{'base_update'}->{'url'} = "local://localhost:5082/srv/ftp/pub/suse/update/10.1";
+
# Add a new selection:
# $selection{'my-kde'} = "$selection{default}
# foo
diff --git a/lib/distro-info/fedora-6_x86_64/settings.local.example b/lib/distro-info/fedora-6_x86_64/settings.local.example
index 75115e1a..b41c94f8 100644
--- a/lib/distro-info/fedora-6_x86_64/settings.local.example
+++ b/lib/distro-info/fedora-6_x86_64/settings.local.example
@@ -1,7 +1,7 @@
-# Use local installation sources.
-# $repository{base}->{url} = 'ftp://localhost/pub/opensuse/distribution/SL-10.1/inst-source';
-# $repository{base_update}->{url} = 'ftp://localhost/pub/suse/update/10.1';
-#
+# use local installation sources
+$repository{'base'}->{'url'} = "local://localhost:5080/srv/ftp/pub/opensuse/distribution/SL-10.1/inst-source";
+$repository{'base_update'}->{'url'} = "local://localhost:5082/srv/ftp/pub/suse/update/10.1";
+
# Add a new selection:
# $selection{'my-kde'} = "$selection{default}
# foo
diff --git a/lib/distro-info/suse-10.1/settings.local.example b/lib/distro-info/suse-10.1/settings.local.example
index 957876e8..3588750a 100644
--- a/lib/distro-info/suse-10.1/settings.local.example
+++ b/lib/distro-info/suse-10.1/settings.local.example
@@ -1,6 +1,7 @@
-# Use local installation sources.
-$repository{base}->{url} = 'ftp://localhost/pub/opensuse/distribution/SL-10.1/inst-source';
-$repository{base_update}->{url} = 'ftp://localhost/pub/suse/update/10.1';
+# use local installation sources
+$repository{'base'}->{'url'} = "local://localhost:5080/srv/ftp/pub/opensuse/distribution/SL-10.1/inst-source";
+$repository{'base_non-oss'}->{'url'} = "local://localhost:5081/srv/ftp/pub/opensuse/distribution/SL-10.1/non-oss-inst-source";
+$repository{'base_update'}->{'url'} = "local://localhost:5082/srv/ftp/pub/suse/update/10.1";
# Add a new selection:
# $selection{'my-kde'} = "$selection{default}
diff --git a/lib/distro-info/suse-10.1_x86_64/settings.local.example b/lib/distro-info/suse-10.1_x86_64/settings.local.example
index 957876e8..3588750a 100644
--- a/lib/distro-info/suse-10.1_x86_64/settings.local.example
+++ b/lib/distro-info/suse-10.1_x86_64/settings.local.example
@@ -1,6 +1,7 @@
-# Use local installation sources.
-$repository{base}->{url} = 'ftp://localhost/pub/opensuse/distribution/SL-10.1/inst-source';
-$repository{base_update}->{url} = 'ftp://localhost/pub/suse/update/10.1';
+# use local installation sources
+$repository{'base'}->{'url'} = "local://localhost:5080/srv/ftp/pub/opensuse/distribution/SL-10.1/inst-source";
+$repository{'base_non-oss'}->{'url'} = "local://localhost:5081/srv/ftp/pub/opensuse/distribution/SL-10.1/non-oss-inst-source";
+$repository{'base_update'}->{'url'} = "local://localhost:5082/srv/ftp/pub/suse/update/10.1";
# Add a new selection:
# $selection{'my-kde'} = "$selection{default}
diff --git a/lib/distro-info/suse-10.2/settings.local.example b/lib/distro-info/suse-10.2/settings.local.example
index bd5c529d..d0afaa7f 100644
--- a/lib/distro-info/suse-10.2/settings.local.example
+++ b/lib/distro-info/suse-10.2/settings.local.example
@@ -1,6 +1,7 @@
-# Use local installation sources.
-$repository{base}->{url} = "ftp://localhost/pub/opensuse/distribution/10.2/repo/oss";
-$repository{base_update}->{url} = "ftp://localhost/pub/suse/update/10.2";
+# use local installation sources
+$repository{'base'}->{'url'} = "local://localhost:5080/srv/ftp/pub/opensuse/distribution/10.2/repo/oss";
+$repository{'base_non-oss'}->{'url'} = "local://localhost:5081/srv/ftp/pub/opensuse/distribution/10.2/repo/non-oss";
+$repository{'base_update'}->{'url'} = "local://localhost:5082/srv/ftp/pub/suse/update/10.2";
# Add a new selection:
# $selection{'my-kde'} = "$selection{default}
diff --git a/lib/distro-info/suse-10.2_x86_64/settings.local.example b/lib/distro-info/suse-10.2_x86_64/settings.local.example
index 58af4005..d0afaa7f 100644
--- a/lib/distro-info/suse-10.2_x86_64/settings.local.example
+++ b/lib/distro-info/suse-10.2_x86_64/settings.local.example
@@ -1,6 +1,7 @@
-# Use local installation sources.
-# $repository{base}->{url} = "ftp://localhost/pub/opensuse/distribution/10.2/repo/oss";
-# $repository{base_update}->{url} = "ftp://localhost/pub/suse/update/10.2";
+# use local installation sources
+$repository{'base'}->{'url'} = "local://localhost:5080/srv/ftp/pub/opensuse/distribution/10.2/repo/oss";
+$repository{'base_non-oss'}->{'url'} = "local://localhost:5081/srv/ftp/pub/opensuse/distribution/10.2/repo/non-oss";
+$repository{'base_update'}->{'url'} = "local://localhost:5082/srv/ftp/pub/suse/update/10.2";
# Add a new selection:
# $selection{'my-kde'} = "$selection{default}