use $(LIBENSCVECTOR) instead of libensc_vector.a
[util-vserver.git] / util-vserver / scripts / vprocunhide
index 8416a46..76307ba 100755 (executable)
@@ -1,4 +1,5 @@
 #!/bin/bash
+# $Id$
 #
 # Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
 #  
@@ -18,7 +19,7 @@
 
 : ${UTIL_VSERVER_VARS:=/usr/lib/util-vserver/util-vserver-vars}
 test -e "$UTIL_VSERVER_VARS" || {
-    echo $"Can not find util-vserver installation; aborting...">&2
+    echo $"Can not find util-vserver installation (the file '$UTIL_VSERVER_VARS' would be expected); aborting..." >&2
     exit 1
 }
 . "$UTIL_VSERVER_VARS"
@@ -31,8 +32,9 @@ function showHelp()
 
 Return values:
     0  ...  no errors
-    1  ...  some files where changes but there occured errors on other ones
-    2  ...  operation failed on every file
+    1  ...  configuration error
+    2  ...  some files were changed but errors occured on other ones
+    3  ...  operation failed on every file
 
 Report bugs to <$PACKAGE_BUGREPORT>."
     exit 0
@@ -51,7 +53,7 @@ the GNU General Public License.  This program has absolutely no warranty."
 }
 
 
-while test "$1"; do
+while test -n "$1"; do
     case "$1" in
        --help)         showHelp;;
        --version)      showVersion;;
@@ -59,24 +61,35 @@ while test "$1"; do
 done
 
 findFile UNHIDEFILE \
-    "$CONFDIR"/.defaults/apps/vprocunhide/files \
-    "$PKGLIBDEFAULTDIR"/vprocunhide-files
+    "$__CONFDIR"/.defaults/apps/vprocunhide/files \
+    "$__PKGLIBDEFAULTDIR"/vprocunhide-files
 
 ok=1
 passed=
 while read filename; do
-    param=
+    params=()
+
+    case "$filename" in
+       (\#*)   continue;;
+       (-*)    params=( --admin         --hide ); filename=${filename#-};;
+       (~*)    params=( --admin --watch --hide ); filename=${filename#~};;
+       (:*)    params=(         --watch --hide ); filename=${filename#:};;
+       (!*)    params=(                 --hide ); filename=${filename#!};;
+       (+*)    params=(                --!hide ); filename=${filename#+};;
+       (*)     params=(                --!hide );;
+    esac
+       
     case "$filename" in
-       */)     param=-R;;
-       *)      ;;
+       (*/)    params=( "${params[@]}" -R );;
+       (*)     ;;
     esac
 
     set -- $filename
     test -e "$1" || continue
     
-    $_SETATTR -x $param --!hide "$@" &&        passed=1 || ok=
+    $_SETATTR -x "${params[@]}" "$@" &&        passed=1 || ok=
 done <"$UNHIDEFILE"
 
-test "$ok"     && exit 0 || \
-test "$passed" && exit 1 || \
-exit 2
+test -n "$ok"     && exit 0 || \
+test -n "$passed" && exit 2 || \
+exit 3