]> git.meshlink.io Git - catta/commitdiff
update debian initscript to emulate lsb functions
authorSebastien Estienne <sebastien.estienne@gmail.com>
Tue, 21 Jun 2005 17:37:54 +0000 (17:37 +0000)
committerSebastien Estienne <sebastien.estienne@gmail.com>
Tue, 21 Jun 2005 17:37:54 +0000 (17:37 +0000)
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@139 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe

initscript/Debian/15avahi.in

index 6116078dad6f9cc2c85253104ef304deaf1be277..00d8fb619be289d59c3bf4636a823e6b8625b2c7 100755 (executable)
@@ -6,7 +6,56 @@
 # Authors:      <sebastien.estienne@gmail.com>
 #
 
-. /lib/lsb/init-functions
+if [ -f /lib/lsb/init-functions ]
+then
+    . /lib/lsb/init-functions
+else
+    # int log_begin_message (char *message)
+    log_begin_msg () {
+        if [ -z "$1" ]; then
+           return 1
+        fi
+        echo " * $@"
+    }
+
+    # int log_end_message (int exitstatus)
+    log_end_msg () {
+       
+    # If no arguments were passed, return
+       [ -z "$1" ] && return 1
+       
+    # Only do the fancy stuff if we have an appropriate terminal
+    # and if /usr is already mounted
+       TPUT=/usr/bin/tput
+       EXPR=/usr/bin/expr
+       if [ -x $TPUT ] && [ -x $EXPR ] && $TPUT hpa 60 >/dev/null 2>&1; then
+           COLS=`$TPUT cols`
+           if [ -n "$COLS" ]; then
+               COL=`$EXPR $COLS - 7`
+           else
+               COL=73
+           fi
+           UP=`$TPUT cuu1`
+           END=`$TPUT hpa $COL`
+           START=`$TPUT hpa 0`
+           RED=`$TPUT setaf 1`
+           NORMAL=`$TPUT op`
+           if [ $1 -eq 0 ]; then
+               echo "$UP$END[ ok ]"
+           else
+               echo -e "$UP$START $RED*$NORMAL$END[${RED}fail${NORMAL}]"
+           fi
+       else
+           if [ $1 -eq 0 ]; then
+               echo "   ...done."
+           else
+               echo "   ...fail!"
+           fi
+       fi
+       return $1
+    }
+    
+fi
 
 #set -e