mirror of
https://github.com/JRGTH/xigmanas-bastille-extension.git
synced 2025-12-10 17:00:18 +01:00
Make sure minor changes are always applied
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
======================
|
||||
Version Description
|
||||
|
||||
1.2.22......Make sure minor changes are always applied.
|
||||
1.2.21......Check/update bastille config parameters on runtime.
|
||||
1.2.20......Allow install in zroot platform with optional zfs dataset.
|
||||
1.2.19......Fix typo in tarballs page and cleanup, thanks to Lux.
|
||||
@@ -16,7 +17,7 @@ Version Description
|
||||
1.2.11......Add all bastille Linux flavors bootstrap options.
|
||||
1.2.10......Minor code improvements and cleanup.
|
||||
1.2.09......Add Debian keyring and minor code changes.
|
||||
1.2.08......Code cleanup, remove unnecessary statement.
|
||||
1.2.08......Code cleanup, remove unnecessary statement.
|
||||
1.2.07......Minor cosmetic/wording changes.
|
||||
1.2.06......Code changes, symlink bundled files in embedded platforms.
|
||||
1.2.05......Mount unionfs for pkg while fetching debootstrap packages.
|
||||
@@ -151,7 +152,7 @@ Version Description
|
||||
1.0.30......Ability to convert thin jail to thick jail.
|
||||
1.0.29......Added Chinese (Simplified) translation, thanks to lijinbiao.
|
||||
1.0.28......Improve fstab utility error handling.
|
||||
1.0.27......Improved fstab utility, don't allow blank fields.
|
||||
1.0.27......Improved fstab utility, don't allow blank fields.
|
||||
1.0.26......Improved jail IP search during import.
|
||||
1.0.25......Add foreign jail import support, improved fstab utility.
|
||||
1.0.24......Improved Thick container upgrade process.
|
||||
|
||||
35
bastille-init
Normal file → Executable file
35
bastille-init
Normal file → Executable file
@@ -202,7 +202,7 @@ runtime_config()
|
||||
bastille_initial_download()
|
||||
{
|
||||
# Check if bastille already exist.
|
||||
|
||||
|
||||
if [ -n "${REQUIRED_UPDATE}" ] || [ ! -f "${CWDIR}/${FULLAPPNAME}${BASTILLEPATH}/${APPNAME}" ]; then
|
||||
# Fetch latest bastille package.
|
||||
echo "Fetching ${APPNAME} files..."
|
||||
@@ -273,7 +273,7 @@ bastille_upgrade()
|
||||
bastille_core_update()
|
||||
{
|
||||
# Check if bastille already exist.
|
||||
|
||||
|
||||
if [ -f "${CWDIR}/${FULLAPPNAME}${BASTILLEPATH}/${APPNAME}" ]; then
|
||||
# Fetch latest bastille package.
|
||||
echo "Fetching ${APPNAME} files..."
|
||||
@@ -348,7 +348,7 @@ extension_upgrade()
|
||||
echo "* WARNING: System reboot is required when upgrading from v${CURRENTVER_FULL} to v${UPDATEVER_FULL} *"
|
||||
echo "***********************************************************************************"
|
||||
fi
|
||||
# Tell the extension was upgraded.
|
||||
# Tell the extension was upgraded.
|
||||
sysrc -f ${CWDIR}${EXTCONF} EXTENSION_UPGRADED="1" >/dev/null 2>&1
|
||||
else
|
||||
echo "Extension is on the latest version!"
|
||||
@@ -432,7 +432,7 @@ sys_symlinkdir()
|
||||
mkdir -p ${USRLOCAL}/share/licenses
|
||||
fi
|
||||
|
||||
# Required symlinks for bastille.
|
||||
# Required symlinks for bastille.
|
||||
if [ -d "${INSTALLPATH}${USRLOCAL}/share/licenses" ]; then
|
||||
cd ${INSTALLPATH}${USRLOCAL}/share/licenses
|
||||
for file in *
|
||||
@@ -562,7 +562,7 @@ require_once("functions.inc");
|
||||
\$cmd = dirname(__FILE__)."/${SCRIPTNAME}";
|
||||
\$name = "${PRDNAME} Extension";
|
||||
\$comment = "Start ${PRDNAME} Container Manager";
|
||||
\$rc = &array_make_branch(\$config,'rc','param');
|
||||
\$rc = &array_make_branch(\$config,'rc','param');
|
||||
if(false === array_search_ex(\$cmd,\$rc,'cmd')):
|
||||
\$rc_param = [];
|
||||
\$rc_param['uuid'] = uuid();
|
||||
@@ -686,7 +686,7 @@ jail_update()
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -d "${bastille_jailsdir}/${TARGET}" ]; then
|
||||
if [ -d "${bastille_jailsdir}/${TARGET}" ]; then
|
||||
if ! cat "${bastille_jailsdir}/${TARGET}/fstab" 2>/dev/null | grep -w "${TARGET}" | grep -qw "/.*/.bastille"; then
|
||||
if [ -f "${bastille_jailsdir}/${TARGET}/root/COPYRIGHT" ]; then
|
||||
if [ "$(jls name | grep -w "${TARGET}")" ]; then
|
||||
@@ -777,7 +777,7 @@ release_upgrade()
|
||||
|
||||
release_install()
|
||||
{
|
||||
if [ -d "${bastille_releasesdir}/${TARGET}" ]; then
|
||||
if [ -d "${bastille_releasesdir}/${TARGET}" ]; then
|
||||
if [ -f "${bastille_releasesdir}/${TARGET}/COPYRIGHT" ]; then
|
||||
# Finish installing upgrade on a thick container.
|
||||
env PAGER="/bin/cat" ${FREEBSD_UPDATE}/freebsd-update --not-running-from-cron -f ${FREEBSD_UPDATE}/freebsd-update.conf \
|
||||
@@ -876,7 +876,7 @@ thickjail_upgrade()
|
||||
fi
|
||||
|
||||
# Verify for user input and handle some errors.
|
||||
if [ -d "${bastille_jailsdir}/${TARGET}" ]; then
|
||||
if [ -d "${bastille_jailsdir}/${TARGET}" ]; then
|
||||
if ! cat "${bastille_jailsdir}/${TARGET}/fstab" 2>/dev/null | grep -w "${TARGET}" | grep -qw "/.*/.bastille"; then
|
||||
if [ -f "${bastille_jailsdir}/${TARGET}/root/COPYRIGHT" ]; then
|
||||
if [ "$(jls name | grep -w "${TARGET}")" ]; then
|
||||
@@ -932,7 +932,7 @@ thickjail_install()
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -d "${bastille_jailsdir}/${TARGET}" ]; then
|
||||
if [ -d "${bastille_jailsdir}/${TARGET}" ]; then
|
||||
if ! cat "${bastille_jailsdir}/${TARGET}/fstab" 2>/dev/null | grep -w "${TARGET}" | grep -qw "/.*/.bastille"; then
|
||||
if [ -f "${bastille_jailsdir}/${TARGET}/root/COPYRIGHT" ]; then
|
||||
if [ "$(jls name | grep -w "${TARGET}")" ]; then
|
||||
@@ -1011,7 +1011,7 @@ zfs_activate()
|
||||
echo "Synchronizing '${BASTILLE_DIR}' data on new dataset"
|
||||
rsync -a ${CWDIR}.old/ ${CWDIR}/
|
||||
fi
|
||||
else
|
||||
else
|
||||
echo "Bastille ZFS is already configured."
|
||||
fi
|
||||
else
|
||||
@@ -1070,7 +1070,7 @@ reset_install()
|
||||
|
||||
# Reset the extension environment.
|
||||
echo "Removing extension files..."
|
||||
|
||||
|
||||
if [ -f "${CWDIR}/conf/bastille_config" ]; then
|
||||
echo "Backup current extension config file."
|
||||
if [ -f "${CWDIR}/conf/bastille_config.old" ]; then
|
||||
@@ -1226,15 +1226,12 @@ get_versions()
|
||||
|
||||
post_upgrade()
|
||||
{
|
||||
# Check/apply for required/pending updates/fixes if any.
|
||||
# This file will be removed after success execution.
|
||||
if sysrc -f ${CWDIR}${EXTCONF} -qc EXTENSION_UPGRADED=1; then
|
||||
# This function is intended to apply several/temporary changes to the extension once.
|
||||
if sysrc -f ${CWDIR}${EXTCONF} -qc EXTENSION_UPGRADED=1; then
|
||||
if [ -f "${CWDIR}/post_upgrade.sh" ]; then
|
||||
echo "Executing post_upgrade.sh file..."
|
||||
echo "Executing post upgrade file..."
|
||||
chmod +x ${CWDIR}/post_upgrade.sh && ${CWDIR}/post_upgrade.sh
|
||||
sleep 3
|
||||
else
|
||||
echo "No post upgrade changes pending."
|
||||
fi
|
||||
sysrc -f ${CWDIR}${EXTCONF} EXTENSION_UPGRADED="0" >/dev/null 2>&1
|
||||
fi
|
||||
@@ -1543,7 +1540,7 @@ bastille_init()
|
||||
# Check for system compatibility.
|
||||
if [ ! "${PLATFORM}" = "amd64" ]; then
|
||||
echo "Unsupported platform!"; exit 1
|
||||
fi
|
||||
fi
|
||||
# Check for product compatibility.
|
||||
if [ ! "${PRDVERSION}" -ge "112" ]; then
|
||||
echo "Unsupported version!"; exit 1
|
||||
@@ -1591,7 +1588,7 @@ bootstrap_dist()
|
||||
LINUX_FLAVOR="${_linux_flavor}"
|
||||
break
|
||||
fi
|
||||
|
||||
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
@@ -88,8 +88,11 @@ if ($_POST) {
|
||||
ob_start();
|
||||
include("{$logevent}");
|
||||
$ausgabe = ob_get_contents();
|
||||
ob_end_clean();
|
||||
ob_end_clean();
|
||||
$savemsg .= str_replace("\n", "<br />", $ausgabe)."<br />";
|
||||
// Silently execute bastille-init post upgrade for pending changes.
|
||||
// This is to make sure that minor changes are always applied.
|
||||
exec('bastille-init');
|
||||
else:
|
||||
$input_errors[] = gtext('An error has occurred during upgrade process.');
|
||||
$cmd = sprintf('echo %s: %s An error has occurred during upgrade process. >> %s',$date,$application,$logfile);
|
||||
@@ -106,7 +109,7 @@ if ($_POST) {
|
||||
ob_start();
|
||||
include("{$logevent}");
|
||||
$ausgabe = ob_get_contents();
|
||||
ob_end_clean();
|
||||
ob_end_clean();
|
||||
$savemsg .= str_replace("\n", "<br />", $ausgabe)."<br />";
|
||||
else:
|
||||
$input_errors[] = gtext('An error has occurred during core update process.');
|
||||
@@ -122,7 +125,7 @@ if ($_POST) {
|
||||
if (is_link($textdomain_bastille)) mwexec("rm -f {$textdomain_bastille}", true);
|
||||
if (is_dir($confdir)) mwexec("rm -Rf {$confdir}", true);
|
||||
mwexec("rm /usr/local/www/bastille_manager_gui.php && rm -R /usr/local/www/ext/bastille", true);
|
||||
mwexec("{$rootfolder}/usr/local/sbin/bastille-init -t", true);
|
||||
mwexec("{$rootfolder}/usr/local/sbin/bastille-init -t", true);
|
||||
$uninstall_cmd = "echo 'y' | /usr/local/sbin/bastille-init -U";
|
||||
mwexec($uninstall_cmd, true);
|
||||
if (is_link("/usr/local/share/{$prdname}")) mwexec("rm /usr/local/share/{$prdname}", true);
|
||||
@@ -217,7 +220,7 @@ if ($_POST) {
|
||||
ob_start();
|
||||
include("{$logevent}");
|
||||
$ausgabe = ob_get_contents();
|
||||
ob_end_clean();
|
||||
ob_end_clean();
|
||||
$savemsg .= str_replace("\n", "<br />", $ausgabe)."<br />";
|
||||
exec("/usr/sbin/sysrc -f {$configfile} ZFS_ACTIVATED=\"YES\"");
|
||||
else:
|
||||
@@ -243,8 +246,6 @@ if ($_POST) {
|
||||
$savemsg .= gtext("ZFS activation option has been skipped.");
|
||||
endif;
|
||||
endif;
|
||||
# Run bastille-init to update config.
|
||||
exec("bastille-init");
|
||||
}
|
||||
|
||||
if (isset($_POST['restore']) && $_POST['restore']) {
|
||||
|
||||
Reference in New Issue
Block a user