diff options
author | Oliver Tappe | 2008-01-11 12:26:15 +0100 |
---|---|---|
committer | Oliver Tappe | 2008-01-11 12:26:15 +0100 |
commit | a66c764439c979699cd561f870e33df9408d0756 (patch) | |
tree | 97de0653a60791e45694e36dd34b3d1e0c473103 | |
parent | * added two new global settings: (diff) | |
download | core-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
-rwxr-xr-x | config-db/slxconfig-demuxer | 37 | ||||
-rw-r--r-- | theming/openslx/pxe/theme.conf | 39 |
2 files changed, 63 insertions, 13 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; diff --git a/theming/openslx/pxe/theme.conf b/theming/openslx/pxe/theme.conf index dfae7215..16fcc6a8 100644 --- a/theming/openslx/pxe/theme.conf +++ b/theming/openslx/pxe/theme.conf @@ -1,13 +1,13 @@ -# define menu -# geometry / behavior +DEFAULT vesamenu.c32 +MENU BACKGROUND openslx.png PROMPT 0 NOESCAPE 1 TIMEOUT 100 TOTALTIMEOUT 3000 MENU WIDTH 78 -MENU MARGIN 9 -MENU PASSWORDMARGIN 9 +MENU MARGIN @@@MENU_MARGIN@@@ +MENU PASSWORDMARGIN @@@MENU_MARGIN@@@ MENU ROWS 12 MENU TABMSGROW 18 MENU CMDLINEROW 18 @@ -19,7 +19,6 @@ MENU HELPMSGENDROW -1 MENU HSHIFT 0 MENU VSHIFT 5 -# color menu color screen 37;40 #80ffffff #00000000 std menu color border 37;40 #40000000 #ff8093a1 std menu color title 1;37;40 #ffff8b00 #ff8093a1 std @@ -39,9 +38,35 @@ menu color timeout 1;37;40 #ffff8b00 #00000000 std menu color help 37;40 #ff1c2a33 #00000000 none menu color msg07 37;40 #90ffffff #00000000 std -# messages / titles MENU MASTER PASSWD secret MENU PASSPROMPT Gesicherter Bereich, bitte Passwort eingeben: MENU AUTOBOOT Auswahl startet in # Sekunden -MENU TITLE OpenSLX - Hauptmenue +MENU TITLE OpenSLX - Hauptmenü + +##### +LABEL Bitte wählen Sie über die Pfeiltasten aus: + KERNEL vesamenu.c32 + APPEND pxelinux.cfg/default + +LABEL @@@SEPARATOR_LINE@@@ + KERNEL vesamenu.c32 + APPEND pxelinux.cfg/default +##### + +@@@SLX_LABELS@@@ + +##### +LABEL @@@SEPARATOR_LINE@@@ + KERNEL vesamenu.c32 + APPEND pxelinux.cfg/default +##### + +LABEL hilfe + MENU LABEL ^Hilfe + TEXT HELP + Bitte wählen Sie das gewünschte System über die Pfeiltasten + und bestätigen Sie mit der Return-Taste. + ENDTEXT + KERNEL vesamenu.c32 + APPEND pxelinux.cfg/default |