diff options
author | Sebastian Schmelzer | 2009-06-17 19:25:10 +0200 |
---|---|---|
committer | Sebastian Schmelzer | 2009-06-17 19:25:10 +0200 |
commit | bec14baeb0a1738e2b2548e64ba030866dc4a14a (patch) | |
tree | 97bba4cfc1ccce3a4cdbe0b3bfccb82d13fa456f /boot-env/OpenSLX/BootEnvironment/PXE.pm | |
parent | Suppress some unused variables in dhcp configuration, quieten wget ... (diff) | |
download | core-bec14baeb0a1738e2b2548e64ba030866dc4a14a.tar.gz core-bec14baeb0a1738e2b2548e64ba030866dc4a14a.tar.xz core-bec14baeb0a1738e2b2548e64ba030866dc4a14a.zip |
autobreak system description on pxe menu generation (#425)
git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2964 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'boot-env/OpenSLX/BootEnvironment/PXE.pm')
-rw-r--r-- | boot-env/OpenSLX/BootEnvironment/PXE.pm | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/boot-env/OpenSLX/BootEnvironment/PXE.pm b/boot-env/OpenSLX/BootEnvironment/PXE.pm index b8c5b9a6..35b0a3b8 100644 --- a/boot-env/OpenSLX/BootEnvironment/PXE.pm +++ b/boot-env/OpenSLX/BootEnvironment/PXE.pm @@ -117,8 +117,48 @@ sub writeBootloaderMenuFor ? "$menuMargin" : "0"; my $marginAsText = ' ' x $margin; + + my $menuWidth; + while ($pxeConfig =~ m{^\s*MENU WIDTH (\S+?)\s*$}gims) { + chomp($menuWidth = $1); + } + my $width + = defined $menuWidth + ? "$menuWidth" + : "80"; + $width = $width - 2* $margin + 2; + + my @atomicHelpText = split(/ /, $helpText); + my $lineCounter = 0; + + $helpText = ""; + + foreach my $word (@atomicHelpText){ + if ($lineCounter + length($word) + 1 < $width) { + $helpText .= "$word "; + $lineCounter += length($word) + 1; + } else { + my $nobreak = 1; + while ($nobreak == 1) { + my $pos = index($word,"-"); + $nobreak = 0; + if ($pos != -1) { + if ($lineCounter + $pos + 1 < $width) { + $helpText .= substr($word, 0, $pos+1); + $word = substr($word, $pos + 1, length($word)); + $nobreak = 1; + } + } + } + $helpText .= "\n$word "; + $lineCounter = length($word); + } + } + $helpText =~ s{^}{$marginAsText}gms; - $slxLabels .= "\tTEXT HELP\n$helpText\n\tENDTEXT\n"; + $slxLabels .= "\tTEXT HELP\n"; + $slxLabels .= "$helpText\n"; + $slxLabels .= "\tENDTEXT\n"; } } # now add the slx-labels (inline or appended) and write the config file |