about summary refs log tree commit diff
path: root/xuname
diff options
context:
space:
mode:
authorq66 <daniel@octaforge.org>2019-08-16 15:19:20 +0200
committerLeah Neukirchen <leah@vuxu.org>2019-09-30 18:29:22 +0200
commitfaf06f17f427f5dbc239fb3d2114f19d70c693d3 (patch)
tree2b6d503716a857b30eed6ef57968713943414ad1 /xuname
parent56765c6bb7b62d846cf9fd6255da57d1a8817b2e (diff)
downloadxtools-faf06f17f427f5dbc239fb3d2114f19d70c693d3.tar.gz
xtools-faf06f17f427f5dbc239fb3d2114f19d70c693d3.tar.xz
xtools-faf06f17f427f5dbc239fb3d2114f19d70c693d3.zip
xuname: use "platform" for cpu instead of "vendor_id" when missing
Also provide a fallback when both are missing.

Closes: #153 [via git-merge-pr]
Diffstat (limited to 'xuname')
-rwxr-xr-xxuname3
1 files changed, 2 insertions, 1 deletions
diff --git a/xuname b/xuname
index 8e06da4..8dbcf17 100755
--- a/xuname
+++ b/xuname
@@ -8,6 +8,7 @@ OUTDATED=$(xbps-install -Mun)
 HOLD=$(xbps-query -H)
 VM=$(dmesg 2>/dev/null | awk '/Hypervisor detected/{print $NF}')
 CPU=$(cat /proc/cpuinfo |awk '/^vendor_id/{print $NF;exit}')
+[ -z "$CPU" ] && CPU=$(cat /proc/cpuinfo |awk '/^platform/{print $NF;exit}')
 REPO=$(xbps-query --regex -p repository -s '.' | cut -d/ -f2- | sort -u | awk '
 	/^\/alpha.de.repo.voidlinux.org\/current\/multilib/ {m=m"m"}
 	/^\/alpha.de.repo.voidlinux.org\/current\/debug/ {d=d"d"}
@@ -19,4 +20,4 @@ REPO=$(xbps-query --regex -p repository -s '.' | cut -d/ -f2- | sort -u | awk '
 ')
 
 printf '%s %s %s %s %s%s %s\n' \
-	"$OS" "$KVER" "$MACH" "$CPU${VM:+/$VM}" "${OUTDATED:+not}uptodate" "${HOLD:+ hold}" "$REPO"
+	"$OS" "$KVER" "$MACH" "${CPU:-Unknown}${VM:+/$VM}" "${OUTDATED:+not}uptodate" "${HOLD:+ hold}" "$REPO"