X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=lib.sh;h=ea61359e2e806be5b26aaff201930743d7214b5a;hb=144b79caff995d7c5773e3efb66813bf131de0e2;hp=31b56c066db9596df61488efd4e7a48a6c8cbeae;hpb=84f932c810dae9ba0dd948e3a90c2f90d1f4e24a;p=config%2Fdotfiles.git diff --git a/lib.sh b/lib.sh index 31b56c0..ea61359 100644 --- a/lib.sh +++ b/lib.sh @@ -14,7 +14,20 @@ m4=`which m4` # Check if the given program is installed. Returns 0 if it exists, 1 # otherwise; so it can be used in if. installed() { - which $1 > /dev/null + which $1 | grep -E '^/' > /dev/null +} + +# Prints the current OS. Supported are Debian (debian) and Mac OS X (darwin) +# at the moment. If an unsupported OS is used an error is printed. +os() { + if [ -f /etc/debian_version ]; then + echo debian + elif [ x`uname` = xDarwin ]; then + echo darwin + else + echo unsupported OS! >&2 + return 1 + fi } # Creates a symbolic link for file $1 in dirname of $2 with name of basenmae