From 144b79caff995d7c5773e3efb66813bf131de0e2 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Sun, 1 Mar 2009 16:17:42 +0100 Subject: [PATCH] lib.sh: Add os function which returns current OS. Works on Debian and Mac OS X at the moment. --- lib.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib.sh b/lib.sh index 5576bce..ea61359 100644 --- a/lib.sh +++ b/lib.sh @@ -17,6 +17,19 @@ installed() { 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 # $2. # -- 2.43.2