summaryrefslogtreecommitdiffstats
path: root/core/modules/slx-issue
diff options
context:
space:
mode:
Diffstat (limited to 'core/modules/slx-issue')
-rwxr-xr-xcore/modules/slx-issue/data/opt/openslx/scripts/openslx-create_issue26
-rw-r--r--core/modules/slx-issue/templates/issue.template14
2 files changed, 25 insertions, 15 deletions
diff --git a/core/modules/slx-issue/data/opt/openslx/scripts/openslx-create_issue b/core/modules/slx-issue/data/opt/openslx/scripts/openslx-create_issue
index 8165d310..e142b671 100755
--- a/core/modules/slx-issue/data/opt/openslx/scripts/openslx-create_issue
+++ b/core/modules/slx-issue/data/opt/openslx/scripts/openslx-create_issue
@@ -28,9 +28,9 @@ declare -rg OUTFILE=/etc/issue
# Replace known variables and determine maximum line length
MAX=0
while IFS='' read -r line || [ -n "$line" ]; do
- line="${line//"%ip%"/"$SLX_PXE_CLIENT_IP"}"
line="${line//"%hostname%"/"$SLX_HOSTNAME"}"
- tst="${line//"%space%"/}"
+ tst="${line//"%minspace%"/}"
+ tst="${tst//"%space%"/}"
len=${#tst}
[ "$len" -gt "$MAX" ] && MAX=$len
echo "$line"
@@ -72,25 +72,35 @@ fi
echo "" >> "$TMPFILE"
# Crop to console width
-T=$( tput cols 2> /dev/console )
+[ "$MAX" -lt 80 ] && MAX=80
+export TERM=linux
+T="$( tput cols 2> /dev/console < /dev/console )"
+[ -z "$T" ] && T="$( tput cols 2> /dev/tty1 < /dev/tty1 )"
if [ -z "$T" ]; then
- T=$( stty size < /dev/console )
+ T="$( stty size 2> /dev/console < /dev/console )"
+ [ -z "$T" ] && T="$( stty size 2> /dev/tty1 < /dev/tty1 )"
T="${T#* }"
fi
[ -n "$T" ] && [ "$T" -le "$MAX" ] && MAX=$(( T - 1 ))
+unset TERM
# Fix up spacing for right-aligned text
while IFS='' read -r line || [ -n "$line" ]; do
tst=${line/"%space%"/}
- if [ "$(( ${#line} - ${#tst} ))" -eq 7 ]; then
+ tst=${tst/"%minspace%"/}
+ if [ "${#line}" != "${#tst}" ]; then
space=
while true; do
tst=${line/"%space%"/"$space"}
- if [ "${#tst}" -ge "$MAX" ]; then
- line="$tst"
+ tst2=${tst/"%minspace%"/"$space"}
+ if [ "${#tst2}" -ge "$MAX" ]; then
+ line="${tst/"%minspace%"/"${space:0:-2}"}"
break
+ elif [ "${#space}" -gt 0 ] && [ "$(( MAX - ${#tst2} ))" -ge "${#space}" ]; then
+ space="$space$space"
+ else
+ space=" $space"
fi
- space=" $space"
done
fi
echo "${line:0:$MAX}"
diff --git a/core/modules/slx-issue/templates/issue.template b/core/modules/slx-issue/templates/issue.template
index a79797ad..e4a91423 100644
--- a/core/modules/slx-issue/templates/issue.template
+++ b/core/modules/slx-issue/templates/issue.template
@@ -1,9 +1,9 @@
- WELCOME TO %space% \n (\l)
+ WELCOME TO %minspace% %hostname% (\l)
_____ ______ ______ __ __ _______ __ __ __
- / _ | _ | ___| | | | | ____| | | | | |
- | | | | |_| | |_ | | | | |___ | | / /
- | | | | ___/| _| | | ____ | | | |
- | |_| | | | |___| | | | ____| | |___ / /
- _____/|__| |______|__| |__| |_______|______|__| |__| - NG
+ / _ | _ | ___| | | | | ____| | | | | |
+ | | | | |_| | |_ | | | | |___ | | / /
+ | | | | ___/| _| | | ____ | | | |
+ | |_| | | | |___| | | | ____| | |___ / /
+ _____/|__| |______|__| |__| |_______|______|__| |__| - NG
- %version% (c) <OpenSLX.ORG>
+ %version% %space% (c) <OpenSLX.ORG>