]> git.nbdom.net Git - nb.git/commitdiff
etc/profile.d/sys.sh
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Sun, 6 Oct 2024 13:23:11 +0000 (15:23 +0200)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Sun, 6 Oct 2024 13:23:11 +0000 (15:23 +0200)
etc/profile.d/sys.sh

index 05b290b72492ec59b1150c25c20ed89cb8ddad12..2f1fe45af2370171a6979b0a862aef1e252bfcc0 100644 (file)
@@ -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
                ;;