-
Notifications
You must be signed in to change notification settings - Fork 0
/
priv.sh
54 lines (48 loc) · 1.04 KB
/
priv.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/zsh
source /usr/lib/priv/colors.sh
PREFIX=/usr/lib/priv
OPERAND=$1
function usage() {
echo "Usage: priv [OPTIONS] COMMAND"
echo
echo "Available commands:"
echo " init initializes a new private space"
echo " grow grows the current private space"
echo " close cleans the private space context: umounts and closes mapping"
echo " mount mounts the private space (unmanaged)"
echo " spawn spawns the private space (managed, interactive)"
echo
echo "Available options:"
echo
}
if [[ -z $OPERAND ]]; then
echo_ -o 31 missing command
usage
exit 1
fi
case $OPERAND in
init)
$PREFIX/init.sh ${@:2}
;;
grow)
$PREFIX/grow.sh ${@:2}
;;
mount)
$PREFIX/mount.sh ${@:2}
;;
close)
$PREFIX/close.sh ${@:2}
;;
spawn)
if screen -list | grep -E '.priv\s' > /dev/null 2>&1; then
echo Instance already runnig, reattaching...
screen -r priv
else
screen -S priv sudo -E priv mount
fi
;;
*)
echo_ -o 31 invalid argument: $OPERAND
usage
;;
esac