Restrict hw-drive-info and hw-info to Linux
This commit is contained in:
parent
e623185d96
commit
ca001ed831
2 changed files with 20 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Reference in a new issue