#!/usr/local/bin/perl
# backup.cgi
# Run a filesystem backup and show the results

require './fsdump-lib.pl';
&ReadParse();
$dump = &get_dump($in{'id'});

$theme_no_table++;
&header($text{'backup_title'}, "");
print "<hr>\n";

print "<p><b>",&text('backup_desc', "<tt>".&html_escape($dump->{'dir'})."</tt>",
	             &dump_dest($dump)),"</b><p>\n";
print "<pre>";
&execute_before($dump, STDOUT, 1);
$ok = &execute_dump($dump, STDOUT, 1);
&execute_after($dump, STDOUT, 1);
print "</pre>\n";
if ($ok) {
	print "<b>$text{'backup_done'}</b><br>\n";
	}
else {
	print "<b>$text{'backup_failed'}</b><br>\n";
	}
&webmin_log("backup", undef, undef, $dump);

print "<hr>\n";
&footer("edit_dump.cgi?id=$in{'id'}", $text{'edit_return'},
	"", $text{'index_return'});

