summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsrc/bin/slxsettings1
-rw-r--r--src/boot-env/OpenSLX/MakeInitRamFS/Engine/SlxBoot.pm2
-rwxr-xr-xsrc/config-db/slxconfig-demuxer13
-rw-r--r--src/installer/OpenSLX/OSSetup/Engine.pm91
-rwxr-xr-xsrc/installer/slxos-setup2
-rw-r--r--src/lib/OpenSLX/ConfigFolder.pm33
6 files changed, 132 insertions, 10 deletions
diff --git a/src/bin/slxsettings b/src/bin/slxsettings
index 8c6a823d..2748a33f 100755
--- a/src/bin/slxsettings
+++ b/src/bin/slxsettings
@@ -223,6 +223,7 @@ sub private_path_changed_handler
# create the default config folders (for default system only):
require OpenSLX::ConfigFolder;
OpenSLX::ConfigFolder::createConfigFolderForDefaultSystem();
+ OpenSLX::ConfigFolder::createConfigFolderForDefaultVendorOS();
return;
}
diff --git a/src/boot-env/OpenSLX/MakeInitRamFS/Engine/SlxBoot.pm b/src/boot-env/OpenSLX/MakeInitRamFS/Engine/SlxBoot.pm
index 82f46103..a0c24edb 100644
--- a/src/boot-env/OpenSLX/MakeInitRamFS/Engine/SlxBoot.pm
+++ b/src/boot-env/OpenSLX/MakeInitRamFS/Engine/SlxBoot.pm
@@ -239,7 +239,7 @@ sub _copyPreAndPostinitFiles
'default/initramfs/postinit.local',
"$self->{'system-name'}/initramfs/postinit.local"
) {
- my $cfgPath = "$openslxConfig{'private-path'}/config/$cfg";
+ my $cfgPath = "$openslxConfig{'private-path'}/config/stage3/$cfg";
next if !-f $cfgPath;
$self->addCMD("cp -p $cfgPath $self->{'build-path'}/bin/");
}
diff --git a/src/config-db/slxconfig-demuxer b/src/config-db/slxconfig-demuxer
index dadd814b..ef2978fc 100755
--- a/src/config-db/slxconfig-demuxer
+++ b/src/config-db/slxconfig-demuxer
@@ -101,7 +101,7 @@ openslxInit();
my $openslxDB = OpenSLX::ConfigDB->new();
$openslxDB->connect();
-my $clientConfigPath = "$openslxConfig{'private-path'}/config";
+my $clientConfigPath = "$openslxConfig{'private-path'}/config/stage3";
# make sure that the default config folders exist:
if (createConfigFolderForDefaultSystem()) {
# this path should have been generated by earlier stage (slxsettings), so
@@ -266,8 +266,8 @@ sub writeSlxConfigToFile
}
sub copyExternalSystemConfig
-{ # copies local configuration extensions of given system from private
- # config folder (var/lib/openslx/config/...) into a temporary folder
+{ # copies local configuration extensions of given system from private config
+ # folder (var/lib/openslx/config/stage3/...) into a temporary folder
my $systemName = shift;
my $targetPath = shift;
my $clientName = shift; # optional
@@ -827,13 +827,14 @@ specifying all the attributes of that particular system and/or client
Furthermore, each system-specific archive may contain additional system files
that are required for that system (e.g. a special PAM-module required for LDAP
-authentication). These files are copied from F<$SLX_PRIVATE_PATH/config/default>
-and F<$SLX_PROVATE_PATH/config/<system-name>>.
+authentication). These files are copied from
+F<$SLX_PRIVATE_PATH/config/stage3/default> and
+F<$SLX_PROVATE_PATH/config/stage3/<system-name>>.
On top of that, each client may have its own set of system files, too (e.g.
some config files required to install a special kind of hardware available only
on that client). These files are copied from
-F<< $SLX_PROVATE_PATH/config/<system-name>/01-<MAC-of-client> >>.
+F<< $SLX_PROVATE_PATH/config/stage3/<system-name>/01-<MAC-of-client> >>.
=back
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) {
diff --git a/src/lib/OpenSLX/ConfigFolder.pm b/src/lib/OpenSLX/ConfigFolder.pm
index fd52821e..ac5d9325 100644
--- a/src/lib/OpenSLX/ConfigFolder.pm
+++ b/src/lib/OpenSLX/ConfigFolder.pm
@@ -21,7 +21,9 @@ $VERSION = 1.01;
@EXPORT = qw(
&createConfigFolderForDefaultSystem
+ &createConfigFolderForDefaultVendorOS
&createConfigFolderForSystem
+ &createConfigFolderForVendorOS
);
=head1 NAME
@@ -66,7 +68,8 @@ required folders & files already existed.
sub createConfigFolderForDefaultSystem
{
my $result = 0;
- my $defaultConfigPath = "$openslxConfig{'private-path'}/config/default";
+ my $defaultConfigPath =
+ "$openslxConfig{'private-path'}/config/stage3/default";
if (!-e "$defaultConfigPath/initramfs") {
slxsystem("mkdir -p $defaultConfigPath/initramfs");
$result = 1;
@@ -111,6 +114,18 @@ sub createConfigFolderForDefaultSystem
return $result;
}
+sub createConfigFolderForDefaultVendorOS
+{
+ my $result = 0;
+ my $defaultConfigPath =
+ "$openslxConfig{'private-path'}/config/stage1/default";
+ if (!-e "$defaultConfigPath/rootfs") {
+ slxsystem("mkdir -p $defaultConfigPath/rootfs");
+ $result = 1;
+ }
+ return $result;
+}
+
=item B<createConfigFolderForSystem($systemName)>
Creates the configuration folder for the system whose name has been given in
@@ -135,7 +150,7 @@ sub createConfigFolderForSystem
my $result = 0;
my $systemConfigPath
- = "$openslxConfig{'private-path'}/config/$systemName/default";
+ = "$openslxConfig{'private-path'}/config/stage3/$systemName/default";
if (!-e "$systemConfigPath/initramfs") {
slxsystem("mkdir -p $systemConfigPath/initramfs");
$result = 1;
@@ -147,6 +162,20 @@ sub createConfigFolderForSystem
return $result;
}
+sub createConfigFolderForVendorOS
+{
+ my $vendorOSName = shift || confess "need to pass in system-name!";
+
+ my $result = 0;
+ my $vendorOSConfigPath
+ = "$openslxConfig{'private-path'}/config/stage1/$vendorOSName";
+ if (!-e "$vendorOSConfigPath") {
+ slxsystem("mkdir -p $vendorOSConfigPath/rootfs");
+ $result = 1;
+ }
+ return $result;
+}
+
=back
=cut