forked from leahneukirchen/xtools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xuname
executable file
·24 lines (22 loc) · 998 Bytes
/
xuname
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh
# xuname - display system info relevant for debugging Void
OS=Void
KVER=$(uname -r)
MACH=$(xbps-uhelper arch)
OUTDATED=$(xbps-install -Mun)
HOLD=$(xbps-query -H)
VM=$(dmesg 2>/dev/null | awk '/Hypervisor detected/{print $NF}')
[ -z "$VM" ] && grep -q hypervisor /proc/cpuinfo && VM=VM
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"}
/^\/alpha.de.repo.voidlinux.org\/current\/.*\/nonfree/ {n=n"n"}
/^\/alpha.de.repo.voidlinux.org\/current/ {r=r"r"}
/xdowngrade-/ {D=D"D"}
!/alpha.de.voidlinux.org/ && !/xdowngrade-/ {F=F"F"}
END { print r m d n D F }
')
printf '%s %s %s %s %s%s %s\n' \
"$OS" "$KVER" "$MACH" "${CPU:-Unknown}${VM:+/$VM}" "${OUTDATED:+not}uptodate" "${HOLD:+ hold}" "$REPO"