mirror of
https://github.com/hackacad/bastille.git
synced 2025-12-18 00:00:40 +01:00
boot file to settings file change
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user