add system_info script

Signed-off-by: Michel-FK <michel.stempin@funkey-project.com>
This commit is contained in:
Michel-FK 2020-12-08 22:42:36 +01:00
parent 53674684cc
commit 6e9df57977
1 changed files with 18 additions and 0 deletions

View File

@ -0,0 +1,18 @@
#!/bin/sh
. /etc/os-release
ROOTFS_VERSION=`echo $VERSION | sed -e 's/.*-g/g/'`
ROOTFS_DATE=`date -r /etc/os-release '+%a %b %d %Y' `
KERNEL_VERSION=`uname -r`
KERNEL_DATE=`uname -v |cut -d ' ' -f 3-5,8`
PROCESSOR=`cat /proc/cpuinfo |head -1 |sed 's/^.*: //' `
RAM=`cat /proc/meminfo | head -1 |sed 's/^MemTotal: \+//' `
SWAP=`awk 'BEGIN { getline } { print "\t"$1": "$3" kB" }' /proc/swaps 2>/dev/null`
[ "$SWAP" ] && SWAP="Swap: $SWAP\n"
echo -e "Kernel version: $KERNEL_VERSION\nCompiled: $KERNEL_DATE\n
Root FS version: $ROOTFS_VERSION\nCompiled: $ROOTFS_DATE\n
Processor: $PROCESSOR\nUsable RAM: $RAM\n$SWAP
Network interfaces:"
ip -o -4 address list | awk '{if ($2 != "lo") { printf "%7s %s\n", $2, gensub("/.*$", "", "g", $4) ; outlines++ } } END { if (outlines == 0) print " (none)" }'