Use bastille built-in export/import functions

This commit is contained in:
Jose
2020-02-09 09:20:14 -04:00
parent cd5f6ae917
commit a8e881b23c
5 changed files with 6 additions and 107 deletions
+2 -2
View File
@@ -153,7 +153,7 @@ if ($_POST) {
// Ensure to have NO whitespace & trailing slash.
$backup_file = rtrim(trim($_POST['backup_path']),'/');
$filename_trim = exec("echo {$backup_file} | awk '{print $1}' | grep -o '[^/]*$'");
$jailname_trim = exec("echo {$backup_file} | awk '{print $1}' | grep -o '[^/]*$' | cut -d '-' -f1");
$jailname_trim = exec("echo {$backup_file} | awk '{print $1}' | grep -o '[^/]*$' | cut -d '_' -f1");
if ("{$backup_file}" == "") {
$input_errors[] = gtext("Error: backup file undefined.");
@@ -163,7 +163,7 @@ if ($_POST) {
$input_errors[] = gtext("Container directory/dataset already exist.");
else:
if (is_file($backup_file)) {
$cmd = ("/usr/local/sbin/bastille-init -R '{$filename_trim}'");
$cmd = ("/usr/local/bin/bastille import '{$filename_trim}'");
unset($retval);mwexec($cmd,$retval);
if ($retval == 0) {
$savemsg .= gtext("Container restored successfully.");