heads/initrd/bin/oem-system-info-xx30
Matthew Drobnak 19a705c179
Add functions to handle normal, warning, and error for whiptail and fbwhiptail.
Signed-off-by: Matthew Drobnak <matthew@drobnak.com>
2024-06-25 17:26:14 +00:00

60 lines
2.3 KiB
Bash
Executable File

#!/bin/bash
# System Info
BOARD_NAME=${CONFIG_BOARD_NAME:-${CONFIG_BOARD}}
MAIN_MENU_TITLE="${BOARD_NAME} | Extended System Information"
export BG_COLOR_MAIN_MENU="normal"
. /etc/functions
. /etc/gui_functions
. /etc/luks-functions
. /tmp/config
TRACE_FUNC
battery_charge="$(print_battery_charge)"
battery_health="$(print_battery_health)"
if [ -n $battery_charge -a -n $battery_health ];then
battery_status="\nBattery charge: $battery_charge% Battery health: $battery_health%\n"
fi
usb="$(lsusb)"
pci="$(lspci)"
camera="None|Unknown"
if echo "$usb" |grep -s "04f2:b2db"; then camera="Yes"; fi #t430
if echo "$usb" |grep -s "04f2:b2ea"; then camera="Yes"; fi #x230
if echo "$usb" |grep -s "5986:02d2"; then camera="Yes"; fi #x230
bluetooth="None|Unkown"
if echo "$usb" |grep -s "0a5c:21e6"; then bluetooth="BCM20702 Bluetooth 4.0"; fi
wifi="None|Unkown"
if echo "$pci" |grep -s "8086:0085"; then wifi="Intel Centrino Advanced-N 6205"; fi
if echo "$pci" |grep -s "168c:0034"; then wifi="Qualcomm Atheros AR9462"; fi
if echo "$pci" |grep -s "168c:0030"; then wifi="Qualcomm Atheros AR93xx"; fi
mouse="None|Uknown"
if grep -s "TouchPad" /sys/class/input/mouse*/device/name; then mouse="Synaptic TouchPad"; fi
know_devices="$(echo -e "Camera: ${camera}\nBluetooth: ${bluetooth}\nWifi: ${wifi}\nMouse: ${mouse}")"
echo -e "PCI USB" > /tmp/devices_usb_pci
for l in $(seq 16); do
row1="$(echo "$pci"|sed -n ${l}p|cut -d " " -f 5)"
row2="$(echo "$usb"|sed -n ${l}p|cut -d " " -f 6)"
row3="$(echo "$know_devices"|sed -n ${l}p)"
echo "${row1} | ${row2} ${row3}" >> /tmp/devices_usb_pci
done
memtotal=$(cat /proc/meminfo | grep 'MemTotal' | tr -s ' ' | cut -f2 -d ' ')
memtotal=$((${memtotal} / 1024 / 1024 + 1))
cpustr=$(cat /proc/cpuinfo | grep 'model name' | uniq | sed -r 's/\(R\)//;s/\(TM\)//;s/CPU //;s/model name.*: //')
kernel=$(uname -s -r)
FB_OPTIONS=""
if whiptail --version |grep "fbwhiptail"; then FB_OPTIONS="--text-size 12"; fi
whiptail_type $BG_COLOR_MAIN_MENU $FB_OPTIONS --title 'System Info' \
--msgbox "${BOARD_NAME}\nFW_VER: ${FW_VER}\nKernel: ${kernel}\nCPU: ${cpustr} RAM: ${memtotal} GB $battery_status\n$(fdisk -l | grep -e '/dev/sd.:' -e '/dev/nvme.*:' | sed 's/B,.*/B/')\n\n$(cat /tmp/devices_usb_pci)" 0 80