Handle hostnames with upper-case letters
[webmin.git] / bacula-backup / mount.cgi
1 #!/usr/local/bin/perl
2 # Actually execute a backup
3
4 require './bacula-backup-lib.pl';
5 &ReadParse();
6 &error_setup($text{'mount_err'});
7
8 # Validate inputs
9 $in{'slot_def'} || $in{'slot'} =~ /^[1-9][0-9]*$/ ||
10         &error($text{'mount_eslot'});
11
12 &ui_print_unbuffered_header(undef,  $text{'mount_title'}, "");
13 $mode = $in{'mount'} ? "mount" : "unmount";
14
15 print "<b>",&text($mode.'_run', "<tt>$in{'storage'}</tt>"),"</b>\n";
16 print "<pre>";
17 $h = &open_console();
18 &console_cmd($h, "messages");
19
20 # Run the command
21 $out = &console_cmd($h, "$mode storage=$in{'storage'}".
22                         ($in{'slot_def'} ? "" : " slot=$in{'slot'}"));
23 print $out;
24
25 print "</pre>";
26 if ($out =~ /\sOK\s/i) {
27         # Worked
28         print "<b>",$text{$mode.'_done'},"</b><p>\n";
29         }
30 else {
31         # Something went wrong
32         print "<b>",$text{$mode.'_failed'},"</b><p>\n";
33         }
34
35 &close_console($h);
36 &webmin_log($mode, $in{'storage'});
37
38 &ui_print_footer("mount_form.cgi", $text{'mount_return'});
39
40