summaryrefslogtreecommitdiffstats
path: root/config-db
diff options
context:
space:
mode:
authorOliver Tappe2008-01-11 12:26:15 +0100
committerOliver Tappe2008-01-11 12:26:15 +0100
commita66c764439c979699cd561f870e33df9408d0756 (patch)
tree97de0653a60791e45694e36dd34b3d1e0c473103 /config-db
parent* added two new global settings: (diff)
downloadcore-a66c764439c979699cd561f870e33df9408d0756.tar.gz
core-a66c764439c979699cd561f870e33df9408d0756.tar.xz
core-a66c764439c979699cd561f870e33df9408d0756.zip
* added support to the config-demuxer for PXE-theming, i.e. it will look
at the contents of the 'pxe-theme' setting and then try to activate the PXE-theme with the given name. That includes these actions: - an optional template is still loaded and the PXE theme config file is appended to it (such that the theme configuration overrides and/or extends the general PXE-template) - the last background picture referenced by the PXE configuration is copied to the target folder - the menu margin is set according to the 'pxe-theme-menu-margin' setting - any separator lines are rendered as appropriate for the given margin - if any system has a description, it is formatted as appriopriate for the given margin and added to the PXE menu as a TEXT HELP block The whole setup seems to work properly, except for a charset conversion bug concerning the data that has come from the DB (label and description) Thanks go to Michael for his great work on the PXE theme! git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1461 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'config-db')
-rwxr-xr-xconfig-db/slxconfig-demuxer37
1 files changed, 31 insertions, 6 deletions
diff --git a/config-db/slxconfig-demuxer b/config-db/slxconfig-demuxer
index 9558d1ca..fe362daf 100755
--- a/config-db/slxconfig-demuxer
+++ b/config-db/slxconfig-demuxer
@@ -382,10 +382,12 @@ sub writePXEMenus
$pxeTemplate .= slurpFile($pxeThemeConfig);
}
- # PXE uses 'cp850' (codepage 850) but our string is in utf-8, we have
- # to convert in order to avoid showing gibberish on the client side...
- use Encode 'from_to';
- from_to($pxeTemplate, 'utf-8', 'cp850');
+ # fetch info about margin and replace the corresponding placeholders
+ my $margin = $openslxConfig{'pxe-theme-menu-margin'} || 0;
+ my $marginAsText = ' ' x $margin;
+ $pxeTemplate =~ s{\@\@\@MENU_MARGIN\@\@\@}{$margin}g;
+ my $separatorLine = '-' x (78 - 4 - 2 * $margin);
+ $pxeTemplate =~ s{\@\@\@SEPARATOR_LINE\@\@\@}{$separatorLine}g;
# pick out the last background picture and copy it over
my $pic;
@@ -420,16 +422,39 @@ sub writePXEMenus
$append .= " initrd=$extID/$info->{'initramfs-name'}";
$append .= " $clientAppend";
$slxLabels .= "LABEL openslx-$info->{'external-id'}\n";
- $slxLabels .= "\tMENU LABEL ^$info->{label}\n";
+ my $label = $info->{label} || '';
+ if (!length($label) || $label eq $info->{name}) {
+ if ($info->{name} =~ m{^(.+)::(.+)$}) {
+ my $system = $1;
+ my $exportType = $2;
+ $label = $system . ' ' x (40-length($system)) . $exportType;
+ } else {
+ $label = $info->{name};
+ }
+ }
+ $slxLabels .= "\tMENU LABEL ^$label\n";
$slxLabels .= "\tKERNEL $extID/$kernelName\n";
$slxLabels .= "\tAPPEND $append\n";
$slxLabels .= "\tIPAPPEND 1\n";
+ my $helpText = $info->{description} || '';
+ if (length($helpText)) {
+ # make sure that text matches the given margin
+ $helpText =~ s{^}{$marginAsText}gms;
+ $slxLabels .= "\tTEXT HELP\n$helpText\n\tENDTEXT\n";
+ }
}
-$slxLabels .= $slxLabels . $slxLabels . $slxLabels . $slxLabels;
# now add the slx-labels (inline or appended) and write the config file
if (!($pxeConfig =~ s{\@\@\@SLX_LABELS\@\@\@}{$slxLabels})) {
$pxeConfig .= $slxLabels;
}
+
+print "$pxeConfig\n";
+
+ # PXE uses 'cp850' (codepage 850) but our string is in utf-8, we have
+ # to convert in order to avoid showing gibberish on the client side...
+ use Encode 'from_to';
+ from_to($pxeConfig, 'utf-8', 'cp850');
+
spitFile($pxeFile, $pxeConfig);
}
return;