Quick update to support bastille 0.9.x
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
======================
|
======================
|
||||||
Version Description
|
Version Description
|
||||||
|
|
||||||
|
1.0.93......Quick update to support bastille 0.9.x.
|
||||||
1.0.92......Set file permissions.
|
1.0.92......Set file permissions.
|
||||||
1.0.91......Add required files from FreeBSD 13.0 base release, update config.
|
1.0.91......Add required files from FreeBSD 13.0 base release, update config.
|
||||||
1.0.90......Update release list, fix bug in tarballs page.
|
1.0.90......Update release list, fix bug in tarballs page.
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ require_once 'system.inc';
|
|||||||
// internal PHP functions rather than external shell commands.
|
// internal PHP functions rather than external shell commands.
|
||||||
|
|
||||||
//$rootfolder = dirname($config['rc']['postinit']['cmd'][$i]);
|
//$rootfolder = dirname($config['rc']['postinit']['cmd'][$i]);
|
||||||
|
$prdname = "bastille";
|
||||||
$application = "Bastille Manager";
|
$application = "Bastille Manager";
|
||||||
$restore_name = "restore";
|
$restore_name = "restore";
|
||||||
$confdir = "/var/etc/bastille_conf";
|
$confdir = "/var/etc/bastille_conf";
|
||||||
@@ -62,6 +63,7 @@ $reldir = "{$rootfolder}/releases";
|
|||||||
$backup_path_bastille = exec("/usr/sbin/sysrc -f $rootfolder/bastille-dist/usr/local/etc/bastille/bastille.conf -qn bastille_backupsdir");
|
$backup_path_bastille = exec("/usr/sbin/sysrc -f $rootfolder/bastille-dist/usr/local/etc/bastille/bastille.conf -qn bastille_backupsdir");
|
||||||
$zfs_support = exec("/usr/bin/grep 'ZFS_SUPPORT=' $configfile | /usr/bin/cut -d'\"' -f2");
|
$zfs_support = exec("/usr/bin/grep 'ZFS_SUPPORT=' $configfile | /usr/bin/cut -d'\"' -f2");
|
||||||
$zfs_activated = exec("/usr/bin/grep 'ZFS_ACTIVATED=' $configfile | /usr/bin/cut -d'\"' -f2");
|
$zfs_activated = exec("/usr/bin/grep 'ZFS_ACTIVATED=' $configfile | /usr/bin/cut -d'\"' -f2");
|
||||||
|
$tarballversion = "/usr/local/bin/bastille";
|
||||||
|
|
||||||
// Ensure the root directory is configured.
|
// Ensure the root directory is configured.
|
||||||
if ($rootfolder == "")
|
if ($rootfolder == "")
|
||||||
@@ -81,6 +83,20 @@ function is_dir_empty($reldir) {
|
|||||||
return (count(scandir($reldir)) == 2);
|
return (count(scandir($reldir)) == 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get bastille version
|
||||||
|
function get_version_bastille() {
|
||||||
|
global $tarballversion, $prdname;
|
||||||
|
if (is_file("{$tarballversion}")) {
|
||||||
|
//exec("/bin/cat {$tarballversion}", $result);
|
||||||
|
exec("/usr/bin/grep 'BASTILLE_VERSION=' {$tarballversion} | cut -d'\"' -f2", $result);
|
||||||
|
return ($result[0]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
exec("/usr/local/bin/{$prdname} version | awk 'NR==1'", $result);
|
||||||
|
return ($result[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Initial install banner
|
// Initial install banner
|
||||||
function initial_install_banner() {
|
function initial_install_banner() {
|
||||||
// Never display this if bastille is already bootstraped/activated.
|
// Never display this if bastille is already bootstraped/activated.
|
||||||
|
|||||||
@@ -68,9 +68,6 @@ if (1 == mwexec("/bin/cat {$configfile} | /usr/bin/grep 'BACKUP_DIR='")) {
|
|||||||
}
|
}
|
||||||
$backup_path = exec("/bin/cat {$configfile} | /usr/bin/grep 'BACKUP_DIR=' | cut -d'\"' -f2");
|
$backup_path = exec("/bin/cat {$configfile} | /usr/bin/grep 'BACKUP_DIR=' | cut -d'\"' -f2");
|
||||||
|
|
||||||
$prdname = "bastille";
|
|
||||||
$tarballversion = "/usr/local/bin/bastille";
|
|
||||||
|
|
||||||
if ($_POST) {
|
if ($_POST) {
|
||||||
global $zfs_activated;
|
global $zfs_activated;
|
||||||
global $backup_path_bastille;
|
global $backup_path_bastille;
|
||||||
@@ -189,6 +186,7 @@ if ($_POST) {
|
|||||||
$output = [];
|
$output = [];
|
||||||
exec($cmd,$output,$return_val);
|
exec($cmd,$output,$return_val);
|
||||||
if($return_val == 0):
|
if($return_val == 0):
|
||||||
|
unset ($errormsg);
|
||||||
ob_start();
|
ob_start();
|
||||||
include("{$logevent}");
|
include("{$logevent}");
|
||||||
$ausgabe = ob_get_contents();
|
$ausgabe = ob_get_contents();
|
||||||
@@ -254,19 +252,6 @@ if ($_POST) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_version_bastille() {
|
|
||||||
global $tarballversion, $prdname;
|
|
||||||
if (is_file("{$tarballversion}")) {
|
|
||||||
//exec("/bin/cat {$tarballversion}", $result);
|
|
||||||
exec("/usr/bin/grep 'BASTILLE_VERSION=' {$tarballversion} | cut -d'\"' -f2", $result);
|
|
||||||
return ($result[0]);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
exec("/usr/local/bin/{$prdname} version | awk 'NR==1'", $result);
|
|
||||||
return ($result[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_version_ext() {
|
function get_version_ext() {
|
||||||
global $versionfile;
|
global $versionfile;
|
||||||
exec("/bin/cat {$versionfile}", $result);
|
exec("/bin/cat {$versionfile}", $result);
|
||||||
|
|||||||
@@ -112,7 +112,23 @@ if($_POST):
|
|||||||
$container['jailname'] = $_POST['jailname'];
|
$container['jailname'] = $_POST['jailname'];
|
||||||
$confirm_name = $pconfig['confirmname'];
|
$confirm_name = $pconfig['confirmname'];
|
||||||
$item = $container['jailname'];
|
$item = $container['jailname'];
|
||||||
$cmd = ("/usr/local/bin/bastille export '{$item}'");
|
$bastille_version = get_version_bastille();
|
||||||
|
$bastille_version_min = "0920210714";
|
||||||
|
$bastille_version_format = str_replace(".", "", $bastille_version);
|
||||||
|
$bastille_bin_path = "/usr/local/bin";
|
||||||
|
|
||||||
|
if($bastille_version_format >= $bastille_version_min):
|
||||||
|
if ($zfs_activated == "YES"):
|
||||||
|
$export_format = "--xz";
|
||||||
|
$cmd = ("$bastille_bin_path/bastille export $export_format '{$item}'");
|
||||||
|
else:
|
||||||
|
$export_format = "--txz";
|
||||||
|
$cmd = ("$bastille_bin_path/bastille export $export_format '{$item}'");
|
||||||
|
endif;
|
||||||
|
else:
|
||||||
|
$cmd = ("$bastille_bin_path/bastille export '{$item}'");
|
||||||
|
endif;
|
||||||
|
|
||||||
unset($output,$retval);mwexec2($cmd,$output,$retval);
|
unset($output,$retval);mwexec2($cmd,$output,$retval);
|
||||||
if($retval == 0):
|
if($retval == 0):
|
||||||
$savemsg .= gtext("Container backup process completed successfully.");
|
$savemsg .= gtext("Container backup process completed successfully.");
|
||||||
@@ -120,7 +136,7 @@ if($_POST):
|
|||||||
//header('Location: bastille_manager_gui.php');
|
//header('Location: bastille_manager_gui.php');
|
||||||
//exit;
|
//exit;
|
||||||
else:
|
else:
|
||||||
$input_errors[] = gtext("Failed to backup container.");
|
$input_errors[] = gtext("Failed to backup container, please stop [{$item}] before backup.");
|
||||||
exec("echo '{$date}: {$application}: Failed to backup container {$item}' >> {$logfile}");
|
exec("echo '{$date}: {$application}: Failed to backup container {$item}' >> {$logfile}");
|
||||||
endif;
|
endif;
|
||||||
endif;
|
endif;
|
||||||
|
|||||||
Reference in New Issue
Block a user