From aeab811b583cd2cf93a3d867f2554895bdd5e1b2 Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Wed, 12 Mar 2025 15:49:44 -0600 Subject: [PATCH] config: Allow setting priority and boot options --- usr/local/share/bastille/config.sh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/usr/local/share/bastille/config.sh b/usr/local/share/bastille/config.sh index a6ff11c5..ce77a62b 100644 --- a/usr/local/share/bastille/config.sh +++ b/usr/local/share/bastille/config.sh @@ -73,7 +73,7 @@ while [ "$#" -gt 0 ]; do esac done -if [ "$#" -lt 1 ] || [ "$#" -gt 3 ]; then +if [ "$#" -lt 1 ] || [ "$#" -gt 4 ]; then usage fi @@ -113,6 +113,24 @@ print_jail_conf() { } for _jail in ${JAILS}; do + +if [ "${PROPERTY}" = "priority" ]; then + FILE="${bastille_jailsdir}/${_jail}/boot.conf" + if echo "${VALUE}" | grep -Eq '^[0-9]+$'; then + info "[${_jail}]:" + sysrc -f "${FILE}" "${PROPERTY}=${VALUE}" + else + error_exit "Priority value must be a number." + fi +elif [ "${PROPERTY}" = "boot" ]; then + FILE="${bastille_jailsdir}/${_jail}/boot.conf" + if [ "${VALUE}" = "on" ] || [ "${VALUE}" = "off" ]; then + info "[${_jail}]:" + sysrc -f "${FILE}" "${PROPERTY}=${VALUE}" + else + error_exit "Boot value must be 'on' or 'off'." + fi +else FILE="${bastille_jailsdir}/${_jail}/jail.conf" if [ ! -f "${FILE}" ]; then error_notify "jail.conf does not exist for jail: ${_jail}" @@ -200,6 +218,7 @@ for _jail in ${JAILS}; do ' "${_tmpfile}" > "${FILE}" rm "${_tmpfile}" fi +fi done # Only display this message once at the end (not for every jail). -- cwells