Subversion Repositories configs

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4 - 1
#!/bin/bash
2
## BEGIN INIT INFO
3
# Provides: sandbox
4
# Default-Start: 3 4 5
5
# Default-Stop: 0 1 2 3 4 6
6
# Required-Start:
7
#
8
## END INIT INFO
9
# sandbox:        Set up / mountpoint to be shared, /var/tmp, /tmp, /home/sandbox unshared
10
#
11
# chkconfig: 345 1 99
12
#
13
# description: sandbox, xguest and other apps that want to use pam_namespace \
14
#              require this script be run at boot.  This service script does \
15
#              not actually run any service but sets up: \
16
#              /var/tmp, /tmp and home directories to be used by these tools.\
17
#              If you do not use sandbox, xguest or pam_namespace you can turn \
18
#              this service off.\
19
#
20
 
21
# Source function library.
22
. /etc/init.d/functions
23
 
24
HOMEDIRS="/home"
25
 
26
. /etc/sysconfig/sandbox
27
 
28
LOCKFILE=/var/lock/subsys/sandbox
29
 
30
base=${0##*/}
31
 
32
start() {
33
	echo -n "Starting sandbox"
34
 
35
	[ -f "$LOCKFILE" ] && return 1
36
 
37
	touch $LOCKFILE
38
	mount --make-rshared / || return $?
39
	mount --rbind /tmp /tmp || return $?
40
	mount --rbind /var/tmp /var/tmp || return $?
41
	mount --make-private /tmp || return $?
42
	mount --make-private /var/tmp || return $?
43
	for h in $HOMEDIRS; do
44
	    mount --rbind $h $h || return $?
45
	    mount --make-private $h || return $?
46
	done
47
 
48
	return 0
49
}
50
 
51
stop() {
52
	echo -n "Stopping sandbox"
53
 
54
	[ -f "$LOCKFILE" ] || return 1
55
}
56
 
57
status() {
58
	if [ -f "$LOCKFILE" ]; then
59
	    echo "$base is running"
60
	else
61
	    echo "$base is stopped"
62
	fi
63
	exit 0
64
}
65
 
66
case "$1" in
67
    restart)
68
	start && success || failure
69
	;;
70
 
71
    start)
72
	start && success || failure
73
	echo
74
	;;
75
 
76
    stop)
77
	stop && success || failure
78
	echo
79
	;;
80
 
81
    status)
82
	status
83
	;;
84
 
85
    *)
86
	echo $"Usage: $0 {start|stop|status|restart}"
87
	exit 3
88
	;;
89
esac