Created
February 24, 2017 22:51
-
-
Save mpontillo/227678ee580cd6c8d57432a0bbd090cf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
OUTFILE=/root/dmi.bin | |
dmidecode -u --dump-bin $OUTFILE && ( | |
echo "-----BEGIN DMI DATA-----" ; | |
base64 $OUTFILE | |
echo "-----END DMI DATA-----" | |
) || (echo "Unable to read DMI information."; exit 0) | |
echo "" | |
echo "-----BEGIN FULL DMI DECODE-----" | |
dmidecode -u --from-dump $OUTFILE | |
echo "-----END FULL DMI DECODE-----" | |
# # via http://git.savannah.nongnu.org/cgit/dmidecode.git/tree/dmiopt.c#n142 | |
DMI_STRINGS=" | |
bios-vendor | |
bios-version | |
bios-release-date | |
system-manufacturer | |
system-product-name | |
system-version | |
system-serial-number | |
system-uuid | |
baseboard-manufacturer | |
baseboard-product-name | |
baseboard-version | |
baseboard-serial-number | |
baseboard-asset-tag | |
chassis-manufacturer | |
chassis-type | |
chassis-version | |
chassis-serial-number | |
chassis-asset-tag | |
processor-family | |
processor-manufacturer | |
processor-version | |
processor-frequency | |
" | |
echo "" | |
echo "-----BEGIN DMI KEYPAIRS-----" | |
for key in $DMI_STRINGS; do | |
value=$(dmidecode --from-dump $OUTFILE -s $key) | |
printf "%s=%s\n" "$key" "$(echo $value)" | |
done | |
echo "-----END DMI KEYPAIRS-----" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment