Merge pull request #760 from Nitrokey/menu-systeminfo

Add systeminfo menu option
This commit is contained in:
tlaurion 2020-06-28 15:04:41 -04:00 committed by GitHub
commit e6037a217e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View File

@ -218,6 +218,7 @@ while true; do
'y' ' Default boot' \
'r' ' Refresh TOTP/HOTP' \
'a' ' Options -->' \
'S' ' System Info' \
'P' ' Power Off' \
2>/tmp/whiptail || recovery "GUI menu failed"
@ -374,6 +375,15 @@ while true; do
continue
fi
if [ "$totp_confirm" = "S" ]; then
memtotal=$(cat /proc/meminfo | grep 'MemTotal' | tr -s ' ' | cut -f2 -d ' ')
memtotal=$((${memtotal} / 1024 + 1))
cpustr=$(cat /proc/cpuinfo | grep 'model name' | uniq | sed -r 's/\(R\)//;s/\(TM\)//;s/CPU //;s/model name.*: //')
whiptail --title 'System Info' \
--msgbox "VER: ${FW_VER}\n\nCPU: ${cpustr}\nRAM: ${memtotal} MB\n\n$(fdisk -l | grep -e '/dev/sd.:' -e '/dev/nvme.*:' | sed 's/B,.*/B/')" 16 60
continue
fi
if [ "$totp_confirm" = "F" ]; then
oem-factory-reset
continue

View File

@ -92,6 +92,9 @@ fi
combine_configs
. /tmp/config
# export firmware version
export FW_VER=$(dmesg | grep 'DMI' | grep -o 'BIOS.*' | cut -f2 -d ' ')
# Add our boot devices into the /etc/fstab, if they are defined
# in the configuration file.
if [ ! -z "$CONFIG_BOOT_DEV" ]; then