diff options
| -rwxr-xr-x | ezjail.sh | 13 |
1 files changed, 8 insertions, 5 deletions
| @@ -71,7 +71,7 @@ do_cmd() | |||
| 71 | [ "${ezjail_attachblocking}" = "YES" -o "${ezjail_forceblocking}" = "YES" ] && ezjail_blocking="YES" || unset ezjail_blocking | 71 | [ "${ezjail_attachblocking}" = "YES" -o "${ezjail_forceblocking}" = "YES" ] && ezjail_blocking="YES" || unset ezjail_blocking |
| 72 | 72 | ||
| 73 | # Cannot auto mount blocking jails without interrupting boot process | 73 | # Cannot auto mount blocking jails without interrupting boot process |
| 74 | [ "${ezjail_fromrc}" = "YES" -a "${action}" = "start" -a "${ezjail_blocking}" = "YES" ] && continue | 74 | [ "${ezjail_fromrc}" = "YES" -a "${action}" = "start" -a "${ezjail_blocking}" = "YES" ] && echo -n " ...skipping blocking jail ${ezjail}" && continue |
| 75 | 75 | ||
| 76 | # Explicitely do only run blocking crypto jails when *crypto is requested | 76 | # Explicitely do only run blocking crypto jails when *crypto is requested |
| 77 | [ "${action%crypto}" != "${action}" -a -z "${ezjail_blocking}" ] && continue | 77 | [ "${action%crypto}" != "${action}" -a -z "${ezjail_blocking}" ] && continue |
| @@ -93,10 +93,11 @@ do_cmd() | |||
| 93 | 93 | ||
| 94 | attach_detach_pre () | 94 | attach_detach_pre () |
| 95 | { | 95 | { |
| 96 | if [ "${action%crypto}" = "start" ]; then | 96 | case "${action%crypto}" in |
| 97 | start|restart) | ||
| 97 | # If jail is running, do not mount devices, this is the same check as | 98 | # If jail is running, do not mount devices, this is the same check as |
| 98 | # /etc/rc.d/jail does | 99 | # /etc/rc.d/jail does |
| 99 | [ -e /var/run/jail_${ezjail}.id ] && return 1 | 100 | [ -e /var/run/jail_${ezjail}.id ] && return 0 |
| 100 | 101 | ||
| 101 | if [ -L "${ezjail_rootdir}.device" ]; then | 102 | if [ -L "${ezjail_rootdir}.device" ]; then |
| 102 | # Fetch destination of soft link | 103 | # Fetch destination of soft link |
| @@ -143,7 +144,8 @@ attach_detach_pre () | |||
| 143 | # relink image device | 144 | # relink image device |
| 144 | rm -f ${ezjail_rootdir}.device | 145 | rm -f ${ezjail_rootdir}.device |
| 145 | ln -s /dev/${ezjail_device} ${ezjail_rootdir}.device | 146 | ln -s /dev/${ezjail_device} ${ezjail_rootdir}.device |
| 146 | else | 147 | ;; |
| 148 | stop) | ||
| 147 | # If jail is not running, do not unmount devices, this is the same check | 149 | # If jail is not running, do not unmount devices, this is the same check |
| 148 | # as /etc/rc.d/jail does | 150 | # as /etc/rc.d/jail does |
| 149 | [ -e /var/run/jail_${ezjail}.id ] || return 1 | 151 | [ -e /var/run/jail_${ezjail}.id ] || return 1 |
| @@ -163,7 +165,8 @@ attach_detach_pre () | |||
| 163 | 165 | ||
| 164 | # Remove soft link (which acts as a lock) | 166 | # Remove soft link (which acts as a lock) |
| 165 | rm -f ${ezjail_rootdir}.device | 167 | rm -f ${ezjail_rootdir}.device |
| 166 | fi | 168 | ;; |
| 169 | esac | ||
| 167 | } | 170 | } |
| 168 | 171 | ||
| 169 | attach_detach_post () { | 172 | attach_detach_post () { |
