📄 hpux-lib.pl
字号:
else { $swap_dev = 2; $scsi_path = $_[1]; } $scsi_path = $_[1]; 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> LVM Device:\n", $swap_dev == 1 ? "checked" : ""; print "Volume Group <input name=swap_vg size=2 value=\"$scsi_vg\">\n"; print "Logical Volume <input name=swap_lv size=20 value=\"$scsi_lv\"><br>\n"; printf "<input type=radio name=swap_dev value=2 %s> File:\n", $swap_dev == 2 ? "checked" : ""; print "<input name=swap_path size=20 value=\"$scsi_path\">"; print &file_chooser_button("swap_path", 0); print "<br>\n"; print "</td> </tr>\n"; }elsif ($_[0] eq "cdfs") { # 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]+)$/) { $cdfs_dev = 0; $scsi_c = $1; $scsi_t = $2; $scsi_d = $3; } else { $cdfs_dev = 1; $scsi_path = $_[1]; } $scsi_path = $_[1]; printf "<input type=radio name=cdfs_dev value=0 %s> SCSI Device:\n", $cdfs_dev == 0 ? "checked" : ""; print "Controller <input name=cdfs_c size=3 value=\"$scsi_c\">\n"; print "Target <input name=cdfs_t size=3 value=\"$scsi_t\">\n"; print "Unit <input name=cdfs_d size=3 value=\"$scsi_d\">\n<BR>"; printf "<input type=radio name=cdfs_dev value=1 %s> Other Device:\n", $cdfs_dev == 1 ? "checked" : ""; print "<input name=cdfs_path size=20 value=\"$scsi_path\">"; print &file_chooser_button("cdfs_path", 0); print "<br>\n"; print "</td> </tr>\n"; }elsif ($_[0] eq "lofs") { # Mounting some directory to another location print "<tr> <td><b>Original Directory</b></td>\n"; print "<td><input name=lofs_src size=30 value=\"$_[1]\">\n"; print &file_chooser_button("lofs_src", 1); print "</td> </tr>\n"; }elsif ($_[0] eq "swapfs") { # Mounting a cached filesystem of some type.. need a location for # the source of the mount print "<tr> <td><b>Cache Source</b></td>\n"; print "<td><input name=cfs_src size=20 value=\"$_[1]\"></td> </tr>\n"; }elsif ($_[0] eq "autofs") { # An automounter entry.. can be -hosts, -xfn or from some mapping print "<tr> <td valign=top><b>Automounter map</b></td>\n"; printf "<td><input type=radio name=autofs_type value=0 %s>\n", $_[1] eq "-hosts" || $_[1] eq "-xfn" ? "" : "checked"; printf "Use map <input name=autofs_map size=20 value=\"%s\"><br>\n", $_[1] eq "-hosts" || $_[1] eq "-xfn" ? "" : $_[1]; printf "<input type=radio name=autofs_type value=1 %s>\n", $_[1] eq "-hosts" ? "checked" : ""; print "All NFS exports map<br>\n"; printf "<input type=radio name=autofs_type value=2 %s>\n", $_[1] eq "-xfn" ? "checked" : ""; print "Federated Naming Service map</td> </tr>\n"; }}# generate_options(type, newmount)# Output HTML for editing mount options for a partilcar filesystem # under this OSsub generate_options{if ($_[0] eq "nfs") { # 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>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>\n", defined($options{"soft"}) ? "" : "checked"; print "<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> </tr>\n", defined($options{"bg"}) ? "" : "checked"; print "<tr> <td><b>Allow interrupts?</b></td>\n"; printf "<td nowrap><input type=radio name=nfs_nointr value=0 %s> Yes\n", defined($options{"nointr"}) ? "" : "checked"; printf "<input type=radio name=nfs_nointr value=1 %s> No</td>\n", defined($options{"nointr"}) ? "checked" : ""; print "<td><b>Allow Access to Local Devices?</b></td>\n"; printf "<td nowrap><input type=radio name=nfs_nodevs value=0 %s> Yes\n", defined($options{"nodevs"}) ? "" : "checked"; printf "<input type=radio name=nfs_nodevs value=1 %s> No</td> </tr>\n", defined($options{"nodevs"}) ? "checked" : ""; }if ($_[0] eq "hfs") { print "<tr> <td><b>Read-Only?</b></td>\n"; printf "<td nowrap><input type=radio name=hfs_ro value=1 %s> Yes\n", defined($options{"ro"}) ? "checked" : ""; printf "<input type=radio name=hfs_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=hfs_nosuid value=1 %s> Yes\n", defined($options{"nosuid"}) ? "checked" : ""; printf "<input type=radio name=hfs_nosuid value=0 %s> No</td> </tr>\n", defined($options{"nosuid"}) ? "" : "checked"; print "<tr> <td><b>Enable quotas at boot time?</b></td>\n"; printf "<td nowrap><input type=radio name=hfs_quota value=1 %s> Yes\n", defined($options{"quota"}) ? "checked" : ""; printf "<input type=radio name=hfs_quota value=0 %s> No</td> </tr>\n", defined($options{"quota"}) ? "" : "checked"; }if ($_[0] eq "vxfs") { print "<tr> <td><b>Read-Only?</b></td>\n"; printf "<td nowrap><input type=radio name=jfs_ro value=1 %s> Yes\n", defined($options{"ro"}) ? "checked" : ""; printf "<input type=radio name=jfs_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=jfs_nosuid value=1 %s> Yes\n", defined($options{"nosuid"}) ? "checked" : ""; printf "<input type=radio name=jfs_nosuid value=0 %s> No</td> </tr>\n", defined($options{"nosuid"}) ? "" : "checked"; print "<tr> <td><b>Full integrity for all Metadata?</b></td>\n"; printf "<td nowrap><input type=radio name=jfs_log value=1 %s> Yes\n", defined($options{"log"}) ? "checked" : ""; printf "<input type=radio name=jfs_log value=0 %s> No</td>\n", defined($options{"log"}) ? "" : "checked"; print "<td><b>Synchronous-write data logging?</b></td>\n"; printf "<td nowrap><input type=radio name=jfs_syncw value=1 %s> Yes\n", !defined($options{"nodatainlog"}) ? "checked" : ""; printf "<input type=radio name=jfs_syncw value=0 %s> No</td> </tr>\n", !defined($options{"nodatainlog"}) ? "" : "checked"; print "<tr> <td><b>Enable quotas at boot time?</b></td>\n"; printf "<td nowrap><input type=radio name=jfs_quota value=1 %s> Yes\n", defined($options{"quota"}) ? "checked" : ""; printf "<input type=radio name=jfs_quota value=0 %s> No</td> </tr>\n", defined($options{"quota"}) ? "" : "checked"; }if ($_[0] eq "cdfs") { print "<tr> <td><b>Disallow setuid programs?</b></td>\n"; printf"<td nowrap><input type=radio name=cdfs_nosuid value=1 %s> Yes\n", defined($options{"nosuid"}) ? "checked" : ""; printf "<input type=radio name=cdfs_nosuid value=0 %s> No</td> </tr>\n", defined($options{"nosuid"}) ? "" : "checked"; }if ($_[0] eq "lofs") { print "<tr> <td><b>Read-Only?</b></td>\n"; printf "<td nowrap><input type=radio name=lofs_ro value=1 %s> Yes\n", defined($options{"ro"}) ? "checked" : ""; printf "<input type=radio name=lofs_ro value=0 %s> No</td> </tr>\n", defined($options{"ro"}) ? "" : "checked"; }if ($_[0] eq "swap") { local($i); print "<tr> <td><b>Priority</b></td>\n"; print "<td><select name=swap_pri>\n"; for ($i = 0; $i < 11; ++$i) { printf "<option value=\"%s\" %s>%s\n", $i, $options{"pri"} == $i ? "selected" : "", $i; } print "</select></td> </tr>\n"; }if ($_[0] eq "swapfs") { # The caching filesystem has lots of options.. cachefs mounts can # be of an existing 'manually' mounted back filesystem, or of a # back-filesystem that has been automatically mounted by the cache. # The user should never see the automatic mountings made by cachefs. print "<tr> <td><b>Real filesystem type</b></td>\n"; print "<td nowrap><select name=cfs_backfstype>\n"; if (!defined($options{backfstype})) { $options{backfstype} = "nfs"; } foreach (&list_fstypes()) { if ($_ eq "cachefs") { next; } printf "<option value=\"$_\" %s>$_\n", $_ eq $options{backfstype} ? "selected" : ""; } print "</select></td>\n"; print "<td><b>Real mount point</b></td>\n"; printf"<td nowrap><input type=radio name=cfs_noback value=1 %s> Automatic\n", defined($options{"backpath"}) ? "" : "checked"; printf "<input type=radio name=cfs_noback value=0 %s>\n", defined($options{"backpath"}) ? "checked" : ""; print "<input size=10 name=cfs_backpath value=\"$options{backpath}\"></td> </tr>\n"; print "<tr> <td><b>Cache directory</b></td>\n"; printf "<td nowrap><input size=10 name=cfs_cachedir value=\"%s\"></td>\n", defined($options{"cachedir"}) ? $options{"cachedir"} : "/cache"; print "<td><b>Write mode</b></td>\n"; printf"<td nowrap><input type=radio name=cfs_wmode value=0 %s> Write-around\n", defined($options{"non-shared"}) ? "" : "checked"; printf "<input type=radio name=cfs_wmode value=1 %s> Non-shared\n", defined($options{"non-shared"}) ? "checked" : ""; print "</td> </tr>\n"; print "<tr> <td><b>Consistency check</b></td>\n"; print "<td><select name=cfs_con>\n"; print "<option value=1> Periodically\n"; printf "<option value=0 %s> Never\n", defined($options{"noconst"}) ? "selected" : ""; printf "<option value=2 %s> On demand\n", defined($options{"demandconst"}) ? "selected" : ""; print "</select></td>\n"; print "<td><b>Check permissions in cache?</b></td>\n"; printf "<td nowrap><input type=radio name=cfs_local value=1 %s> Yes\n", defined($options{"local-access"}) ? "checked" : ""; printf "<input type=radio name=cfs_local value=0 %s> No</td> </tr>\n", defined($options{"local-access"}) ? "" : "checked"; print "<tr> <td><b>Read-Only?</b></td>\n"; printf "<td nowrap><input type=radio name=cfs_ro value=1 %s> Yes\n", defined($options{"ro"}) ? "checked" : ""; printf "<input type=radio name=cfs_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=cfs_nosuid value=1 %s> Yes\n", defined($options{"nosuid"}) ? "checked" : ""; printf "<input type=radio name=cfs_nosuid value=0 %s> No</td> </tr>\n", defined($options{"nosuid"}) ? "" : "checked"; }if ($_[0] eq "autofs") { # Autofs has lots of options, depending on the type of file # system being automounted.. the fstype options determines this local($fstype); $fstype = $options{fstype} eq "" ? "nfs" : $options{fstype}; &generate_options($fstype); print "<input type=hidden name=autofs_fstype value=\"$fstype\">\n"; }}# check_location(type)# Parse and check inputs from %in, calling &error() if something is wrong.# Returns the location string for storing in the fstab filesub check_location{if ($_[0] eq "nfs") { local($out, $temp, $mout, $dirlist); # Use ping and showmount to see if the host exists and is up if ($in{nfs_host} !~ /^\S+$/) { &error("'$in{nfs_host}' is not a valid hostname"); } $out = `ping '$in{nfs_host}' -n 1 2>&1`; if ($out =~ /unknown host/i) { &error("The host '$in{nfs_host}' does not exist"); } elsif ($out =~ /100\% packet loss/) { &error("The host '$in{nfs_host}' is down"); } $out = `showmount -e '$in{nfs_host}' 2>&1`; if ($out =~ /Unable to receive/) { &error("The host '$in{nfs_host}' does not support NFS"); } elsif ($?) { &error("Failed to get mount list : $out"); } # Validate directory name foreach (split(/\n/, $out)) { if (/^(\/\S+)/) { $dirlist .= "$1\n"; } } if ($in{nfs_dir} !~ /^\/\S+$/) { &error("'$in{nfs_dir}' is not a valid directory name. The ". "available directories on $in{nfs_host} are:". "<pre>$dirlist</pre>"); } # Try a test mount to see if filesystem is available $temp = &tempname(); mkdir($temp, 0755); $mout = `mount $in{nfs_host}:$in{nfs_dir} $temp 2>&1`; if ($mout =~ /No such file or directory/) { rmdir($temp); &error("The directory '$in{nfs_dir}' does not exist on the ". "host $in{nfs_host}. The available directories are:". "<pre>$dirlist</pre>"); } elsif ($mout =~ /Permission denied/) { rmdir($temp); &error("This host is not allowed to mount the directory ". "$in{nfs_dir} from $in{nfs_host}"); } elsif ($?) { rmdir($temp); &error("NFS Error - $mout"); } # It worked! unmount `umount $temp`; rmdir($temp); return "$in{nfs_host}:$in{nfs_dir}"; }elsif ($_[0] eq "hfs") { # Get the device name if ($in{hfs_dev} == 0) { $in{hfs_c} =~ /^[0-9]+$/ || &error("'$in{hfs_c}' is not a valid SCSI controller"); $in{hfs_t} =~ /^[0-9]+$/ || &error("'$in{hfs_t}' is not a valid SCSI target"); $in{hfs_d} =~ /^[0-9]+$/ || &error("'$in{hfs_d}' is not a valid SCSI unit"); $in{hfs_s} =~ /^[0-9]+$/ || &error("'$in{hfs_s}' is not a valid SCSI partition"); $dv = "/dev/dsk/c$in{hfs_c}t$in{hfs_t}d$in{hfs_d}s$in{hfs_s}"; } elsif ($in{hfs_dev} == 1) { $in{hfs_vg} =~ /^[0-9]+$/ || &error("'$in{hfs_vg}' is not a valid Volume Group"); $in{hfs_lv} =~ /^\S+$/ || &error("'$in{hfs_lv}' is not a valid Logical Volume"); $dv = "/dev/vg$in{hfs_vg}/$in{hfs_lv}"; } else { $in{hfs_path} =~ /^\/\S+$/ || &error("'$in{hfs_path}' is not a valid pathname"); $dv = $in{hfs_path}; } &fstyp_check($dv, "hfs"); return $dv; }elsif ($_[0] eq "vxfs") { # Get the device name if ($in{jfs_dev} == 0) { $in{jfs_c} =~ /^[0-9]+$/ || &error("'$in{jfs_c}' is not a valid SCSI controller"); $in{jfs_t} =~ /^[0-9]+$/ || &error("'$in{jfs_t}' is not a valid SCSI target"); $in{jfs_d} =~ /^[0-9]+$/ || &error("'$in{jfs_d}' is not a valid SCSI unit"); $in{jfs_s} =~ /^[0-9]+$/ || &error("'$in{jfs_s}' is not a valid SCSI partition"); $dv = "/dev/dsk/c$in{jfs_c}t$in{jfs_t}d$in{jfs_d}s$in{jfs_s}"; } elsif ($in{jfs_dev} == 1) { $in{jfs_vg} =~ /^[0-9]+$/ || &error("'$in{jfs_vg}' is not a valid Volume Group"); $in{jfs_lv} =~ /^\S+$/ || &error("'$in{jfs_lv}' is not a valid Logical Volume"); $dv = "/dev/vg$in{jfs_vg}/$in{jfs_lv}"; } else { $in{jfs_path} =~ /^\/\S+$/ || &error("'$in{jfs_path}' is not a valid pathname"); $dv = $in{jfs_path}; } &fstyp_check($dv, "vxfs"); return $dv; }elsif ($_[0] eq "lofs") { # Get and check the original directory $dv = $in{'lofs_src'}; if (!(-r $dv)) { &error("'$in{lofs_src}' does not exist"); } if (!(-d $dv)) { &error("'$in{lofs_src}' is not a directory"); } return $dv; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -