Ver Fonte

OS detection for freebsd and osx

... im not 100% sure if the strings are correct
lesteff há 9 anos atrás
pai
commit
6e500f349f
1 ficheiros alterados com 7 adições e 5 exclusões
  1. 7 5
      check_service.sh

+ 7 - 5
check_service.sh

@@ -50,13 +50,15 @@ fi
 
 os_check() {
 if [ "$OS" == null ]; then
-        if [[ `uname` == 'Linux' ]]; then
+	unamestr=`uname`
+        if [[ $unamestr == 'Linux' ]]; then
                 OS='linux'
-        #I dont know the propper OS String for osx etc... as example
-        #elif [[ "$unamestr" == 'FreeBSD' ]]; then
-        #       OS='freebsd'
+        elif [[ $unamestr == 'FreeBSD' ]]; then
+               OS='freebsd'
+        elif [[ $unamestr == 'Darwin' ]]; then
+               OS='osx'	       
         else
-                echo "OS not recognized, Use \`\`-o'' and specify the OS as an argument"
+                echo "OS not recognized, Use \`-o\` and specify the OS as an argument"
                 exit 3
         fi
 fi