📄 mount-lib.pl.old
字号:
printf "<input type=radio name=ufs_dev value=1 %s> RAID Device:\n", $ufs_dev == 1 ? "checked" : ""; print "Unit <input name=ufs_md size=3 value=\"$scsi_md\"><br>\n"; printf "<input type=radio name=ufs_dev value=1 %s> Other Device:\n", $ufs_dev == 2 ? "checked" : ""; print "<input name=ufs_path size=20 value=\"$scsi_path\"><br>\n"; print "</td> </tr>\n"; }elsif ($gconfig{os_type} eq "solaris" && $_[0] eq "swap") { # Swapping to a disk partition or a file print "<tr> <td valign=top><b>Swap File</b></td>\n"; print "<td colspan=3>\n"; if ($_[1] =~ /^\/dev\/dsk\/c([0-9]+)t([0-9]+)d([0-9]+)s([0-9]+)$/) { $swap_dev = 0; $scsi_c = $1; $scsi_t = $2; $scsi_d = $3; $scsi_s = $4; } elsif ($_[1] eq "") { $swap_dev = 1; $scsi_path = ""; } else { $swap_dev = 1; $scsi_path = $_[0]; } printf "<input type=radio name=swap_dev value=0 %s> SCSI Disk:\n", $swap_dev == 0 ? "checked" : ""; print "Controller <input name=swap_c size=3 value=\"$scsi_c\">\n"; print "Target <input name=swap_t size=3 value=\"$scsi_t\">\n"; print "Unit <input name=swap_d size=3 value=\"$scsi_d\">\n"; print "Partition <input name=swap_s size=3 value=\"$scsi_s\"><br>\n"; printf "<input type=radio name=swap_dev value=1 %s> File:\n", $swap_dev == 1 ? "checked" : ""; print "<input name=swap_path size=20 value=\"$scsi_path\"><br>\n"; print "</td> </tr>\n"; }elsif ($gconfig{os_type} eq "solaris" && $_[0] eq "hsfs") { # Mounting a SCSI cdrom print "<tr> <td valign=top><b>CDROM Disk</b></td>\n"; print "<td colspan=3>\n"; if ($_[1] =~ /^\/dev\/dsk\/c([0-9]+)t([0-9]+)d([0-9]+)s([0-9]+)$/) { $hsfs_dev = 0; $scsi_c = $1; $scsi_t = $2; $scsi_d = $3; $scsi_s = $4; } elsif ($_[1] eq "") { $hsfs_dev = 0; $scsi_c = 0; $scsi_t = 6; $scsi_d = 0; $scsi_s = 0; } else { $hsfs_dev = 1; $scsi_path = $_[0]; } printf "<input type=radio name=hsfs_dev value=0 %s> SCSI Device:\n", $hsfs_dev == 0 ? "checked" : ""; print "Controller <input name=hsfs_c size=3 value=\"$scsi_c\">\n"; print "Target <input name=hsfs_t size=3 value=\"$scsi_t\">\n"; print "Unit <input name=hsfs_d size=3 value=\"$scsi_d\">\n"; print "Partition <input name=hsfs_s size=3 value=\"$scsi_s\"><br>\n"; printf "<input type=radio name=hsfs_dev value=1 %s> Other Device:\n", $hsfs_dev == 1 ? "checked" : ""; print "<input name=hsfs_path size=20 value=\"$scsi_path\"><br>\n"; print "</td> </tr>\n"; }elsif ($gconfig{os_type} eq "solaris" && $_[0] eq "pcfs") { # Mounting a SCSI msdos filesystem print "<tr> <td valign=top><b>MS-DOS Disk</b></td>\n"; print "<td colspan=3>\n"; if ($_[1] =~ /^\/dev\/dsk\/c([0-9]+)t([0-9]+)d([0-9]+)s([0-9]+)$/) { $pcfs_dev = 0; $scsi_c = $1; $scsi_t = $2; $scsi_d = $3; $scsi_s = $4; } elsif ($_[1] eq "") { $pcfs_dev = 1; $scsi_path = ""; } else { $pcfs_dev = 1; $scsi_path = $_[0]; } printf "<input type=radio name=pcfs_dev value=0 %s> SCSI Device:\n", $pcfs_dev == 0 ? "checked" : ""; print "Controller <input name=pcfs_c size=3 value=\"$scsi_c\">\n"; print "Target <input name=pcfs_t size=3 value=\"$scsi_t\">\n"; print "Unit <input name=pcfs_d size=3 value=\"$scsi_d\">\n"; print "Partition <input name=pcfs_s size=3 value=\"$scsi_s\"><br>\n"; printf "<input type=radio name=pcfs_dev value=1 %s> Other Device:\n", $pcfs_dev == 1 ? "checked" : ""; print "<input name=pcfs_path size=20 value=\"$scsi_path\"><br>\n"; print "</td> </tr>\n"; }elsif ($gconfig{os_type} =~ /linux$/ && $_[0] ne "nfs") { # This is some linux disk-based filesystem printf "<tr> <td valign=top><b>%s Disk</b></td>\n", &fstype_name($_[0]); print "<td colspan=3>\n"; if ($_[1] =~ /^\/dev\/hd([a-z])([0-9]+)$/) { $lnx_dev = 0; $ide_t = $1; $ide_s = $2; } elsif ($_[1] =~ /^\/dev\/sd([a-z])([0-9]+)$/) { $lnx_dev = 1; $scsi_t = $1; $scsi_s = $2; } elsif ($_[1] =~ /^\/dev\/fd([0-9]+)$/) { $lnx_dev = 2; $floppy_t = $1; } else { $lnx_dev = 3; } printf "<input type=radio name=lnx_dev value=0 %s> IDE Hard Disk:\n", $lnx_dev == 0 ? "checked" : ""; print "Device <input name=ide_t size=3 value=\"$ide_t\">\n"; print "Partition <input name=ide_s size=3 value=\"$ide_s\"><br>\n"; printf "<input type=radio name=lnx_dev value=1 %s> SCSI Disk:\n", $lnx_dev == 1 ? "checked" : ""; print "Device <input name=scsi_t size=3 value=\"$scsi_t\">\n"; print "Partition <input name=scsi_s size=3 value=\"$scsi_s\"><br>\n"; printf "<input type=radio name=lnx_dev value=2 %s> Floppy Disk:\n", $lnx_dev == 2 ? "checked" : ""; print "Number <input name=floppy_t size=3 value=\"$floppy_t\"><br>\n"; printf "<input type=radio name=lnx_dev value=3 %s> Other Device:\n", $lnx_dev == 3 ? "checked" : ""; printf "<input size=10 name=dev_path value=\"%s\"><br>\n", $lnx_dev == 3 ? $_[1] : ""; print "</td> </tr>\n"; }}# parse_options(type, options)# Convert an options string for some filesystem into the associative# array %optionssub parse_options{undef(%options, $_);if ($_[1] ne "-") { foreach (split(/,/, $_[1])) { if (/^([^=]+)=(.*)$/) { $options{$1} = $2; } else { $options{$_} = ""; } } }}# generate_options(type)# Output HTML for editing mount options for a partilcar filesystem # under this OSsub generate_options{if ($_[0] eq "nfs" && $gconfig{os_type} eq "solaris") { # Solaris NFS has many options, not all of which are editable here print "<tr> <td><b>Read-Only?</b></td>\n"; printf "<td nowrap><input type=radio name=nfs_ro value=1 %s> Yes\n", defined($options{"ro"}) ? "checked" : ""; printf "<input type=radio name=nfs_ro value=0 %s> No</td>\n", defined($options{"ro"}) ? "" : "checked"; print "<td><b>Disallow setuid programs?</b></td>\n"; printf "<td nowrap><input type=radio name=nfs_nosuid value=1 %s> Yes\n", defined($options{"nosuid"}) ? "checked" : ""; printf "<input type=radio name=nfs_nosuid value=0 %s> No</td> </tr>\n", defined($options{"nosuid"}) ? "" : "checked"; print "<tr> <td><b>Files inherit parent GID?</b></td>\n"; printf "<td nowrap><input type=radio name=nfs_grpid value=0 %s> Yes\n", defined($options{"grpid"}) ? "" : "checked"; printf "<input type=radio name=nfs_grpid value=1 %s> No</td>\n", defined($options{"grpid"}) ? "checked" : ""; print "<td><b>Return error on timeouts?</b></td>\n"; printf "<td nowrap><input type=radio name=nfs_soft value=1 %s> Yes\n", defined($options{"soft"}) ? "checked" : ""; printf "<input type=radio name=nfs_soft value=0 %s> No</td> </tr>\n", defined($options{"soft"}) ? "" : "checked"; print "<tr> <td><b>Retry mounts in background?</b></td>\n"; printf "<td nowrap><input type=radio name=nfs_bg value=1 %s> Yes\n", defined($options{"bg"}) ? "checked" : ""; printf "<input type=radio name=nfs_bg value=0 %s> No</td>\n", defined($options{"bg"}) ? "" : "checked"; print "<td><b>Use quotas?</b></td>\n"; printf "<td nowrap><input type=radio name=nfs_quota value=1 %s> Yes\n", defined($options{"quota"}) ? "checked" : ""; printf "<input type=radio name=nfs_quota value=0 %s> No</td> </tr>\n", defined($options{"quota"}) ? "" : "checked"; print "<tr> <td><b>Allow user interrupt?</b></td>\n"; printf "<td nowrap><input type=radio name=nfs_intr value=1 %s> Yes\n", defined($options{"intr"}) ? "" : "checked"; printf "<input type=radio name=nfs_intr value=0 %s> No</td>\n", defined($options{"intr"}) ? "checked" : ""; print "<td><b>NFS version</b></td>\n"; printf "<td nowrap><input type=radio name=nfs_vers_def value=1 %s> Highest\n", defined($options{"vers"}) ? "" : "checked"; printf "<input type=radio name=nfs_vers_def value=0 %s>\n", defined($options{"vers"}) ? "checked" : ""; print "<input size=1 name=nfs_vers value=$options{vers}></td> </tr>\n"; print "<tr> <td><b>Protocol</b></td>\n"; print "<td nowrap><select name=proto>\n"; printf "<option value=\"\" %s> Default\n", defined($options{"proto"}) ? "" : "selected"; foreach (split(/\n/, `/bin/cat /etc/netconfig`)) { if (!/^([A-z0-9\_\-]+)\s/) { next; } printf "<option value=\"$1\" %s> $1\n", $options{"proto"} eq $1 ? "selected" : ""; } print "</select></td>\n"; print "<td><b>NFS Port</b></td>\n"; printf "<td nowrap><input type=radio name=nfs_port_def value=1 %s> Default\n", defined($options{"port"}) ? "" : "checked"; printf "<input type=radio name=nfs_port_def value=0 %s>\n", defined($options{"port"}) ? "checked" : ""; print "<input size=5 name=nfs_port value=$options{port}></td> </tr>\n"; print "<tr> <td><b>Timeout</b></td>\n"; printf "<td nowrap><input type=radio name=nfs_timeo_def value=1 %s> Default\n", defined($options{"timeo"}) ? "" : "checked"; printf "<input type=radio name=nfs_timeo_def value=0 %s>\n", defined($options{"timeo"}) ? "checked" : ""; printf "<input size=5 name=nfs_timeo value=$options{timeo}></td>\n"; print "<td><b>Number of Retransmissions</b></td>\n"; printf "<td nowrap><input type=radio name=nfs_retrans_def value=1 %s> Default\n", defined($options{"retrans"}) ? "" : "checked"; printf "<input type=radio name=nfs_retrans_def value=0 %s>\n", defined($options{"retrans"}) ? "checked" : ""; print "<input size=5 name=nfs_retrans value=$options{retrans}></td> </tr>\n"; print "<tr> <td><b>Use DES Authentication?</b></td>\n"; printf "<td nowrap><input type=radio name=nfs_secure value=1 %s> Yes\n", defined($options{"secure"}) ? "checked" : ""; printf "<input type=radio name=nfs_secure value=0 %s> No</td>\n", defined($options{"secure"}) ? "" : "checked"; print "<td><b>Use Kerberos?</b></td>\n"; printf "<td nowrap><input type=radio name=nfs_kerberos value=1 %s> Yes\n", defined($options{"kerberos"}) ? "checked" : ""; printf "<input type=radio name=nfs_kerberos value=0 %s> No</td></tr>\n", defined($options{"kerberos"}) ? "" : "checked"; }if ($_[0] eq "ufs" && $gconfig{os_type} eq "solaris") { # Solaris UFS also has many options, not all of which are here print "<tr> <td><b>Read-Only?</b></td>\n"; printf "<td nowrap><input type=radio name=ufs_ro value=1 %s> Yes\n", defined($options{"ro"}) ? "checked" : ""; printf "<input type=radio name=ufs_ro value=0 %s> No</td>\n", defined($options{"ro"}) ? "" : "checked"; print "<td><b>Disallow setuid programs?</b></td>\n"; printf "<td nowrap><input type=radio name=ufs_nosuid value=1 %s> Yes\n", defined($options{"nosuid"}) ? "checked" : ""; printf "<input type=radio name=ufs_nosuid value=0 %s> No</td> </tr>\n", defined($options{"nosuid"}) ? "" : "checked"; print "<tr> <td><b>Allow user interrupt?</b></td>\n"; printf "<td nowrap><input type=radio name=ufs_intr value=1 %s> Yes\n", defined($options{"intr"}) ? "" : "checked"; printf "<input type=radio name=nfs_intr value=0 %s> No</td>\n", defined($options{"intr"}) ? "checked" : ""; print "<td><b>Use quotas?</b></td>\n"; printf "<td nowrap><input type=radio name=ufs_quota value=1 %s> Yes\n", defined($options{"quota"}) || defined($options{"rq"}) ? "checked" : ""; printf "<input type=radio name=ufs_quota value=0 %s> No</td> </tr>\n", defined($options{"quota"}) || defined($options{"rq"}) ? "" : "checked"; print "<tr> <td><b>Action on error</b></td>\n"; print "<td><select name=onerror>\n"; printf "<option value=\"\" %s> Default\n", defined($config{onerror}) ? "" : "selected"; foreach ('panic', 'lock', 'umount', 'repair') { printf "<option value=\"$_\" %s> $_\n", $config{onerror} eq $_ ? "selected" : ""; } print "</select></td>\n"; print "<td><b>Repair Delay</b></td>\n"; $config{toosoon} =~ /([0-9]+)([A-z])/; print "<td nowrap><input size=5 name=toosoon_time value=$1>\n"; print "<select name=toosoon_units>\n"; print "<option value=s %s> Seconds\n", $2 eq "s" ? "selected" : ""; print "<option value=m %s> Minutes\n", $2 eq "m" ? "selected" : ""; print "<option value=h %s> Hours\n", $2 eq "h" ? "selected" : ""; print "<option value=d %s> Days\n", $2 eq "d" ? "selected" : ""; print "<option value=w %s> Months\n", $2 eq "w" ? "selected" : ""; print "<option value=y %s> Years\n", $2 eq "y" ? "selected" : ""; print "</select></td> </tr>\n"; }if ($_[0] eq "hsfs" && $gconfig{os_type} eq "solaris") { # Solaris hsfs is used for CDROMs print "<tr> <td><b>Ignore Unix attributes?</b></td>\n"; printf "<td nowrap><input type=radio name=hsfs_nrr value=1 %s> Yes\n", defined($options{"nrr"}) ? "checked" : ""; printf "<input type=radio name=hsfs_nrr value=0 %s> No</td>\n", defined($options{"nrr"}) ? "" : "checked"; print "<td><b>Ignore trailing dot?</b></td>\n"; printf "<td nowrap><input type=radio name=hsfs_notraildot value=1 %s> Yes\n", defined($options{"notraildot"}) ? "checked" : ""; printf "<input type=radio name=hsfs_notraildot value=0 %s> No</td> </tr>\n", defined($options{"notraildot"}) ? "" : "checked"; print "<tr> <td><b>Use lower case?</b></td>\n"; printf "<td nowrap><input type=radio name=hsfs_nomaplcase value=0 %s> Yes\n", defined($options{"nomaplcase"}) ? "" : "checked"; printf "<input type=radio name=hsfs_nomaplcase value=1 %s> No</td>\n", defined($options{"nomaplcase"}) ? "checked" : ""; print "<td><b>Disallow setuid programs?</b></td>\n"; printf"<td nowrap><input type=radio name=hsfs_nosuid value=1 %s> Yes\n", defined($options{"nosuid"}) ? "checked" : ""; printf "<input type=radio name=hsfs_nosuid value=0 %s> No</td> </tr>\n", defined($options{"nosuid"}) ? "" : "checked"; }if ($_[0] eq "pcfs" && $gconfig{os_type} eq "solaris") { # Solaris pcfs for for FAT filesystems. It doesn't have many options print "<tr> <td><b>Read Only?</b></td>\n"; printf "<td nowrap><input type=radio name=pcfs_ro value=1 %s> Yes\n", defined($options{"ro"}) ? "checked" : ""; printf "<input type=radio name=pcfs_ro value=0 %s> No</td>\n", defined($options{"ro"}) ? "" : "checked"; print "<td colsan=2></td> </tr>\n"; }if ($_[0] eq "tmpfs" && $gconfig{os_type} eq "solaris") { # Solaris tmpfs (virtual memory) filesystem. Only one option print "<tr> <td><b>Size</b></td>\n"; printf"<td><input type=radio name=tmpfs_size_def value=1 %s> Maximum\n", defined($options{"size"}) ? "" : "checked"; printf "<td><input type=radio name=tmpfs_size_def value=0 %s>\n", defined($options{"size"}) ? "checked" : ""; print "<input name=tmpfs_size size=6 value=$options{size}></td>\n"; print "<td colsan=2></td> </tr>\n"; }if ($_[0] eq "swap" && $gconfig{os_type} eq "solaris") { # Solaris swap has no options print "<tr> <td><i>No Options Available</i></td> </tr>\n"; }############# Linux section ##############if ($gconfig{os_type} =~ /linux$/) { # Lots of options are common to all linux filesystems print "<tr> <td><b>Read-only?</b></td>\n";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -