Restrict hw-drive-info and hw-info to Linux

This commit is contained in:
2Shirt 2019-12-09 17:11:54 -07:00
parent e623185d96
commit ca001ed831
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
2 changed files with 20 additions and 0 deletions

View file

@ -5,6 +5,16 @@ BLUE='\033[34m'
CLEAR='\033[0m'
IFS=$'\n'
# Check if running under Linux
os_name="$(uname -s)"
if [[ "$os_name" == "Darwin" ]]; then
os_name="macOS"
fi
if [[ "$os_name" != "Linux" ]]; then
echo "This script is not supported under $os_name." 1>&2
exit 1
fi
# List devices
for line in $(lsblk -do NAME,TRAN,SIZE,VENDOR,MODEL,SERIAL); do
if [[ "${line:0:4}" == "NAME" ]]; then

View file

@ -25,6 +25,16 @@ function print_dmi_value() {
print_in_columns "$name: $value"
}
# Check if running under Linux
os_name="$(uname -s)"
if [[ "$os_name" == "Darwin" ]]; then
os_name="macOS"
fi
if [[ "$os_name" != "Linux" ]]; then
echo "This script is not supported under $os_name." 1>&2
exit 1
fi
# System
echo -e "${BLUE}System Information${CLEAR}"
print_dmi_value "Vendor" "sys_vendor"