Better OS detection and distro detection

This commit is contained in:
Dylan 2016-05-07 20:39:00 +10:00
parent ffab8e2f75
commit 90447980bd

View file

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