getdistro now runs at the start of the script with getos so we can use it in detection

This commit is contained in:
dylan araps 2016-01-05 18:56:05 +11:00
parent 528296626c
commit 26495ccab5
1 changed files with 42 additions and 44 deletions

View File

@ -229,59 +229,57 @@ case "$(uname)" in
esac esac
# Get Distro # Get Distro
getdistro () { case "$os" in
case "$os" in "Linux" )
"Linux" ) if type -p crux >/dev/null 2>&1; then
if type -p crux >/dev/null 2>&1; then distro="CRUX"
distro="CRUX" else
else distro="$(grep -h '^NAME=' /etc/*ease)"
distro="$(grep -h '^NAME=' /etc/*ease)" distro=${distro#NAME\=\"*}
distro=${distro#NAME\=\"*} distro=${distro%*\"}
distro=${distro%*\"} fi
fi ;;
;;
"Mac OS X") "Mac OS X")
distro="Mac OS X $(sw_vers -productVersion)" distro="Mac OS X $(sw_vers -productVersion)"
;; ;;
"OpenBSD") "OpenBSD")
distro="OpenBSD" distro="OpenBSD"
;; ;;
"Windows") "Windows")
case "$(cmd /c ver)" in case "$(cmd /c ver)" in
*"XP"*) *"XP"*)
distro="Windows XP" distro="Windows XP"
;; ;;
*"7"*) *"7"*)
distro="Windows 7" distro="Windows 7"
;; ;;
*"8.1"*) *"8.1"*)
distro="Windows 8.1" distro="Windows 8.1"
;; ;;
*"8"*) *"8"*)
distro="Windows 8" distro="Windows 8"
;; ;;
*"10"*) *"10"*)
distro="Windows 10" distro="Windows 10"
;; ;;
*) *)
distro="Windows" distro="Windows"
;; ;;
esac esac
;; ;;
*) *)
distro="Unknown" distro="Unknown"
;; ;;
esac esac
}
# Get Title # Get Title
gettitle () { gettitle () {