Better OS detection and distro detection

This commit is contained in:
Dylan 2016-05-07 20:39:00 +10:00
parent ffab8e2f75
commit 90447980bd
1 changed files with 10 additions and 7 deletions

View File

@ -447,13 +447,12 @@ shopt -s nocasematch extglob
# Operating System {{{ # Operating System {{{
case "$(uname -sm)" in case "$(uname)" in
"Linux"*) os="Linux" ;; "Linux") os="Linux" ;;
*"iPhone"* | *"iPad"* | *"iPod"*) os="iOS" ;; "Darwin") os="$(sw_vers -productName)" ;;
"Darwin"*) os="Mac OS X" ;; "OpenBSD") os="OpenBSD" ;;
"OpenBSD"*) os="OpenBSD" ;; *"BSD") os="BSD" ;;
"FreeBSD"* | "NetBSD"*) os="BSD" ;; "CYGWIN"*) os="Windows" ;;
"CYGWIN"*) os="Windows" ;;
*) printf "%s\n" "Unknown OS detected: $(uname)"; exit 1 ;; *) printf "%s\n" "Unknown OS detected: $(uname)"; exit 1 ;;
esac esac
@ -501,6 +500,10 @@ getdistro () {
distro="$codename $osx_version $osx_build" distro="$codename $osx_version $osx_build"
;; ;;
"iPhone OS")
distro="iOS $(sw_vers -productVersion)"
;;
"OpenBSD") "OpenBSD")
distro="OpenBSD" distro="OpenBSD"
;; ;;