detect-os/.local/bin/getsystem

17 行
338 B
Plaintext
Raw 通常表示 履歴

2022-11-17 15:07:45 +09:00
#!/bin/sh
ostype='unknown'
platform='unknown'
unamestr=$(uname)
if [ "$unamestr" = 'Linux' ]; then
ostype='linux'
platform=$(cat /etc/os-release | grep "^ID=" | sed -e "s/ID=//")
elif [ "$unamestr" = 'FreeBSD' ]; then
ostype='bsd'
platform='freebsd'
elif [ "$unamestr" = 'OpenBSD' ]; then
ostype='bsd'
platform='openbsd'
fi