From: Nicolas Boisselier Date: Sun, 6 Oct 2024 13:23:11 +0000 (+0200) Subject: etc/profile.d/sys.sh X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=396ca963b8274031ecc322c02208346b84f04ac0;p=nb.git etc/profile.d/sys.sh --- diff --git a/etc/profile.d/sys.sh b/etc/profile.d/sys.sh index 05b290b7..2f1fe45a 100644 --- a/etc/profile.d/sys.sh +++ b/etc/profile.d/sys.sh @@ -33,13 +33,20 @@ sys_model() { ) ;; *) - if [ -r /proc/device-tree/model ]; then + if [ -r /proc/device-tree/model ] + then tr -d '\000' < /proc/device-tree/model && echo - elif [ -r /sys/class/dmi/id/product_name ]; then + elif [ -r /sys/class/dmi/id/product_name ] + then cat /sys/class/dmi/id/product_name - elif which inxi > /dev/null; then + elif which hostnamectl > /dev/null + then + hostnamectl | awk -F': ' '$1 ~ /Hardware Model/{print $2;exit}' + elif which inxi > /dev/null + then inxi -M | awk -F': ' '/product:/ {sub(/^.*product: /,""); sub(/[^ ]+:.*/,""); print $0; exit} /System:/ {sub(/^.*System: /,""); sub(/[^ ]+:.*/,""); print $0; exit}' - elif which lshw > /dev/null; then + elif which lshw > /dev/null + then sudo lshw -quiet -class system 2>/dev/null | awk -F': ' '/product: /{print $2; exit}' fi ;;