detect-os/.local/bin/getsystem

17 行
338 B
Bash
実行ファイル

#!/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