Handle hostnames with upper-case letters
[webmin.git] / format / save_part.cgi
1 #!/usr/local/bin/perl
2 # save_part.cgi
3 # Save an existing partition
4
5 require './format-lib.pl';
6 $access{'view'} && &error($text{'ecannot'});
7 &ReadParse();
8
9 # check start and end
10 @dlist = &list_disks();
11 $dinfo = $dlist[$in{'disk'}];
12 &can_edit_disk($dinfo->{'device'}) ||
13         &error($text{'save_ecannot'});
14 if ($in{delete}) {
15         # unassigning a partition
16         &error_setup($text{'save_edelete'});
17         &modify_partition($in{'disk'}, $in{'part'}, "unassigned", "wu", "", "");
18         &redirect("");
19         }
20 else {
21         # changing an existing partition
22         &error_setup($text{'save_esave'});
23         $in{start} =~ /^\d+$/ ||
24                 &error(&text('save_estart', $in{start}));
25         $in{end} =~ /^\d+$/ ||
26                 &error(&text('save_eend', $in{end}));
27         $in{start} >= 0 ||
28                 &error($text{'save_estartmin'});
29         $in{end} < $dinfo->{'cyl'} ||
30                 &error(&text('save_eendmax', $dinfo->{'cyl'}));
31         $in{start} < $in{end} ||
32                 &error($text{'save_estartend'});
33
34         # make the change
35         $flag = ($in{writable} ? "w" : "r").($in{mountable} ? "m" : "u");
36         &modify_partition($in{disk}, $in{part}, $in{tag}, $flag,
37                           $in{start}, $in{end});
38         &redirect("");
39         }
40