-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdmidecode.sh
executable file
·42 lines (35 loc) · 914 Bytes
/
dmidecode.sh
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
36
37
38
39
40
41
42
#!/bin/bash
# Copyright Feike Donia 2024
# GNU LGPLv3
script="dmidecode.sh"
echo "-> Executing $script"
echo " Dependency resolution."
if ! command -v dmidecode &> /dev/null; then
echo "! dmidecode was not found. Exiting."
exit 1
fi
if ! command -v jc &> /dev/null; then
#try to install
echo "! jc is not installed."
echo " Trying automatic installation."
if command -v apt &> /dev/null; then
apt install -y jc
elif command -v dnf &> /dev/null; then
dnf in -y jc
elif command -v pacman &> /dev/null; then
pacman -S --noconfirm jc
else
echo "! Automatic installation failed. Exiting."
exit 1
fi
fi
#dmidecode
#loop through types 0 to 4
for i in {0..4}; do
dmidecode -t $i | jc --pritty --dmidecode > /tmp/hardwareScan/dmidecode$i.json
done
loop for types 16 and 17
for i in {16..17}; do
dmidecode -t $i | jc --pritty --dmidecode > /tmp/hardwareScan/dmidecode$i.json
done
exit 0