Update extension and bastille config files at once

This commit is contained in:
Jose
2020-07-17 05:39:48 -04:00
parent 07f3a1aa5a
commit c2b74495d9
4 changed files with 17 additions and 8 deletions

View File

@@ -3,6 +3,7 @@
======================
Version Description
1.0.66......Update extension and bastille config files at once.
1.0.65......Add ability to create empty containers, minor improvements.
1.0.64......Switch back to official bastille repository, simplify initial help banner.
1.0.63......Always apply required updates after platform check.

View File

@@ -46,6 +46,7 @@ $confdir = "/var/etc/bastille_conf";
$cwdir = exec("/usr/bin/grep 'INSTALL_DIR=' $confdir/conf/bastille_config | /usr/bin/cut -d'\"' -f2");
$rootfolder = $cwdir;
$configfile = "$rootfolder/conf/bastille_config";
$configfile_bastille = "$rootfolder/bastille-dist/usr/local/etc/bastille/bastille.conf";
$versionfile = "$rootfolder/version";
$date = strftime('%c');
$logfile = "$rootfolder/log/bastille_ext.log";

View File

@@ -74,6 +74,7 @@ $tarballversion = "/usr/local/bin/bastille";
if ($_POST) {
global $zfs_activated;
global $backup_path_bastille;
global $configfile_bastille;
if(isset($_POST['upgrade']) && $_POST['upgrade']):
$cmd = sprintf('%1$s/bastille-init -u > %2$s',$rootfolder,$logevent);
$return_val = 0;
@@ -150,12 +151,19 @@ if ($_POST) {
}
if (!is_file($backup_path)) {
if($backup_path_bastille !== $backup_path):
$errormsg = gtext('Selected backup path does not match with bastille_backupsdir in bastille.conf.')
. ' '
. '<a href="' . 'bastille_manager_config.php' . '">'
. gtext('Please set the bastille_backupsdir in bastille.conf first.')
. '</a>';
else:
// Update bastille config if required.
$cmd = "/usr/sbin/sysrc -f {$configfile_bastille} bastille_backupsdir={$backup_path}";
unset($retval);mwexec($cmd,$retval);
if ($retval == 0) {
$savemsg .= gtext("Bastille config updated successfully.");
exec("echo '{$date}: {$application}: Bastille config updated successfully' >> {$logfile}");
}
else {
$input_errors[] = gtext("Failed to update Bastille config.");
exec("echo '{$date}: {$application}: Failed to update Bastille config' >> {$logfile}");
}
endif;
// Update extension config.
$cmd = "/usr/sbin/sysrc -f {$configfile} BACKUP_DIR={$backup_path}";
unset($retval);mwexec($cmd,$retval);
if ($retval == 0) {
@@ -166,7 +174,6 @@ if ($_POST) {
$input_errors[] = gtext("Failed to save extension settings.");
exec("echo '{$date}: {$application}: Failed to save extension settings' >> {$logfile}");
}
endif;
}
else {
$input_errors[] = gtext("Failed to save extension settings.");

View File

@@ -1 +1 @@
1.0.65
1.0.66