Update extension and bastille config files at once
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
======================
|
======================
|
||||||
Version Description
|
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.65......Add ability to create empty containers, minor improvements.
|
||||||
1.0.64......Switch back to official bastille repository, simplify initial help banner.
|
1.0.64......Switch back to official bastille repository, simplify initial help banner.
|
||||||
1.0.63......Always apply required updates after platform check.
|
1.0.63......Always apply required updates after platform check.
|
||||||
|
|||||||
@@ -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");
|
$cwdir = exec("/usr/bin/grep 'INSTALL_DIR=' $confdir/conf/bastille_config | /usr/bin/cut -d'\"' -f2");
|
||||||
$rootfolder = $cwdir;
|
$rootfolder = $cwdir;
|
||||||
$configfile = "$rootfolder/conf/bastille_config";
|
$configfile = "$rootfolder/conf/bastille_config";
|
||||||
|
$configfile_bastille = "$rootfolder/bastille-dist/usr/local/etc/bastille/bastille.conf";
|
||||||
$versionfile = "$rootfolder/version";
|
$versionfile = "$rootfolder/version";
|
||||||
$date = strftime('%c');
|
$date = strftime('%c');
|
||||||
$logfile = "$rootfolder/log/bastille_ext.log";
|
$logfile = "$rootfolder/log/bastille_ext.log";
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ $tarballversion = "/usr/local/bin/bastille";
|
|||||||
if ($_POST) {
|
if ($_POST) {
|
||||||
global $zfs_activated;
|
global $zfs_activated;
|
||||||
global $backup_path_bastille;
|
global $backup_path_bastille;
|
||||||
|
global $configfile_bastille;
|
||||||
if(isset($_POST['upgrade']) && $_POST['upgrade']):
|
if(isset($_POST['upgrade']) && $_POST['upgrade']):
|
||||||
$cmd = sprintf('%1$s/bastille-init -u > %2$s',$rootfolder,$logevent);
|
$cmd = sprintf('%1$s/bastille-init -u > %2$s',$rootfolder,$logevent);
|
||||||
$return_val = 0;
|
$return_val = 0;
|
||||||
@@ -150,12 +151,19 @@ if ($_POST) {
|
|||||||
}
|
}
|
||||||
if (!is_file($backup_path)) {
|
if (!is_file($backup_path)) {
|
||||||
if($backup_path_bastille !== $backup_path):
|
if($backup_path_bastille !== $backup_path):
|
||||||
$errormsg = gtext('Selected backup path does not match with bastille_backupsdir in bastille.conf.')
|
// Update bastille config if required.
|
||||||
. ' '
|
$cmd = "/usr/sbin/sysrc -f {$configfile_bastille} bastille_backupsdir={$backup_path}";
|
||||||
. '<a href="' . 'bastille_manager_config.php' . '">'
|
unset($retval);mwexec($cmd,$retval);
|
||||||
. gtext('Please set the bastille_backupsdir in bastille.conf first.')
|
if ($retval == 0) {
|
||||||
. '</a>';
|
$savemsg .= gtext("Bastille config updated successfully.");
|
||||||
else:
|
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}";
|
$cmd = "/usr/sbin/sysrc -f {$configfile} BACKUP_DIR={$backup_path}";
|
||||||
unset($retval);mwexec($cmd,$retval);
|
unset($retval);mwexec($cmd,$retval);
|
||||||
if ($retval == 0) {
|
if ($retval == 0) {
|
||||||
@@ -166,7 +174,6 @@ if ($_POST) {
|
|||||||
$input_errors[] = gtext("Failed to save extension settings.");
|
$input_errors[] = gtext("Failed to save extension settings.");
|
||||||
exec("echo '{$date}: {$application}: Failed to save extension settings' >> {$logfile}");
|
exec("echo '{$date}: {$application}: Failed to save extension settings' >> {$logfile}");
|
||||||
}
|
}
|
||||||
endif;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$input_errors[] = gtext("Failed to save extension settings.");
|
$input_errors[] = gtext("Failed to save extension settings.");
|
||||||
|
|||||||
Reference in New Issue
Block a user