From 396ca963b8274031ecc322c02208346b84f04ac0 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Sun, 6 Oct 2024 15:23:11 +0200 Subject: [PATCH] etc/profile.d/sys.sh --- etc/profile.d/sys.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) 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 ;; -- 2.47.3