From: Nicolas Boisselier Date: Sat, 28 Sep 2024 09:29:46 +0000 (+0200) Subject: etc/profile.d/sys.sh X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=9d0adb084b190d56482968828dc579ac8ebcd70f;p=nb.git etc/profile.d/sys.sh --- diff --git a/etc/profile.d/sys.sh b/etc/profile.d/sys.sh index 4f53b47d..05b290b7 100644 --- a/etc/profile.d/sys.sh +++ b/etc/profile.d/sys.sh @@ -33,10 +33,14 @@ sys_model() { ) ;; *) - if [ -e /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 + cat /sys/class/dmi/id/product_name + 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 - lshw -quiet -class system 2>/dev/null | awk -F': ' '/product: /{print $2; exit}' + sudo lshw -quiet -class system 2>/dev/null | awk -F': ' '/product: /{print $2; exit}' fi ;; esac