📄 edit_mount.cgi
字号:
#!/usr/local/bin/perl# edit_mount.cgi# Display a form for editing or creating a permanent or temporary mounting.require './mount-lib.pl';$whatfailed = "Failed to edit mount";&ReadParse;if (defined($in{index})) { if ($in{temp}) { # Edit a temporary mount, existing only in the mnttab @mlist = &list_mounted(); @minfo = @{$mlist[$in{index}]}; $mnow = 1; $msave = 0; } else { # Edit a permanent mount, which may or may not be currently # mounted. @mlist = &list_mounts(); @minfo = @{$mlist[$in{index}]}; $msave = 1; $mnow = (&get_mounted($minfo[0], $minfo[1]) >= 0); } if ($in{index} >= @mlist) { &error("This mount no longer exists"); } $type = $minfo[2]; &header("Edit Mount", ""); print "<hr>\n"; $newm = 0; }else { # creating a new mount (temporary or permanent) $type = $in{type}; &header("Create Mount", ""); print "<hr>\n"; $newm = 1; }@mmodes = &mount_modes($type);$msave = ($mmodes[0]==0 ? 0 : $msave);$mnow = ($mmodes[1]==0 ? $msave : $mnow);print "<form action=\"save_mount.cgi\">\n";if (!$newm) { print "<input type=hidden name=old value=\"$in{index}\">\n"; print "<input type=hidden name=temp value=\"$in{temp}\">\n"; print "<input type=hidden name=oldmnow value=$mnow>\n"; print "<input type=hidden name=oldmsave value=$msave>\n"; }print "<input type=hidden name=type value=\"$type\">\n";print "<table border width=100%>\n";print "<tr $tb> <td><b>",&fstype_name($type)," Mount Details</b></td> </tr>\n";print "<tr $cb> <td><table>\n";print "<tr> <td><b>Mounted As</b></td>\n";if ($type eq "swap") { print "<td colspan=3><i>Virtual Memory</i></b>\n"; }else { print "<td colspan=3><input size=30 name=directory value=\"$minfo[0]\">\n"; print &file_chooser_button("directory", 1); }if (!$newm && (($size,$free) = &disk_space($type, $minfo[0]))) { print " " x 8; printf "<b>Size</b> <i>%d Kb</i> / \n", $size; printf "<b>Free</b> <i>%d Kb</i></td>\n", $free; }print "</td> </tr>\n";if ($mmodes[0] != 0) { print "<tr> <td><b>Save Mount?</b></td> <td colspan=3>\n"; printf "<input type=radio name=msave value=2 %s> ". "Save and mount at boot\n", $minfo[5] eq "yes" || $newm ? "checked" : ""; if ($mmodes[0] != 1) { printf "<input type=radio name=msave value=1 %s> Save\n", $minfo[5] eq "no" ? "checked" : ""; } if (!$newm && $mmodes[1] == 0) { printf "<input type=radio name=msave value=0 %s> Delete\n", $minfo[5] eq "" && !$newm ? "checked" : ""; } else { printf "<input type=radio name=msave value=0 %s> Don't save\n", $minfo[5] eq "" && !$newm ? "checked" : ""; } print "</td> </tr>\n"; }if ($mmodes[1] == 1 && ($mmodes[3] == 0 || !$mnow)) { print "<tr> <td><b>Mount Now?</b></td> <td colspan=3>\n"; printf "<input type=radio name=mmount value=1 %s> Mount\n", $mnow || $newm ? "checked" : ""; if ($mmodes[0] == 0) { printf "<input type=radio name=mmount value=0 %s> Delete\n", $mnow || $newm ? "" : "checked"; } else { $dont = $newm ? "Don't mount" : "Unmount"; printf "<input type=radio name=mmount value=0 %s> $dont\n", $mnow || $newm ? "" : "checked"; } print "</td> </tr>\n"; }if ($mmodes[2]) { print "<tr> <td><b>Check filesystem at boot?</b></td>\n"; printf "<td colspan=3><input type=radio name=order value=0 %s> No\n", $newm || $minfo[4] == 0 ? "checked" : ""; printf "<input type=radio name=order value=1 %s> Check First\n", $minfo[4] == 1 ? "checked" : ""; printf "<input type=radio name=order value=%s %s> Check Second</td\n", $minfo[4] > 1 ? $minfo[4] : 2 , $minfo[4] > 1 ? "checked" : ""; print "</tr>\n"; }&generate_location($type, $minfo[1]);print "</table></td> </tr></table><p>\n";# generate mount optionsprint "<table border width=100%>\n";print "<tr $tb> <td><b>Advanced Mount Options</b></td> </tr>\n";print "<tr $cb> <td><table width=100%>\n";&parse_options($type, $minfo[3]);&generate_options($type, $newm);print "</table></td> </tr></table>\n";if ($newm) { print "<p><input type=submit value=Create></form><p>\n"; }elsif ($mnow && $minfo[2] ne "swap") { print "<table width=100%><tr><td>\n"; print "<input type=submit value=Apply></td>\n"; print "</form><form action=../proc/index_search.cgi>\n"; print "<input type=hidden name=mode value=3>\n"; print "<input type=hidden name=fs value=$minfo[0]>\n"; print "<td align=right><input type=submit value=\"List Users\">\n"; print "</td></tr></table></form>\n"; }else { print "<p><input type=submit value=Apply></form><p>\n"; }print "<hr>\n";&footer("", "filesystems list");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -