mirror of
https://github.com/hackacad/bastille.git
synced 2025-12-24 11:12:12 +01:00
Add -b|--boot for start/stop/restart
This commit is contained in:
@@ -46,6 +46,7 @@ usage() {
|
||||
-E | --empty Creates an empty container, intended for custom jail builds (thin/thick/linux or unsupported).
|
||||
-L | --linux This option is intended for testing with Linux jails, this is considered experimental.
|
||||
-M | --static-mac Generate a static MAC address for jail (VNET only).
|
||||
--no-boot Create jail with boot=off.
|
||||
--no-validate Do not validate the release when creating the jail.
|
||||
-p | --priority VALUE Sets the priority value for jail startup and shutdown.
|
||||
-T | --thick Creates a thick container, they consume more space as they are self contained and independent.
|
||||
@@ -657,7 +658,7 @@ create_jail() {
|
||||
fi
|
||||
|
||||
# Apply priority and boot settings
|
||||
sysrc -f "${bastille_jailsdir}/${NAME}/boot.conf" boot=on
|
||||
sysrc -f "${bastille_jailsdir}/${NAME}/boot.conf" boot=${BOOT}
|
||||
sysrc -f "${bastille_jailsdir}/${NAME}/boot.conf" priority="${PRIORITY}"
|
||||
}
|
||||
|
||||
@@ -671,6 +672,7 @@ if echo "${3}" | grep '@'; then
|
||||
fi
|
||||
|
||||
# Handle options.
|
||||
BOOT="on"
|
||||
EMPTY_JAIL=""
|
||||
THICK_JAIL=""
|
||||
CLONE_JAIL=""
|
||||
@@ -719,6 +721,10 @@ while [ $# -gt 0 ]; do
|
||||
error_exit "Not a valid priority value: \"${2}\""
|
||||
fi
|
||||
;;
|
||||
--no-boot)
|
||||
BOOT="off"
|
||||
shift
|
||||
;;
|
||||
--no-validate|no-validate)
|
||||
VALIDATE_RELEASE=""
|
||||
shift
|
||||
|
||||
@@ -30,5 +30,25 @@
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
usage() {
|
||||
error_notify "Usage: bastille restart [option(s)] TARGET"
|
||||
cat << EOF
|
||||
Options:
|
||||
|
||||
-b | --boot Respect jail boot setting.
|
||||
-v | --verbose Print every action on jail start.
|
||||
-x | --debug Enable debug mode.
|
||||
|
||||
EOF
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Handle options.
|
||||
case "${1}" in
|
||||
-h|--help|help)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
|
||||
bastille stop "$@"
|
||||
bastille start "$@"
|
||||
|
||||
@@ -38,20 +38,26 @@ usage() {
|
||||
cat << EOF
|
||||
Options:
|
||||
|
||||
-v | --verbose Print every action on jail start.
|
||||
-x | --debug Enable debug mode.
|
||||
-b | --boot Respect jail boot setting.
|
||||
-v | --verbose Print every action on jail start.
|
||||
-x | --debug Enable debug mode.
|
||||
|
||||
EOF
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Handle options.
|
||||
BOOT=0
|
||||
OPTION=""
|
||||
while [ "$#" -gt 0 ]; do
|
||||
case "${1}" in
|
||||
-h|--help|help)
|
||||
usage
|
||||
;;
|
||||
-b|--boot)
|
||||
BOOT=1
|
||||
shift
|
||||
;;
|
||||
-v|--verbose)
|
||||
OPTION="-v"
|
||||
shift
|
||||
@@ -63,6 +69,7 @@ while [ "$#" -gt 0 ]; do
|
||||
-*)
|
||||
for _opt in $(echo ${1} | sed 's/-//g' | fold -w1); do
|
||||
case ${_opt} in
|
||||
b) BOOT=1 ;;
|
||||
v) OPTION="-v" ;;
|
||||
x) enable_debug ;;
|
||||
*) error_exit "Unknown Option: \"${1}\"" ;;
|
||||
@@ -87,6 +94,14 @@ set_target "${TARGET}"
|
||||
|
||||
for _jail in ${JAILS}; do
|
||||
|
||||
# Continue if '-b|--boot' is set and 'boot=off'
|
||||
if [ "${BOOT}" -eq 1 ]; then
|
||||
BOOT_ENABLED="$(sysrc -f ${bastille_jailsdir}/${_jail}/boot.conf -n boot)"
|
||||
if [ "${BOOT_ENABLED}" = "off" ]; then
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
|
||||
info "[${_jail}]:"
|
||||
check_target_is_stopped "${_jail}" || error_continue "Jail is already running."
|
||||
|
||||
|
||||
@@ -38,20 +38,26 @@ usage() {
|
||||
cat << EOF
|
||||
Options:
|
||||
|
||||
-v | --verbose Print every action on jail stop.
|
||||
-x | --debug Enable debug mode.
|
||||
-b | --boot Respect jail boot setting.
|
||||
-v | --verbose Print every action on jail stop.
|
||||
-x | --debug Enable debug mode.
|
||||
|
||||
EOF
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Handle options.
|
||||
BOOT=0
|
||||
OPTION=""
|
||||
while [ "$#" -gt 0 ]; do
|
||||
case "${1}" in
|
||||
-h|--help|help)
|
||||
usage
|
||||
;;
|
||||
-b|--boot)
|
||||
BOOT=1
|
||||
shift
|
||||
;;
|
||||
-v|--verbose)
|
||||
OPTION="-v"
|
||||
shift
|
||||
@@ -63,6 +69,7 @@ while [ "$#" -gt 0 ]; do
|
||||
-*)
|
||||
for _opt in $(echo ${1} | sed 's/-//g' | fold -w1); do
|
||||
case ${_opt} in
|
||||
b) BOOT="1" ;;
|
||||
v) OPTION="-v" ;;
|
||||
x) enable_debug ;;
|
||||
*) error_exit "Unknown Option: \"${1}\"" ;;
|
||||
@@ -87,6 +94,14 @@ set_target "${TARGET}"
|
||||
|
||||
for _jail in ${JAILS}; do
|
||||
|
||||
# Continue if '-b|--boot' is set and 'boot=off'
|
||||
if [ "${BOOT}" -eq 1 ]; then
|
||||
BOOT_ENABLED="$(sysrc -f ${bastille_jailsdir}/${_jail}/boot.conf -n boot)"
|
||||
if [ "${BOOT_ENABLED}" = "off" ]; then
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
|
||||
info "[${_jail}]:"
|
||||
check_target_is_running "${_jail}" || error_continue "Jail is already stopped."
|
||||
|
||||
|
||||
Reference in New Issue
Block a user