diff options
author | Simon Rettberg | 2016-10-17 19:53:33 +0200 |
---|---|---|
committer | Simon Rettberg | 2016-10-17 19:53:33 +0200 |
commit | 28438e02be61c27461e26fee4980e4db336b3458 (patch) | |
tree | 7c7572beb7df994f7df525851c3e1340e0cecbd7 | |
parent | [rfs-stage32] Improve /etc/issue generator (diff) | |
download | tm-scripts-28438e02be61c27461e26fee4980e4db336b3458.tar.gz tm-scripts-28438e02be61c27461e26fee4980e4db336b3458.tar.xz tm-scripts-28438e02be61c27461e26fee4980e4db336b3458.zip |
[rfs-stage32] Improve /etc/issue banner even more :-)
-rwxr-xr-x | remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/openslx-create_issue | 39 | ||||
-rw-r--r-- | remote/rootfs/rootfs-stage32/templates/issue.template | 2 |
2 files changed, 37 insertions, 4 deletions
diff --git a/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/openslx-create_issue b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/openslx-create_issue index d3086176..c70e0356 100755 --- a/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/openslx-create_issue +++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/openslx-create_issue @@ -25,12 +25,45 @@ 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"}" - len=${#line} + line="${line//"%ip%"/"$SLX_PXE_CLIENT_IP"}" + line="${line//"%hostname%"/"$SLX_HOSTNAME"}" + tst="${line//"%space%"/}" + len=${#tst} [ "$len" -gt "$MAX" ] && MAX=$len echo "$line" done < "$INFILE" > "$TMPFILE" +player=$(< /etc/vmware/config grep -m1 '^product.version' | awk -F= '{print $2}') +kernel=$(uname -r) +system="$(dmidecode -s system-manufacturer | grep -vP "unknown|filled|^#") $(dmidecode -s system-product-name | grep -vP "unknown|filled|^#")" +linkspeed=$(cat /sys/class/net/eth0/speed) +tmpstatus=$(grep -m1 ' /tmp ' /proc/mounts | awk '{print $3}') +if [ -z "$tmpstatus" ] || [ "$tmpstatus" = "tmpfs" ]; then + tmpstatus="RAMDISK" +else + tmpstatus="HDD" +fi +tmpstatus="$(df -P | grep -m1 ' /tmp$' | awk '{printf "%.1f", $2 / 1024 / 1024}')GiB ($tmpstatus)" + +cat >> "$TMPFILE" <<EOF +System model: %space% $system +Kernel version: %space% $kernel +Temporary directory: %space% $tmpstatus +Boot server: %space% $SLX_PXE_SERVER_IP +EOF +if [ -n "$linkspeed" ]; then + echo "Link speed: %space% ${linkspeed}MBit" >> "$TMPFILE" +fi +if [ -n "$SLX_SHUTDOWN_SCHEDULE" ]; then + echo "Scheduled shutdown: %space% $SLX_SHUTDOWN_SCHEDULE" >> "$TMPFILE" +fi +if [ -n "$SLX_REBOOT_SCHEDULE" ]; then + echo "Scheduled reboot: %space% $SLX_REBOOT_SCHEDULE" >> "$TMPFILE" +fi +if [ -n "$player" ]; then + echo "VMware version: %space% ${player//'"'/}" >> "$TMPFILE" +fi + +echo "" >> "$TMPFILE" # Fix up spacing for right-aligned text while IFS='' read -r line || [ -n "$line" ]; do diff --git a/remote/rootfs/rootfs-stage32/templates/issue.template b/remote/rootfs/rootfs-stage32/templates/issue.template index adf1f38e..6e2b449e 100644 --- a/remote/rootfs/rootfs-stage32/templates/issue.template +++ b/remote/rootfs/rootfs-stage32/templates/issue.template @@ -1,4 +1,4 @@ --- \l + @ \l WELCOME TO %space% %hostname% [%ip%] _____ ______ ______ __ __ _______ __ __ __ / _ | _ | ___| | | | | ____| | | | | | |