-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetinformation.sh
More file actions
35 lines (31 loc) · 1.28 KB
/
getinformation.sh
File metadata and controls
35 lines (31 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
# Run:
# chmod +x getinformation.sh
# ./getinformation.sh
set -e #Exit immediately if a comman returns a non-zero status
#read info
echo "hostname:$(uname -n)"
echo "architecture:$(uname -m)"
echo "osKernel:$(uname -r)"
echo "osName:$(lsb_release -i | sed 's/.*:\s*//')"
echo "osDescription:$(lsb_release -d | sed 's/.*:\s*//')"
echo "osRelease:$(lsb_release -r | sed 's/.*:\s*//')"
echo "osCodename:$(lsb_release -c | sed 's/.*:\s*//')"
if [ -f /etc/armbian-release ]; then
#cat /etc/armbian-release | grep 'BOARD_NAME\|BOARDFAMILY\|VERSION\|LINUXFAMILY'
echo "boardName:$(cat /etc/armbian-release | grep 'BOARD_NAME' | sed 's/.*=\s*//')"
echo "boardFamily:$(cat /etc/armbian-release | grep 'BOARDFAMILY' | sed 's/.*=\s*//')"
echo "armbianVersion:$(cat /etc/armbian-release | grep 'VERSION' | sed 's/.*=\s*//')"
echo "linuxFamily:$(cat /etc/armbian-release | grep 'LINUXFAMILY' | sed 's/.*=\s*//')"
else
#/proc/cpuinfo
#/root/rpiz.txt
#TODO: заменить велосипед на более простой
declare boardName=("$(cat /proc/cpuinfo | grep 'model\|Model' | grep -v 'name' | sed 's/.*:\s*//' | head -n1)")
if [ "$boardName" != "" ]; then
#string must be longer than 2 characters
if [ ${#boardName} -gt 2 ]; then
echo "boardName:${boardName}"
fi
fi
fi