summaryrefslogtreecommitdiffstats
path: root/installer
diff options
context:
space:
mode:
authorOliver Tappe2007-05-28 23:10:57 +0200
committerOliver Tappe2007-05-28 23:10:57 +0200
commit7926993940c0d4f8b1bab9557cf972364d782402 (patch)
tree476820b404df19f3c9569bf0ee4615c87d288479 /installer
parent* fixed bug introduced with last commit, package-installation was hosed (diff)
downloadcore-7926993940c0d4f8b1bab9557cf972364d782402.tar.gz
core-7926993940c0d4f8b1bab9557cf972364d782402.tar.xz
core-7926993940c0d4f8b1bab9557cf972364d782402.zip
* added support for 'local:'-URLs, which trigger the automatic start of a
busybox-httpd for each repository, through which every request will be routed (thus giving access to files outside of the chroot) * renamed executeInSubprocess() to callInSubprocess() and added a real implementation of executeInSubprocess(), too * updated all settings.local.example files to reflect the new way of accessing local files git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1102 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'installer')
-rw-r--r--installer/OpenSLX/OSSetup/Engine.pm65
1 files changed, 62 insertions, 3 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;