summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--boot-env/OpenSLX/BootEnvironment/PXE.pm125
-rw-r--r--boot-env/pxe/menu-include8
-rw-r--r--boot-env/pxe/menu-template.example8
-rw-r--r--boot-env/pxe/themes/openslx/default15
-rw-r--r--boot-env/pxe/themes/openslx/header39
-rw-r--r--boot-env/pxe/themes/openslx/theme.conf48
-rw-r--r--lib/OpenSLX/Basics.pm8
7 files changed, 96 insertions, 155 deletions
diff --git a/boot-env/OpenSLX/BootEnvironment/PXE.pm b/boot-env/OpenSLX/BootEnvironment/PXE.pm
index 7ab52912..fb98e967 100644
--- a/boot-env/OpenSLX/BootEnvironment/PXE.pm
+++ b/boot-env/OpenSLX/BootEnvironment/PXE.pm
@@ -105,7 +105,14 @@ sub writeBootloaderMenuFor
my $helpText = $info->{description} || '';
if (length($helpText)) {
# make sure that text matches the given margin
- my $margin = $openslxConfig{'pxe-theme-menu-margin'} || 0;
+ my $menuMargin;
+ while ($pxeConfig =~ m{^\s*MENU MARGIN (\S+?)\s*$}gims) {
+ chomp($menuMargin = $1);
+ }
+ my $margin
+ = defined $menuMargin
+ ? "$menuMargin"
+ : "0";
my $marginAsText = ' ' x $margin;
$helpText =~ s{^}{$marginAsText}gms;
$slxLabels .= "\tTEXT HELP\n$helpText\n\tENDTEXT\n";
@@ -130,78 +137,94 @@ sub _getTemplate
return $self->{'pxe-template'} if $self->{'pxe-template'};
- my $pxeDefaultTemplate = unshiftHereDoc(<<' End-of-Here');
- NOESCAPE 0
- PROMPT 0
- TIMEOUT 100
- DEFAULT menu.c32
- IMPLICIT 1
- ALLOWOPTIONS 1
- MENU TITLE Was möchten Sie tun (Auswahl mittels Cursortasten)?
- MENU MASTER PASSWD secret
- End-of-Here
- utf8::decode($pxeDefaultTemplate);
-
my ($sec, $min, $hour, $day, $mon, $year) = (localtime);
$mon++;
$year += 1900;
my $callDate = sprintf('%04d-%02d-%02d', $year, $mon, $day);
my $callTime = sprintf('%02d:%02d:%02d', $hour, $min, $sec);
- # fetch PXE-template, if any
+ # generate PXE-Menu
my $pxeTemplate =
"# generated by slxconfig-demuxer (on $callDate at $callTime)\n";
- my $pxeTemplateFile
- = "$openslxConfig{'config-path'}/boot-env/pxe/menu-template";
- if (-e $pxeTemplateFile) {
- $pxeTemplate .= slurpFile($pxeTemplateFile);
- } else {
- $pxeTemplate .= $pxeDefaultTemplate;
- }
- # now append (and thus override) the PXE-template with the settings of the
- # selected PXE-theme, if any
+ # first check for theme
my $basePath = $openslxConfig{'base-path'};
my $configPath = $openslxConfig{'config-path'};
+ my $tftpServer = $openslxConfig{'tftp-server-ip'};
my $pxeTheme = $openslxConfig{'pxe-theme'};
- if (defined $pxeTheme) {
- # let user stuff in config path win over our stuff in base path
- my $pxeThemeInConfig
- = "$configPath/boot-env/pxe/themes/${pxeTheme}/theme.conf";
- if (-e $pxeThemeInConfig) {
- $pxeTemplate .= slurpFile($pxeThemeInConfig);
- }
- else {
- my $pxeThemeInBase
- = "$basePath/share/boot-env/pxe/themes/${pxeTheme}/theme.conf";
- if (-e $pxeThemeInBase) {
- $pxeTemplate .= slurpFile($pxeThemeInBase);
- }
- }
+ if (defined $tftpServer) {
+ $tftpServer .= "::"
+ }
+ else {
+ $tftpServer = "";
}
- # 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;
+ # let user stuff in config path win over our stuff in base path
+ my $pxeThemePath;
+ my $pxeThemeInConfig
+ = "$configPath/boot-env/pxe/themes/${pxeTheme}";
+ my $pxeThemeInBase
+ = "$basePath/share/boot-env/pxe/themes/${pxeTheme}";
+ if (-e "$pxeThemeInConfig/theme.conf") {
+ $pxeThemePath = $pxeThemeInConfig;
+ }
+ else {
+ if (-e "$pxeThemeInBase/theme.conf") {
+ $pxeThemePath = $pxeThemeInBase;
+ }
+ }
+ # include theme specific stuff from above
+ if (defined $pxeThemePath) {
+ $pxeTemplate .= "\n# theme specific configuration from $pxeThemePath\n";
+ $pxeTemplate .= slurpFile("$pxeThemePath/theme.conf");
+ }
- # pick out the last background picture and copy it over
+ # copy background picture if exists
my $pic;
- while ($pxeTemplate =~ m{^\s*MENU BACKGROUND (\S+?)\s*$}gims) {
- chomp($pic = $1);
+ if (defined $pxeTheme) {
+ while ($pxeTemplate =~ m{^\s*MENU BACKGROUND (\S+?)\s*$}gims) {
+ chomp($pic = $1);
+ }
+ my $picPrefix = $tftpServer;
+ $picPrefix .= $pic;
+ $pxeTemplate =~ s,$pic,$picPrefix,g;
}
if (defined $pic) {
- my $pxeBackground
- = defined $pxeTheme
- ? "$basePath/share/themes/${pxeTheme}/pxe/$pic"
- : $pic;
+ my $pxeBackground = "$pxeThemePath/$pic";
+ # vesamenu.c32 if $pic
+ $pxeTemplate .= "\nDEFAULT $tftpServer";
+ $pxeTemplate .= "vesamenu.c32\n";
if (-e $pxeBackground && !$self->{'dry-run'}) {
slxsystem(qq[cp "$pxeBackground" $self->{'target-path'}/]);
}
}
-
+ else {
+ # we only need menu.c32 if no $pic
+ $pxeTemplate .= "\nDEFAULT $tftpServer";
+ $pxeTemplate .= "menu.c32\n";
+ }
+
+ # include defaults
+ $pxeTemplate .= "\n# general configuration\n";
+ $pxeTemplate .= "NOESCAPE 0\n";
+ $pxeTemplate .= "PROMPT 0\n";
+
+ # include slxsettings
+ $pxeTemplate .= "\n# slxsettings configuration\n";
+ $pxeTemplate .= "TIMEOUT $openslxConfig{'pxe-timeout'}\n" || "";
+ $pxeTemplate .= "TOTALTIMEOUT $openslxConfig{'pxe-totaltimeout'}\n" || "";
+ $pxeTemplate .= "MENU MASTER PASSWD $openslxConfig{'pxe-passwd'}\n" || "";
+ $pxeTemplate .= "MENU TITLE $openslxConfig{'pxe-title'}\n" || "";
+
+ # fetch PXE-include, if exists (overwrite existing definitions)
+ my $pxeIncludeFile
+ = "$openslxConfig{'config-path'}/boot-env/pxe/menu-include";
+ if (-e $pxeIncludeFile) {
+ $pxeTemplate .= "\n# configuration from include $pxeIncludeFile\n";
+ $pxeTemplate .= slurpFile($pxeIncludeFile);
+ }
+
+ $pxeTemplate .= "\n# slxsystems:\n";
$self->{'pxe-template'} = $pxeTemplate;
return $pxeTemplate;
diff --git a/boot-env/pxe/menu-include b/boot-env/pxe/menu-include
new file mode 100644
index 00000000..490e9357
--- /dev/null
+++ b/boot-env/pxe/menu-include
@@ -0,0 +1,8 @@
+# /etc/opt/openslx/boot-env/pxe/menu-include
+# this include file will be loaded at the end and will overwrite existing defs
+# for theme configuration use theme.conf in your theme directory
+# general settings can be set via slxsettings
+
+# example german help:
+# MENU PASSPROMPT Gesicherter Bereich, bitte Passwort eingeben:
+# MENU AUTOBOOT Auswahl startet in # Sekunden
diff --git a/boot-env/pxe/menu-template.example b/boot-env/pxe/menu-template.example
deleted file mode 100644
index 4386323a..00000000
--- a/boot-env/pxe/menu-template.example
+++ /dev/null
@@ -1,8 +0,0 @@
-NOESCAPE 0
-PROMPT 0
-TIMEOUT 100
-DEFAULT menu.c32
-IMPLICIT 1
-ALLOWOPTIONS 1
-MENU TITLE Was möchten Sie tun (Auswahl mittels Cursortasten)?
-MENU MASTER PASSWD secret
diff --git a/boot-env/pxe/themes/openslx/default b/boot-env/pxe/themes/openslx/default
deleted file mode 100644
index dfc580a0..00000000
--- a/boot-env/pxe/themes/openslx/default
+++ /dev/null
@@ -1,15 +0,0 @@
-# theme default settings (non-style settings)
-
-INCLUDE header
-
-PROMPT 0
-NOESCAPE 1
-TIMEOUT 60
-TOTALTIMEOUT 3000
-
-#MENU MASTER PASSWD secret
-MENU PASSPROMPT Gesicherter Bereich, bitte Passwort eingeben:
-MENU AUTOBOOT Auswahl startet in # Sekunden
-
-MENU TITLE OpenSLX - Hauptmenü
-
diff --git a/boot-env/pxe/themes/openslx/header b/boot-env/pxe/themes/openslx/header
deleted file mode 100644
index 98de4e6f..00000000
--- a/boot-env/pxe/themes/openslx/header
+++ /dev/null
@@ -1,39 +0,0 @@
-# theme style definition
-
-DEFAULT vesamenu.c32
-MENU BACKGROUND openslx.png
-
-MENU WIDTH 78
-MENU MARGIN 9
-MENU PASSWORDMARGIN 9
-MENU ROWS 12
-MENU TABMSGROW 18
-MENU CMDLINEROW 18
-MENU ENDROW -1
-MENU PASSWORDROW 18
-MENU TIMEOUTROW 18
-MENU HELPMSGROW 18
-MENU HELPMSGENDROW -1
-MENU HSHIFT 0
-MENU VSHIFT 5
-
-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
-menu color unsel 37;40 #fff0f0f0 #ff8093a1 std
-menu color hotkey 1;37;40 #ffff8b00 #ff8093a1 std
-menu color sel 7;37;40 #ff1c2a33 #667799bb all
-menu color hotsel 1;7;37;40 #ffff8b00 #667799bb all
-menu color disabled 1;37;40 #ffff8b00 #ff8093a1 std
-menu color scrollbar 37;40 #40000000 #ee000000 std
-menu color tabmsg 37;40 #ffff8b00 #ff8093a1 std
-menu color cmdmark 1;37;40 #ffff8b00 #ff8093a1 std
-menu color cmdline 37;40 #fff0f0f0 #ff8093a1 std
-menu color pwdborder 37;40 #40000000 #ff8093a1 std
-menu color pwdheader 37;40 #ffff8b00 #ff8093a1 std
-menu color pwdentry 37;40 #ffff8b00 #ff8093a1 std
-menu color timeout_msg 37;40 #ff1c2a33 #00000000 none
-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
-
diff --git a/boot-env/pxe/themes/openslx/theme.conf b/boot-env/pxe/themes/openslx/theme.conf
index 16fcc6a8..159adf78 100644
--- a/boot-env/pxe/themes/openslx/theme.conf
+++ b/boot-env/pxe/themes/openslx/theme.conf
@@ -1,13 +1,12 @@
-DEFAULT vesamenu.c32
-MENU BACKGROUND openslx.png
+# openslx theme style definition
+# please define only look of your theme
+# for non-theme definitions use slxsettings
+# or include file in /etc/opt/openslx/boot-env/pxe/menu-include
-PROMPT 0
-NOESCAPE 1
-TIMEOUT 100
-TOTALTIMEOUT 3000
+MENU BACKGROUND openslx.png
MENU WIDTH 78
-MENU MARGIN @@@MENU_MARGIN@@@
-MENU PASSWORDMARGIN @@@MENU_MARGIN@@@
+MENU MARGIN 9
+MENU PASSWORDMARGIN 9
MENU ROWS 12
MENU TABMSGROW 18
MENU CMDLINEROW 18
@@ -26,6 +25,7 @@ menu color unsel 37;40 #fff0f0f0 #ff8093a1 std
menu color hotkey 1;37;40 #ffff8b00 #ff8093a1 std
menu color sel 7;37;40 #ff1c2a33 #667799bb all
menu color hotsel 1;7;37;40 #ffff8b00 #667799bb all
+menu color disabled 1;37;40 #ffff8b00 #ff8093a1 std
menu color scrollbar 37;40 #40000000 #ee000000 std
menu color tabmsg 37;40 #ffff8b00 #ff8093a1 std
menu color cmdmark 1;37;40 #ffff8b00 #ff8093a1 std
@@ -38,35 +38,3 @@ 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
-MENU MASTER PASSWD secret
-MENU PASSPROMPT Gesicherter Bereich, bitte Passwort eingeben:
-MENU AUTOBOOT Auswahl startet in # Sekunden
-
-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
diff --git a/lib/OpenSLX/Basics.pm b/lib/OpenSLX/Basics.pm
index ca6dd9fb..8f0bddb2 100644
--- a/lib/OpenSLX/Basics.pm
+++ b/lib/OpenSLX/Basics.pm
@@ -103,8 +103,12 @@ I<slxsettings>-script, so please look there if you'd like to know more.
'mirrors-to-try-count' => '20',
'mirrors-to-use-count' => '5',
'ossetup-max-try-count' => '5',
- 'pxe-theme' => undef,
- 'pxe-theme-menu-margin' => '9',
+ 'pxe-passwd' => 'secret',
+ 'pxe-theme' => 'openslx',
+ 'pxe-timeout' => '100',
+ 'pxe-title' => 'Welcome to OpenSLX',
+ 'pxe-totaltimeout' => '600',
+ 'tftp-server-ip' => undef,
);
chomp($openslxConfig{'locale-charmap'});