From: Enrico Scholz Date: Sat, 6 Mar 2004 01:53:32 +0000 (+0000) Subject: implemented exclude/include syntax X-Git-Tag: VERSION_0_10~450 X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a8cba5c903f9a2f2825e388d9bd9aa89f583dee2;p=util-vserver.git implemented exclude/include syntax fixed exit codes git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@1123 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- diff --git a/util-vserver/scripts/vprocunhide b/util-vserver/scripts/vprocunhide index 8416a46..2811a82 100755 --- a/util-vserver/scripts/vprocunhide +++ b/util-vserver/scripts/vprocunhide @@ -31,8 +31,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 where changes but there occured errors on other ones + 3 ... operation failed on every file Report bugs to <$PACKAGE_BUGREPORT>." exit 0 @@ -65,18 +66,29 @@ findFile UNHIDEFILE \ 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 "$passed" && exit 2 || \ +exit 3