]> git.pld-linux.org Git - packages/util-vserver.git/blobdiff - vprocunhide.init
err, stupid pointer error
[packages/util-vserver.git] / vprocunhide.init
index 0252c6cf4ce3d51a1bebed93f55cecde2426db23..4bc80cef194ed898ff57dfd98f0835861a5b51f9 100644 (file)
@@ -4,55 +4,69 @@
 #
 # chkconfig: 2345 26 74
 # description: Makes some /proc entries visibly for vservers
+#
+# $Id$
+
+# if kernel not capable, exit early
+if [ ! -d /proc/virtual ]; then
+       case "$1" in
+       start|stop|reload|restart)
+               exit 0
+               ;;
+       esac
+fi
 
 # Source function library.
 . /etc/rc.d/init.d/functions
 
-[ -n "$UTIL_VSERVER_VARS" ] || $UTIL_VSERVER_VARS=/usr/lib/util-vserver/util-vserver-vars
+[ -n "$UTIL_VSERVER_VARS" ] || UTIL_VSERVER_VARS=/usr/lib/util-vserver/util-vserver-vars
 if [ ! -e "$UTIL_VSERVER_VARS" ] ; then
-    echo "Can not find util-vserver installation (the file '$UTIL_VSERVER_VARS' would be expected); aborting..." >&2
-    exit 1
+       echo "Can not find util-vserver installation (the file '$UTIL_VSERVER_VARS' would be expected); aborting..." >&2
+       exit 1
 fi
 . "$UTIL_VSERVER_VARS"
 
-case "$1" in
-    start)
-       show "Fixing vservers /proc entries visibility"
+$_VSERVER_INFO - FEATURE iattr || exit 0
+
+start() {
+       show "Fixing vservers /proc entries visibility"
        busy
        $_VPROCUNHIDE
        RETVAL=$?
        deltext
        case "$RETVAL" in
-           0)  ok;;
-           2)  ok; RETVAL=0;;
-           *)  fail;;
+               0)      ok;;
+               2)      ok; RETVAL=0;;
+               *)      fail;;
        esac
        [ "$RETVAL" -eq 0 ] && touch /var/lock/subsys/vprocunhide
-       ;;
-    stop)
-       show "Stopping vservers /proc entries visibility"
+}
+
+stop() {
+       show "Stopping vservers /proc entries visibility"
        busy
        rm -f /var/lock/subsys/vprocunhide
        ok
+}
+
+case "$1" in
+  start|restart|reload)
+       start
        ;;
-    restart|reload)
-       $0 stop
-       $0 start
+  stop)
+       stop
        ;;
-    status)
-       if [ -f /var/lock/subsys/vprocunhide ] ; then
-           echo "vservers /proc entries were fixed"
+  status)
+       if [ -f /var/lock/subsys/vprocunhide ]; then
+               echo "vservers /proc entries were fixed"
        else
-           echo "vservers /proc entries are not fixed"
+               echo "vservers /proc entries were not fixed"
        fi
        ;;
-    *)
-        echo "Usage: $0 {start|stop|reload|restart|status}"
-       exit 1
+  *)
+       msg_usage "$0 {start|stop|reload|restart|status}"
+       exit 3
        ;;
 esac
 
 exit $RETVAL
-
-# This must be last line !
-# vi:syntax=sh:tw=78:ts=8:sw=4
This page took 0.048877 seconds and 4 git commands to generate.