diff options
author | Jonathan Bauer | 2019-04-18 13:32:01 +0200 |
---|---|---|
committer | Jonathan Bauer | 2019-04-18 13:32:01 +0200 |
commit | db9f15c4db32fabad70a43545324cb34d48ce68e (patch) | |
tree | c192715f53e52a56a7e696e3fdca4cc2cd94a298 /core/modules/slx-issue | |
parent | [rootfs-stage31] Scan pci device tree recursively (diff) | |
download | mltk-db9f15c4db32fabad70a43545324cb34d48ce68e.tar.gz mltk-db9f15c4db32fabad70a43545324cb34d48ce68e.tar.xz mltk-db9f15c4db32fabad70a43545324cb34d48ce68e.zip |
[slx-issue] use baseboard dmi info as fallback
some models like Intel's NUC5i5RYB do not provide
system-manufacturer/system-product-name in the DMI information -
that information is stored in baseboard-* instead. So we use that as a
fallback in case system-* was empty. Use '<unknown>' as ultimate
fallback.
This kinda works around an issue in the final loop filling in spaces: if
a line's value is long enough (e.g. 34 whitespaces like a untrimmed
'dmidecode -s' output...) the space variable would never be set. Thus,
${space:0:-2} would fail unless ${#space} is at least 2 and abort the
creation of /etc/issue altogether.
Diffstat (limited to 'core/modules/slx-issue')
-rwxr-xr-x | core/modules/slx-issue/data/opt/openslx/scripts/openslx-create_issue | 13 |
1 files changed, 12 insertions, 1 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 e142b671..39b337b0 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 @@ -25,6 +25,11 @@ declare -rg OUTFILE=/etc/issue . /opt/openslx/config +# get_dmi_info <class> +get_dmi_info() { + [ -n "$1" ] || return + echo $(dmidecode -s $1 | grep -vP "unknown|filled|^#") +} # Replace known variables and determine maximum line length MAX=0 while IFS='' read -r line || [ -n "$line" ]; do @@ -37,7 +42,13 @@ while IFS='' read -r line || [ -n "$line" ]; do 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|^#")" +system_manufacturer="$(get_dmi_info system-manufacturer)" +[ -z "$system_manufacturer" ] && system_manufacturer="$(get_dmi_info baseboard-manufacturer)" +system_product="$(get_dmi_info system-product-name)" +[ -z "$system_product" ] && system_product="$(get_dmi_info baseboard-product-name)" +system="$system_manufacturer $system_product" +[ -z "${system// /}" ] && system="<unknown>" + # Support the boot interface name eventually saved as SLX_PXE_NETIF # from the new dracut-based stage3, fallback to old eth0 if not set linkspeed=$(cat /sys/class/net/${SLX_PXE_NETIF:-eth0}/speed) |