gentoo: use /var/run for new /run compatibility
[util-vserver.git] / scripts / vnamespace
1 #! /bin/bash
2 # $Id$
3
4 # Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
5 # Copyright (C) 2008 Daniel Hokka Zakrisson
6 #  
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; version 2 of the License.
10 #  
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15 #  
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
20 : ${UTIL_VSERVER_VARS:=/usr/lib/util-vserver/util-vserver-vars}
21 test -e "$UTIL_VSERVER_VARS" || {
22     echo $"Can not find util-vserver installation (the file '$UTIL_VSERVER_VARS' would be expected); aborting..." >&2
23     exit 1
24 }
25 . "$UTIL_VSERVER_VARS"
26 . "$_LIB_FUNCTIONS"
27
28 function showHelp()
29 {
30     echo \
31 $"Usage: $1 <operation> [--] [<program> <args>*]
32
33 <operation> can be one of:
34     --new|-n          ...  create new namespace and execute <program> there;
35                            <program> is mandatory in this case
36     --enter|-e <xid>  ...  enter the namespace of context <xid> and execute
37                            <program> there; <program> is mandatory in this
38                            case
39     --set|-s          ...  make current namespace the namespace of the
40                            current context
41     --cleanup|-c      ...  remove all mounts from the namespace of the
42                            current context
43
44 Please report bugs to $PACKAGE_BUGREPORT"
45     exit $2
46 }
47
48 function showVersion()
49 {
50     echo \
51 $"vnamespace $PACKAGE_VERSION -- manages filesystem-namespace
52 This program is part of $PACKAGE_STRING
53
54 Copyright (C) 2004 Enrico Scholz
55 This program is free software; you may redistribute it under the terms of
56 the GNU General Public License.  This program has absolutely no warranty."
57     exit $1
58 }
59
60 exec $_VSPACE --mount --fs "$@"