Add auto/live export modes, add ZST compression.
This update adds auto and live export modes, also adds support for the fast lossless ZSTD compression algorithm.
This commit is contained in:
Executable → Regular
+62
-50
@@ -145,58 +145,62 @@ error_notify()
|
||||
runtime_config()
|
||||
{
|
||||
# Run-time configuration and checks.
|
||||
if [ -f "${INSTALLPATH}/${BASTILLECONF}" ]; then
|
||||
if ! sysrc -f ${BASTILLECONF} -qc bastille_prefix="${CWDIR}"; then
|
||||
sysrc -f ${INSTALLPATH}/${BASTILLECONF} bastille_prefix="${CWDIR}" >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
if [ -d "${INSTALLPATH}" ]; then
|
||||
|
||||
# Check for required directories and files.
|
||||
if [ ! -d "${CWDIR}/backups" ]; then
|
||||
mkdir -p ${CWDIR}/backups
|
||||
fi
|
||||
if [ ! -d "${CWDIR}/conf" ]; then
|
||||
mkdir -p ${CWDIR}/conf
|
||||
fi
|
||||
if [ ! -d "${CWDIR}/log" ]; then
|
||||
mkdir -p ${CWDIR}/log
|
||||
fi
|
||||
if [ ! -d "${CWDIR}/locale-bastille" ]; then
|
||||
mkdir -p ${CWDIR}/locale-bastille
|
||||
fi
|
||||
if [ ! -d "${CWDIR}/freebsd-update" ]; then
|
||||
mkdir ${CWDIR}/freebsd-update
|
||||
fi
|
||||
if [ ! -f "${CWDIR}${BASTILLECONFFILE}" ]; then
|
||||
touch ${CWDIR}${BASTILLECONFFILE}
|
||||
fi
|
||||
if [ ! -d "${CWDIR}/system" ]; then
|
||||
mkdir -p ${CWDIR}/system
|
||||
fi
|
||||
|
||||
# Check for permissions.
|
||||
if [ -f "${FREEBSD_UPDATE}/freebsd-update" ]; then
|
||||
FREEBSD_UPDATE_PERMS=$(stat -f "%Op" ${FREEBSD_UPDATE}/freebsd-update)
|
||||
if [ "${FREEBSD_UPDATE_PERMS}" != 100555 ]; then
|
||||
chmod 0555 ${FREEBSD_UPDATE}/freebsd-update
|
||||
fi
|
||||
fi
|
||||
|
||||
# Workaround to check for host /tmp sane permissions.
|
||||
# This is because after working with Linux jails, this may be changed to 0777 but XigmaNAS wants 1777.
|
||||
if grep -qw '\"chmod\ 777\ /tmp\"' ${INSTALLPATH}/usr/local/share/bastille/create.sh; then
|
||||
sed -i '' 's|\"chmod\ 777\ /tmp\"|\"chmod\ 1777\ /tmp\"|g' ${INSTALLPATH}/usr/local/share/bastille/create.sh
|
||||
else
|
||||
if [ -d "/tmp" ]; then
|
||||
TMP_PERMS=$(stat -f "%Op" "/tmp")
|
||||
if [ "${TMP_PERMS}" != "41777" ]; then
|
||||
chmod 1777 /tmp
|
||||
if [ -f "${INSTALLPATH}/${BASTILLECONF}" ]; then
|
||||
if ! sysrc -f ${BASTILLECONF} -qc bastille_prefix="${CWDIR}"; then
|
||||
sysrc -f ${INSTALLPATH}/${BASTILLECONF} bastille_prefix="${CWDIR}" >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check and append new config parameters.
|
||||
update_config
|
||||
# Check for required directories and files.
|
||||
if [ ! -d "${CWDIR}/backups" ]; then
|
||||
mkdir -p ${CWDIR}/backups
|
||||
fi
|
||||
if [ ! -d "${CWDIR}/conf" ]; then
|
||||
mkdir -p ${CWDIR}/conf
|
||||
fi
|
||||
if [ ! -d "${CWDIR}/log" ]; then
|
||||
mkdir -p ${CWDIR}/log
|
||||
fi
|
||||
if [ ! -d "${CWDIR}/locale-bastille" ]; then
|
||||
mkdir -p ${CWDIR}/locale-bastille
|
||||
fi
|
||||
if [ ! -d "${CWDIR}/freebsd-update" ]; then
|
||||
mkdir ${CWDIR}/freebsd-update
|
||||
fi
|
||||
if [ ! -f "${CWDIR}${BASTILLECONFFILE}" ]; then
|
||||
touch ${CWDIR}${BASTILLECONFFILE}
|
||||
fi
|
||||
if [ ! -d "${CWDIR}/system" ]; then
|
||||
mkdir -p ${CWDIR}/system
|
||||
fi
|
||||
|
||||
# Check for permissions.
|
||||
if [ -f "${FREEBSD_UPDATE}/freebsd-update" ]; then
|
||||
FREEBSD_UPDATE_PERMS=$(stat -f "%Op" ${FREEBSD_UPDATE}/freebsd-update)
|
||||
if [ "${FREEBSD_UPDATE_PERMS}" != 100555 ]; then
|
||||
chmod 0555 ${FREEBSD_UPDATE}/freebsd-update
|
||||
fi
|
||||
fi
|
||||
|
||||
# Workaround to check for host /tmp sane permissions.
|
||||
# This is because after working with Linux jails, this may be changed to 0777 but XigmaNAS wants 1777.
|
||||
if grep -qw '\"chmod\ 777\ /tmp\"' ${INSTALLPATH}/usr/local/share/bastille/create.sh; then
|
||||
sed -i '' 's|\"chmod\ 777\ /tmp\"|\"chmod\ 1777\ /tmp\"|g' ${INSTALLPATH}/usr/local/share/bastille/create.sh
|
||||
else
|
||||
if [ -d "/tmp" ]; then
|
||||
TMP_PERMS=$(stat -f "%Op" "/tmp")
|
||||
if [ "${TMP_PERMS}" != "41777" ]; then
|
||||
chmod 1777 /tmp
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check and append new config parameters.
|
||||
update_config
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
bastille_initial_download()
|
||||
@@ -469,7 +473,7 @@ include_files()
|
||||
sysrc -f ${CWDIR}${EXTCONF} VNET_ENABLE="YES" >/dev/null 2>&1
|
||||
# Include missing system files.
|
||||
# Symlink the files in embedded platforms.
|
||||
USRBIN_FILES="ar diff3 makewhatis setfib sum"
|
||||
USRBIN_FILES="ar diff3 makewhatis setfib sum zstd"
|
||||
USRSBIN_FILES="etcupdate"
|
||||
LOCALBIN_FILES="jib"
|
||||
if [ "${PRDPLATFORM}" = "x64-embedded" ]; then
|
||||
@@ -1042,7 +1046,7 @@ zfs_activate()
|
||||
else
|
||||
error_notify "Invalid ZFS configuration."
|
||||
fi
|
||||
sysrc -f ${CWDIR}${EXTCONF} ZFS_ACTIVATED="YES" >/dev/null 2>&1
|
||||
zfs_support_enabled
|
||||
exit 0
|
||||
}
|
||||
|
||||
@@ -1504,6 +1508,14 @@ update_config()
|
||||
sysrc -f ${INSTALLPATH}/${BASTILLECONF} bastille_template_vlan="default/vlan"
|
||||
fi
|
||||
|
||||
# Compress/Decompress parameters.
|
||||
if ! grep -qw 'bastille_compress_zst_options=' ${INSTALLPATH}/${BASTILLECONF}; then
|
||||
sysrc -f ${INSTALLPATH}/${BASTILLECONF} bastille_compress_zst_options="-3 -v"
|
||||
fi
|
||||
if ! grep -qw 'bastille_decompress_zst_options=' ${INSTALLPATH}/${BASTILLECONF}; then
|
||||
sysrc -f ${INSTALLPATH}/${BASTILLECONF} bastille_decompress_zst_options="-k -d -c -v"
|
||||
fi
|
||||
|
||||
# Remove deprecated parameters based on minimum version.
|
||||
if grep -qw 'bastille_jail_interface' ${INSTALLPATH}/${BASTILLECONF}; then
|
||||
sysrc -f ${INSTALLPATH}/${BASTILLECONF} -x bastille_jail_interface
|
||||
|
||||
Reference in New Issue
Block a user