diff options
Diffstat (limited to 'src/installer')
-rw-r--r-- | src/installer/OpenSLX/OSSetup/Engine.pm | 91 | ||||
-rwxr-xr-x | src/installer/slxos-setup | 2 |
2 files changed, 92 insertions, 1 deletions
diff --git a/src/installer/OpenSLX/OSSetup/Engine.pm b/src/installer/OpenSLX/OSSetup/Engine.pm index 2a4463e5..159a23a7 100644 --- a/src/installer/OpenSLX/OSSetup/Engine.pm +++ b/src/installer/OpenSLX/OSSetup/Engine.pm @@ -32,6 +32,7 @@ use File::Path; use URI; use OpenSLX::Basics; +use OpenSLX::ConfigFolder; use OpenSLX::ScopedResource; use OpenSLX::Syscall; use OpenSLX::Utils; @@ -229,6 +230,10 @@ sub initialize $self->_createMetaPackager(); } + # create stage1 config folder + createConfigFolderForDefaultVendorOS(); + createConfigFolderForVendorOS($self->{'vendor-os-name'}); + return; } @@ -299,6 +304,22 @@ sub installVendorOS # generate default openslx directories for the client $self->_generateDefaultDirs(); + # copy stage1 config ... + # first copy default files ... + my $defaultConfigPath = "$openslxConfig{'private-path'}" . + "/config/stage1/default/rootfs/"; + vlog(2, "checking $defaultConfigPath for default config..."); + if (-d $defaultConfigPath) { + $self->_copyStage1Config($defaultConfigPath); + } + # ... now pour system-specific configuration on top (if any) ... + my $vendorOSConfigPath = "$openslxConfig{'private-path'}/config/stage1/" . + "$self->{'vendor-os-name'}/rootfs/"; + vlog(2, "checking $vendorOSConfigPath for system config..."); + if (-d $vendorOSConfigPath) { + $self->_copyStage1Config($vendorOSConfigPath); + } + # add the initramfs rootfs and tools to the stage1 $self->_copyRootfs(); #callInSubprocess( @@ -400,7 +421,23 @@ sub cloneVendorOS # generate default openslx directories for the client $self->_generateDefaultDirs(); - + + # copy stage1 config ... + # first copy default files ... + my $defaultConfigPath = "$openslxConfig{'private-path'}" . + "/config/stage1/default/rootfs/"; + vlog(2, "checking $defaultConfigPath for default config..."); + if (-d $defaultConfigPath) { + $self->_copyStage1Config($defaultConfigPath); + } + # ... now pour system-specific configuration on top (if any) ... + my $vendorOSConfigPath = "$openslxConfig{'private-path'}/config/stage1/" . + "$self->{'vendor-os-name'}/rootfs/"; + vlog(2, "checking $vendorOSConfigPath for system config..."); + if (-d $vendorOSConfigPath) { + $self->_copyStage1Config($vendorOSConfigPath); + } + # add the initramfs rootfs and tools to the stage1 $self->_copyRootfs(); $self->_touchVendorOS(); @@ -431,6 +468,23 @@ sub updateVendorOS ); $self->_generateDefaultDirs(); + + # copy stage1 config ... + # first copy default files ... + my $defaultConfigPath = "$openslxConfig{'private-path'}" . + "/config/stage1/default/rootfs/"; + vlog(2, "checking $defaultConfigPath for default config..."); + if (-d $defaultConfigPath) { + $self->_copyStage1Config($defaultConfigPath); + } + # ... now pour system-specific configuration on top (if any) ... + my $vendorOSConfigPath = "$openslxConfig{'private-path'}/config/stage1/" . + "$self->{'vendor-os-name'}/rootfs/"; + vlog(2, "checking $vendorOSConfigPath for system config..."); + if (-d $vendorOSConfigPath) { + $self->_copyStage1Config($vendorOSConfigPath); + } + $self->_copyRootfs(); $self->_touchVendorOS(); vlog( @@ -1194,6 +1248,41 @@ sub _copyRootfs return; } +sub _copyStage1Config +{ + my $self = shift; + my $source = shift; + + vlog( + 0, + _tr( + "Copying vendor-OS config from '%s' to '%s'...\n", $source, + $self->{'vendor-os-path'} + ) + ); + my $additionalRsyncOptions = $ENV{SLX_RSYNC_OPTIONS} || ''; + my $rsyncCmd + = "rsync -av --numeric-ids $additionalRsyncOptions" + . " $source $self->{'vendor-os-path'}"; + vlog(2, "executing: $rsyncCmd\n"); + my $rsyncFH; + open($rsyncFH, '|-', $rsyncCmd) + or croak( + _tr( + "unable to start rsync for source '%s', giving up! (%s)\n", + $source, $! + ) + ); + print $rsyncFH; + if (!close($rsyncFH)) { + print "rsync-result=", 0+$!, "\n"; + croak _tr( + "unable to clone from source '%s', giving up! (%s)\n", $source, $! + ); + } + return; +} + sub _createPackager { my $self = shift; diff --git a/src/installer/slxos-setup b/src/installer/slxos-setup index 8812a19b..30c9287b 100755 --- a/src/installer/slxos-setup +++ b/src/installer/slxos-setup @@ -80,6 +80,8 @@ if ($action =~ m[^import]i) { die _tr("'%s' doesn't exist, giving up!\n", $engine->{'vendor-os-path'}); } $engine->addInstalledVendorOSToConfigDB(); + createConfigFolderForDefaultVendorOS(); + createConfigFolderForVendorOS($vendorOSName); } elsif ($action =~ m[^update]i) { my $vendorOSName = shift @ARGV; if (!defined $vendorOSName) { |