summaryrefslogtreecommitdiffstats
path: root/config-db/slxconfig-demuxer
diff options
context:
space:
mode:
authorOliver Tappe2007-05-16 22:36:17 +0200
committerOliver Tappe2007-05-16 22:36:17 +0200
commit5fcd8319d7ca1d8f62e6f296232513ba9257391f (patch)
tree7348a4d08f6c59d3b68330cae4e8e966bdbf1de5 /config-db/slxconfig-demuxer
parent* updated POD (diff)
downloadcore-5fcd8319d7ca1d8f62e6f296232513ba9257391f.tar.gz
core-5fcd8319d7ca1d8f62e6f296232513ba9257391f.tar.xz
core-5fcd8319d7ca1d8f62e6f296232513ba9257391f.zip
* removed incorrect use of quotemeta() when copying configuration folders,
fixes problem of system- and client-specific files not being copied * Instead of overwriting attribut-files, we now append to them, in order to make use of any settings the user might have provided in the configuration folder (unless, of course, these settings are overruled by the DB). AFAIC, this currently makes sense for the root-pw only. * pass on machine-setup file to mkdxsinitrd, fixes ticket #134 git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1085 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'config-db/slxconfig-demuxer')
-rwxr-xr-xconfig-db/slxconfig-demuxer28
1 files changed, 21 insertions, 7 deletions
diff --git a/config-db/slxconfig-demuxer b/config-db/slxconfig-demuxer
index a91b00db..fddcc361 100755
--- a/config-db/slxconfig-demuxer
+++ b/config-db/slxconfig-demuxer
@@ -199,8 +199,12 @@ sub writeAttributesToFile
return if $dryRun;
- open(ATTRS, "> $fileName") or die "unable to write to $fileName";
+ # append to attribute file if it exists, in order to make use of any
+ # settings that have been added by the user (unless, of course, these
+ # settings are overruled by the DB):
+ open(ATTRS, ">> $fileName") or die "unable to write to $fileName";
my @attrs = sort grep { isAttribute($_) } keys %$attrHash;
+ print ATTRS "# attributes set by slxconfig-demuxer:\n";
foreach my $attr (@attrs) {
if (length($attrHash->{$attr}) > 0) {
my $externalAttrName = externalAttrName($attr);
@@ -208,6 +212,11 @@ sub writeAttributesToFile
}
}
close(ATTRS);
+ if ($openslxConfig{'verbose-level'} > 2) {
+ print "--- START OF MACHINE-SETUP ---\n";
+ system("cat $fileName");
+ print "--- END OF MACHINE-SETUP --- \n";
+ }
}
sub writeSlxConfigToFile
@@ -249,7 +258,7 @@ sub copyExternalSystemConfig
}
# ... now pour system-specific configuration on top (if any):
my $systemSpecConfigPath
- = quotemeta("$clientConfigPath/$systemName/default");
+ = "$clientConfigPath/$systemName/default";
vlog 2, "checking $systemSpecConfigPath for system config...";
if (-d $systemSpecConfigPath) {
slxsystem("cp -a $systemSpecConfigPath/* $targetPath");
@@ -258,7 +267,7 @@ sub copyExternalSystemConfig
# client has been given, so we finally pour client-specific
# configuration on top (if any):
my $clientSpecConfigPath
- = quotemeta("$clientConfigPath/$systemName/$clientName");
+ = "$clientConfigPath/$systemName/$clientName";
vlog 2, "checking $clientSpecConfigPath for client config...";
if (-d $clientSpecConfigPath) {
slxsystem("cp -a $clientSpecConfigPath/* $targetPath")
@@ -351,6 +360,7 @@ sub generateInitalRamFS
{
my $info = shift;
my $pxeVendorOSPath = shift;
+ my $attrFile = shift;
my $vendorOS = $info->{'vendor-os'};
@@ -378,6 +388,9 @@ sub generateInitalRamFS
# always use dhclient instead of the busybox-provided dhcp-client
# (since the latter is unable to fetch NIS-stuff).
+ # pass in machine-setup file (the one contained in system's conf-TGZ):
+ $cmd .= "-c $attrFile ";
+
# ...set kernel version...
my $kernelFile = basename(followLink($info->{'kernel-file'}));
$kernelFile =~ m[-(.+)$];
@@ -396,6 +409,7 @@ sub generateInitalRamFS
sub writeSystemPXEFiles
{
my $info = shift;
+ my $attrFile = shift;
my $kernelFile = $info->{'kernel-file'};
my $kernelName = basename($kernelFile);
@@ -413,7 +427,7 @@ sub writeSystemPXEFiles
$info->{'initramfs-name'}
= sprintf "initramfs-%d",
$vendorOSInitramfsMap{$info->{'vendor-os'}->{id}};
- generateInitalRamFS($info, $pxeVendorOSPath);
+ generateInitalRamFS($info, $pxeVendorOSPath, $attrFile);
}
sub writeDhcpConfig
@@ -464,7 +478,7 @@ sub writeClientConfigurationsForSystem
# merge default, system and client configuration files into
# the system configuration for the current client:
copyExternalSystemConfig($externalSystemID, $buildPath,
- $externalClientName);
+ $externalClientName);
writeAttributesToFile($client, $attrFile);
@@ -487,17 +501,17 @@ sub writeSystemConfiguration
my $buildPath = "$tempPath/build";
copyExternalSystemConfig(externalIDForSystem($info), $buildPath);
- my $attrFile = "$buildPath/initramfs/machine-setup";
$openslxDB->mergeDefaultAttributesIntoSystem($info);
$info->{'attr-digest'} = digestAttributes($info);
vlog 2, _tr("attribute-digest for system '%s' is '%s'", $info->{name},
$info->{'attr-digest'});
+ my $attrFile = "$buildPath/initramfs/machine-setup";
writeAttributesToFile($info, $attrFile);
my $systemPath = "$tftpbootPath/client-config/$info->{'external-id'}";
createTarOfPath($buildPath, "default.tgz", $systemPath);
- writeSystemPXEFiles($info);
+ writeSystemPXEFiles($info, $attrFile);
writeClientConfigurationsForSystem($info, $buildPath, $attrFile);