diff options
Diffstat (limited to 'ezjail.sh')
-rwxr-xr-x | ezjail.sh | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/ezjail.sh b/ezjail.sh new file mode 100755 index 0000000..9e59dc2 --- /dev/null +++ b/ezjail.sh | |||
@@ -0,0 +1,53 @@ | |||
1 | #/bin/sh | ||
2 | |||
3 | # $FreeBSD$ | ||
4 | # | ||
5 | # PROVIDE: ezjail | ||
6 | # | ||
7 | # Note: Add the following lines to $PREFIX/etc/rc.conf to enable ezjail, | ||
8 | # | ||
9 | #ezjail_enable="YES" | ||
10 | # | ||
11 | # Please do not change this file, configure in $PREFIX/etc/ezjail.conf | ||
12 | |||
13 | # ugly: this variable will be set on port install time | ||
14 | ezjail_prefix=EZJAIL_PREFIX | ||
15 | |||
16 | . /etc/rc.subr | ||
17 | |||
18 | name=ezjail | ||
19 | rcvar=`set_rcvar` | ||
20 | load_rc_config $name | ||
21 | |||
22 | ezjail_enable=${ezjail_enable:-"NO"} | ||
23 | |||
24 | restart_cmd="do_restart" | ||
25 | start_cmd="do_start" | ||
26 | stop_cmd="do_stop" | ||
27 | |||
28 | do_start() | ||
29 | { | ||
30 | [ -n "$*" ] && jail_list=`echo $* | tr /~. ___` || echo " ezjail" | ||
31 | jail_list=${jail_list:-`ls ${ezjail_prefix}/etc/ezjail/`} | ||
32 | for jail in $jail_list; do . ${ezjail_prefix}/etc/ezjail/${jail}; done | ||
33 | sh /etc/rc.d/jail onestart $jail_list | ||
34 | } | ||
35 | |||
36 | do_restart() | ||
37 | { | ||
38 | [ -n "$*" ] && jail_list=`echo $* | tr /~. ___`; | ||
39 | jail_list=${jail_list:-`ls ${ezjail_prefix}/etc/ezjail/`} | ||
40 | for jail in $jail_list; do . ${ezjail_prefix}/etc/ezjail/${jail}; done | ||
41 | sh /etc/rc.d/jail onestop $jail_list | ||
42 | sh /etc/rc.d/jail onestart $jail_list | ||
43 | } | ||
44 | |||
45 | do_stop() | ||
46 | { | ||
47 | [ -n "$*" ] && jail_list=`echo $* | tr /~. ___` || echo " ezjail" | ||
48 | jail_list=${jail_list:-`ls ${ezjail_prefix}/etc/ezjail/`} | ||
49 | for jail in $jail_list; do . ${ezjail_prefix}/etc/ezjail/${jail}; done | ||
50 | sh /etc/rc.d/jail onestop $jail_list | ||
51 | } | ||
52 | |||
53 | run_rc_command $* | ||