From db9f15c4db32fabad70a43545324cb34d48ce68e Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Thu, 18 Apr 2019 13:32:01 +0200 Subject: [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 '' 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. --- .../slx-issue/data/opt/openslx/scripts/openslx-create_issue | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'core/modules/slx-issue/data/opt/openslx/scripts/openslx-create_issue') 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 +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="" + # 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) -- cgit v1.2.3-55-g7522