From 8bc4651429e4e75a86df68d8d0bdf333a3331d71 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Sat, 1 Sep 2007 13:10:41 +0000 Subject: rc.d/ezjail.sh restart failed on image jails --- ezjail.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/ezjail.sh b/ezjail.sh index 5394a63..e36f35e 100755 --- a/ezjail.sh +++ b/ezjail.sh @@ -71,7 +71,7 @@ do_cmd() [ "${ezjail_attachblocking}" = "YES" -o "${ezjail_forceblocking}" = "YES" ] && ezjail_blocking="YES" || unset ezjail_blocking # Cannot auto mount blocking jails without interrupting boot process - [ "${ezjail_fromrc}" = "YES" -a "${action}" = "start" -a "${ezjail_blocking}" = "YES" ] && continue + [ "${ezjail_fromrc}" = "YES" -a "${action}" = "start" -a "${ezjail_blocking}" = "YES" ] && echo -n " ...skipping blocking jail ${ezjail}" && continue # Explicitely do only run blocking crypto jails when *crypto is requested [ "${action%crypto}" != "${action}" -a -z "${ezjail_blocking}" ] && continue @@ -93,10 +93,11 @@ do_cmd() attach_detach_pre () { - if [ "${action%crypto}" = "start" ]; then + case "${action%crypto}" in + start|restart) # If jail is running, do not mount devices, this is the same check as # /etc/rc.d/jail does - [ -e /var/run/jail_${ezjail}.id ] && return 1 + [ -e /var/run/jail_${ezjail}.id ] && return 0 if [ -L "${ezjail_rootdir}.device" ]; then # Fetch destination of soft link @@ -143,7 +144,8 @@ attach_detach_pre () # relink image device rm -f ${ezjail_rootdir}.device ln -s /dev/${ezjail_device} ${ezjail_rootdir}.device - else + ;; + stop) # If jail is not running, do not unmount devices, this is the same check # as /etc/rc.d/jail does [ -e /var/run/jail_${ezjail}.id ] || return 1 @@ -163,7 +165,8 @@ attach_detach_pre () # Remove soft link (which acts as a lock) rm -f ${ezjail_rootdir}.device - fi + ;; + esac } attach_detach_post () { -- cgit v1.2.3