Handle hostnames with upper-case letters
[webmin.git] / format / newfs.cgi
1 #!/usr/local/bin/perl
2 # newfs.cgi
3 # Create a new filesystem 
4
5 require './format-lib.pl';
6 $access{'view'} && &error($text{'ecannot'});
7 &ReadParse();
8 &can_edit_disk($in{'dev'}) || &error($text{'newfs_ecannot'});
9 &error_setup($text{'newfs_err'});
10 $cmd = "newfs";
11 $cmd .= &opt_check("ufs_a", '\d+', "-a");
12 $cmd .= &opt_check("ufs_b", '\d+', "-b");
13 $cmd .= &opt_check("ufs_c", '\d+', "-c");
14 $cmd .= &opt_check("ufs_d", '\d+', "-d");
15 $cmd .= &opt_check("ufs_f", '\d+', "-f");
16 $cmd .= &opt_check("ufs_i", '\d+', "-i");
17 $cmd .= &opt_check("ufs_m", '\d+', "-m");
18 $cmd .= &opt_check("ufs_n", '\d+', "-n");
19 $cmd .= $in{ufs_o} ? " -o $in{ufs_o}" : "";
20 $cmd .= &opt_check("ufs_r", '\d+', "-r");
21 $cmd .= &opt_check("ufs_s", '\d+', "-s");
22 $cmd .= &opt_check("ufs_t", '\d+', "-t");
23 $cmd .= &opt_check("ufs_cb", '\d+', "-C");
24 $in{dev} =~ s/dsk/rdsk/g;
25 $cmd .= " $in{dev}";
26
27 &ui_print_header(undef, $text{'newfs_title'}, "");
28
29 print &text('newfs_exec', "<tt>$cmd</tt>"),"<p>\n";
30 print "<pre>\n";
31 open(MKFS, "$cmd 2>&1 </dev/null |");
32 while(<MKFS>) { print; }
33 close(MKFS);
34 print "</pre>\n";
35 if ($?) { print "$text{'newfs_failed'} <p>\n"; }
36 else { print "$text{'newfs_ok'} <p>\n"; }
37
38 &ui_print_footer("", $text{'index_return'});
39