From deacd775e56e507f2cb29556a2252655f3a840b4 Mon Sep 17 00:00:00 2001 From: tschettervictor Date: Fri, 2 May 2025 10:27:00 -0600 Subject: [PATCH] boot file to settings file change --- usr/local/share/bastille/common.sh | 17 +++++++++++------ usr/local/share/bastille/config.sh | 4 ++-- usr/local/share/bastille/create.sh | 4 ++-- usr/local/share/bastille/list.sh | 4 ++-- usr/local/share/bastille/start.sh | 2 +- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/usr/local/share/bastille/common.sh b/usr/local/share/bastille/common.sh index 4b751c65..fee08310 100644 --- a/usr/local/share/bastille/common.sh +++ b/usr/local/share/bastille/common.sh @@ -171,13 +171,18 @@ list_jail_priority() { local _jail_list="${1}" if [ -d "${bastille_jailsdir}" ]; then for _jail in ${_jail_list}; do - local _boot_file=${bastille_jailsdir}/${_jail}/boot.conf - # Set defaults if boot file does not exist - if [ ! -f ${_boot_file} ]; then - sysrc -f ${_boot_file} boot=on > /dev/null 2>&1 - sysrc -f ${_boot_file} priority=99 > /dev/null 2>&1 + # Remove boot.conf in favor of settings.conf + if [ -f ${bastille_jailsdir}/${_jail}/boot.conf ]; then + rm -f ${bastille_jailsdir}/${_jail}/boot.conf >/dev/null 2>&1 fi - _priority="$(sysrc -f ${bastille_jailsdir}/${_jail}/boot.conf -n priority)" + local _settings_file=${bastille_jailsdir}/${_jail}/settings.conf + # Set defaults if settings file does not exist + if [ ! -f ${_settings_file} ]; then + sysrc -f ${_settings_file} boot=on >/dev/null 2>&1 + sysrc -f ${_settings_file} depend="" >/dev/null 2>&1 + sysrc -f ${_settings_file} priority=99 >/dev/null 2>&1 + fi + _priority="$(sysrc -f ${_settings_file} -n priority)" echo "${_jail} ${_priority}" done fi diff --git a/usr/local/share/bastille/config.sh b/usr/local/share/bastille/config.sh index fd5a18ee..d8c8b7c7 100644 --- a/usr/local/share/bastille/config.sh +++ b/usr/local/share/bastille/config.sh @@ -122,7 +122,7 @@ for _jail in ${JAILS}; do PROPERTY="priority" BASTILLE_PROPERTY=1 - FILE="${bastille_jailsdir}/${_jail}/boot.conf" + FILE="${bastille_jailsdir}/${_jail}/settings.conf" if [ "${ACTION}" = "set" ]; then if echo "${VALUE}" | grep -Eq '^[0-9]+$'; then @@ -140,7 +140,7 @@ for _jail in ${JAILS}; do elif [ "${PROPERTY}" = "boot" ]; then BASTILLE_PROPERTY=1 - FILE="${bastille_jailsdir}/${_jail}/boot.conf" + FILE="${bastille_jailsdir}/${_jail}/settings.conf" if [ "${ACTION}" = "set" ]; then if [ "${VALUE}" = "on" ] || [ "${VALUE}" = "off" ]; then diff --git a/usr/local/share/bastille/create.sh b/usr/local/share/bastille/create.sh index cf2500a8..35f879b9 100644 --- a/usr/local/share/bastille/create.sh +++ b/usr/local/share/bastille/create.sh @@ -577,9 +577,9 @@ create_jail() { chmod 0700 "${bastille_jailsdir}/${NAME}" # Apply boot, depends and priority settings before starting jail - sysrc -f "${bastille_jailsdir}/${NAME}/boot.conf" boot=${BOOT} >/dev/null + sysrc -f "${bastille_jailsdir}/${NAME}/settings.conf" boot=${BOOT} >/dev/null sysrc -f "${bastille_jailsdir}/${NAME}/settings.conf" depend="" >/dev/null - sysrc -f "${bastille_jailsdir}/${NAME}/boot.conf" priority="${PRIORITY}" >/dev/null + sysrc -f "${bastille_jailsdir}/${NAME}/settings.conf" priority="${PRIORITY}" >/dev/null # Jail must be started before applying the default template. -- cwells if [ -z "${EMPTY_JAIL}" ]; then diff --git a/usr/local/share/bastille/list.sh b/usr/local/share/bastille/list.sh index 46d31ef4..92214d84 100644 --- a/usr/local/share/bastille/list.sh +++ b/usr/local/share/bastille/list.sh @@ -141,8 +141,8 @@ get_jail_info() { JAIL_TAGS="$(bastille tags ${JAIL_NAME} list | sed 's/.*: //g' | sed 's/ /,/g')" # Get boot and priority value using 'bastille config' - BOOT="$(sysrc -f ${bastille_jailsdir}/${JAIL_NAME}/boot.conf -n boot)" - PRIORITY="$(sysrc -f ${bastille_jailsdir}/${JAIL_NAME}/boot.conf -n priority)" + BOOT="$(sysrc -f ${bastille_jailsdir}/${JAIL_NAME}/settings.conf -n boot)" + PRIORITY="$(sysrc -f ${bastille_jailsdir}/${JAIL_NAME}/settings.conf -n priority)" # Check if jail is FreeBSD or Linux IS_FREEBSD_JAIL=0 diff --git a/usr/local/share/bastille/start.sh b/usr/local/share/bastille/start.sh index 6966c321..0389e370 100644 --- a/usr/local/share/bastille/start.sh +++ b/usr/local/share/bastille/start.sh @@ -106,7 +106,7 @@ 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)" + BOOT_ENABLED="$(sysrc -f ${bastille_jailsdir}/${_jail}/settings.conf -n boot)" if [ "${BOOT_ENABLED}" = "off" ]; then continue fi