isAvoidNamespace(): use 'vserver-info - FEATURE namespace' inforamtion too
[util-vserver.git] / util-vserver / scripts / vprocunhide
1 #!/bin/bash
2 #
3 # Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
4 #  
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; version 2 of the License.
8 #  
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #  
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18
19 : ${UTIL_VSERVER_VARS:=/usr/lib/util-vserver/util-vserver-vars}
20 test -e "$UTIL_VSERVER_VARS" || {
21     echo $"Can not find util-vserver installation; aborting...">&2
22     exit 1
23 }
24 . "$UTIL_VSERVER_VARS"
25 . "$_LIB_FUNCTIONS"
26
27 function showHelp()
28 {
29     echo $\
30 "Usage: vprocunhide
31
32 Return values:
33     0  ...  no errors
34     1  ...  some files where changes but there occured errors on other ones
35     2  ...  operation failed on every file
36
37 Report bugs to <$PACKAGE_BUGREPORT>."
38     exit 0
39 }
40
41 function showVersion()
42 {
43     echo \
44 $"vprocunhide $PACKAGE_VERSION -- unhides /proc entries
45 This program is part of $PACKAGE_STRING
46
47 Copyright (C) 2004 Enrico Scholz
48 This program is free software; you may redistribute it under the terms of
49 the GNU General Public License.  This program has absolutely no warranty."
50     exit 0
51 }
52
53
54 while test "$1"; do
55     case "$1" in
56         --help)         showHelp;;
57         --version)      showVersion;;
58     esac
59 done
60
61 findFile UNHIDEFILE \
62     "$CONFDIR"/.defaults/apps/vprocunhide/files \
63     "$PKGLIBDEFAULTDIR"/vprocunhide-files
64
65 ok=1
66 passed=
67 while read filename; do
68     param=
69     case "$filename" in
70         */)     param=-R;;
71         *)      ;;
72     esac
73
74     set -- $filename
75     test -e "$1" || continue
76     
77     $_SETATTR -x $param --!hide "$@" && passed=1 || ok=
78 done <"$UNHIDEFILE"
79
80 test "$ok"     && exit 0 || \
81 test "$passed" && exit 1 || \
82 exit 2