bkctld-update: start jail after upgrade if it was started before

This commit is contained in:
Jérémy Lecour 2020-07-09 17:14:49 +02:00 committed by Jérémy Lecour
parent 049bdb9216
commit d07b493131
2 changed files with 19 additions and 1 deletions

View File

@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
* bkctld-update: start jail after upgrade if it was started before
### Deprecated
### Removed

View File

@ -15,8 +15,24 @@ jail_path=$(jail_path "${jail_name}")
test -d "${jail_path}" || error "${jail_name}: jail not found" 2
"${LIBDIR}/bkctld-is-on" "${jail_name}" && "${LIBDIR}/bkctld-stop" "${jail_name}"
"${LIBDIR}/bkctld-is-on" "${jail_name}" 2>/dev/null
case "$?" in
0)
jail_initial_status="on"
;;
100)
jail_initial_status="off"
;;
*)
unset jail_initial_status
error "Error evaluating jail \`${jail_name}' state. bkctld-is-on exited with \`$?'"
;;
esac
test "${jail_initial_status}" = "on" && "${LIBDIR}/bkctld-stop" "${jail_name}"
setup_jail_chroot "${jail_name}"
test "${jail_initial_status}" = "on" && "${LIBDIR}/bkctld-start" "${jail_name}"
notice "Update jail \`${jail_name}' : OK"