summaryrefslogtreecommitdiff
path: root/ezjail.sh
blob: de226c7732850173d9eb98c0d6bcc35823b94730 (plain)
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/sh

# $FreeBSD$
#
# PROVIDE: ezjail
#
# Note: Add the following lines to /etc/rc.conf to enable ezjail,
#
#ezjail_enable="YES"
#
# Please do not change this file, configure in EZJAIL_PREFIX/etc/ezjail.conf

# ugly: this variable is set on port install time
ezjail_prefix=EZJAIL_PREFIX

. /etc/rc.subr

name=ezjail
rcvar=`set_rcvar`
load_rc_config $name

ezjail_enable=${ezjail_enable:-"NO"}

restart_cmd="do_restart"
start_cmd="do_start"
stop_cmd="do_stop"

do_start()
{
  [ -n "$*" ] && jail_list=`echo $* | tr /~. ___` || echo " ezjail"
  jail_list=${jail_list:-`ls ${ezjail_prefix}/etc/ezjail/`}
  for jail in $jail_list; do . ${ezjail_prefix}/etc/ezjail/${jail}; done
  sh /etc/rc.d/jail onestart $jail_list
}

do_restart()
{
  [ -n "$*" ] && jail_list=`echo $* | tr /~. ___`;
  jail_list=${jail_list:-`ls ${ezjail_prefix}/etc/ezjail/`}
  for jail in $jail_list; do . ${ezjail_prefix}/etc/ezjail/${jail}; done
  sh /etc/rc.d/jail onestop $jail_list
  sh /etc/rc.d/jail onestart $jail_list
}

do_stop()
{
  [ -n "$*" ] && jail_list=`echo $* | tr /~. ___` || echo " ezjail"
  jail_list=${jail_list:-`ls ${ezjail_prefix}/etc/ezjail/`}
  for jail in $jail_list; do . ${ezjail_prefix}/etc/ezjail/${jail}; done
  sh /etc/rc.d/jail onestop $jail_list
}

run_rc_command $*