📄 unixware-lib.pl
字号:
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") { # UnixWare pcfs for for FAT filesystems. It doesn't have many options print "<tr> <td width=25%><b>Read Only?</b></td> <td width=25%>\n"; printf "<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"; if ($gconfig{'os_version'} >= 7) { print "<td><b>Force lower case?</b></td> <td>\n"; printf "<input type=radio name=pcfs_foldcase value=1 %s> Yes\n", defined($options{'foldcase'}) ? "checked" : ""; printf "<input type=radio name=pcfs_foldcase value=0 %s> No\n", defined($options{'foldcase'}) ? "" : "checked"; print "</td>\n"; } else { print "<td colspan=2></td> </tr>\n"; } }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 "lofs") { # No options as far as I know print "<tr> <td><i>No Options Available</i></td> </tr>\n"; }if ($_[0] eq "tmpfs") { # UnixWare tmpfs (virtual memory) filesystem. 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" <input type=radio name=tmpfs_size_def value=0 %s>\n", defined($options{"size"}) ? "checked" : ""; ($tmpsz = $options{size}) =~ s/[A-z]+$//g; print "<input name=tmpfs_size size=6 value=\"$tmpsz\">\n"; print "<select name=tmpfs_unit>\n"; printf "<option value=m %s> Mb\n", $options{"size"} =~ /m$/ ? "selected" : ""; printf "<option value=k %s> Kb\n", $options{"size"} =~ /k$/ ? "selected" : ""; printf "<option value=b %s> bytes\n", $options{"size"} !~ /(k|m)$/ ? "selected" : ""; print "</select></td>\n"; print "<td><b>Disallow setuid programs?</b></td> <td nowrap>\n"; printf "<input type=radio name=tmpfs_nosuid value=1 %s> Yes\n", defined($options{"nosuid"}) ? "checked" : ""; printf "<input type=radio name=tmpfs_nosuid value=0 %s> No</td>\n", defined($options{"nosuid"}) ? "" : "checked"; print "</tr>\n"; }if ($_[0] eq "swap") { # UnixWare swap has no options print "<tr> <td><i>No Options Available</i></td> </tr>\n"; }if ($_[0] eq "cachefs") { # 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}; if ($gconfig{'os_version'} >= 2.6) { print "<tr> <td><b>Browsing enabled?</b></td> <td>\n"; printf "<input type=radio name=auto_nobrowse value=0 %s> Yes\n", defined($options{'nobrowse'}) ? "" : "checked"; printf "<input type=radio name=auto_nobrowse value=1 %s> No\n", defined($options{'nobrowse'}) ? "checked" : ""; print "</td> <td colspan=2></td> </tr>\n"; } &generate_options($fstype); print "<input type=hidden name=autofs_fstype value=\"$fstype\">\n"; }if ($_[0] eq "rumba") { # SMB filesystems have a few options.. print "<tr> <td><b>Server Hostname</b></td>\n"; printf "<td><input type=radio name=rumba_mname_def value=1 %s> Automatic\n", defined($options{"machinename"}) ? "" : "checked"; printf "<input type=radio name=rumba_mname_def value=0 %s>\n", defined($options{"machinename"}) ? "checked" : ""; print "<input size=10 name=rumba_mname value=\"$options{machinename}\"></td>\n"; print "<td><b>Client Name</b></td>\n"; printf "<td><input type=radio name=rumba_cname_def value=1 %s> Automatic\n", defined($options{"clientname"}) ? "" : "checked"; printf "<input type=radio name=rumba_cname_def value=0 %s>\n", defined($options{"clientname"}) ? "checked" : ""; print "<input size=10 name=rumba_cname value=\"$options{clientname}\"></td> </tr>\n"; print "<tr> <td><b>Login Name</b></td>\n"; print "<td><input name=rumba_username size=15 value=\"$options{username}\"></td>\n"; print "<td><b>Login Password</b></td>\n"; print "<td><input type=password name=rumba_password size=15 value=\"$options{password}\"></td> </tr>\n"; print "<tr> <td><b>User files are owned by</b></td>\n"; printf "<td><input name=rumba_uid size=8 value=\"%s\">\n", defined($options{'uid'}) ? getpwuid($options{'uid'}) : ""; print &user_chooser_button("rumba_uid", 0),"</td>\n"; print "<td><b>Group files are owned by</b></td>\n"; printf "<td><input name=rumba_gid size=8 value=\"%s\">\n", defined($options{'gid'}) ? getgrgid($options{'gid'}) : ""; print &group_chooser_button("rumba_gid", 0),"</td>\n"; print "<tr> <td><b>File permissions</b></td>\n"; printf "<td><input name=rumba_fmode size=5 value=\"%s\"></td>\n", defined($options{fmode}) ? $options{fmode} : "755"; print "<td><b>Directory permissions</b></td>\n"; printf "<td><input name=rumba_dmode size=5 value=\"%s\"></td> </tr>\n", defined($options{dmode}) ? $options{dmode} : "755"; print "<tr> <td><b>Read/write access is safe?</b></td>\n"; printf"<td nowrap><input type=radio name=rumba_readwrite value=1 %s> Yes\n", defined($options{"readwrite"}) ? "checked" : ""; printf "<input type=radio name=rumba_readwrite value=0 %s> No</td>\n", defined($options{"readwrite"}) ? "" : "checked"; print "<td><b>Files can be read-only?</b></td>\n"; printf"<td nowrap><input type=radio name=rumba_readonly value=1 %s> Yes\n", defined($options{"readonly"}) ? "checked" : ""; printf "<input type=radio name=rumba_readonly value=0 %s> No</td> </tr>\n", defined($options{"readonly"}) ? "" : "checked"; print "<tr> <td><b>Send password in upper case?</b></td>\n"; printf"<td nowrap><input type=radio name=rumba_noupper value=0 %s> Yes\n", defined($options{"noupper"}) ? "" : "checked"; printf "<input type=radio name=rumba_noupper value=1 %s> No</td>\n", defined($options{"noupper"}) ? "checked" : ""; print "<td><b>Use attrE commands?</b></td>\n"; printf"<td nowrap><input type=radio name=rumba_attr value=1 %s> Yes\n", defined($options{"attr"}) ? "checked" : ""; printf "<input type=radio name=rumba_attr value=0 %s> No</td> </tr>\n", defined($options{"attr"}) ? "" : "checked"; }}# 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); if ($in{'nfs_serv'} == 1) { # multiple servers listed.. assume the user has a brain return $in{'nfs_list'}; } elsif ($in{'nfs_serv'} == 2) { # NFS url.. check syntax if ($in{'nfs_url'} !~ /^nfs:\/\/([^\/ ]+)(\/([^\/ ]*))?$/) { &error("'$in{'nfs_url'}' is not a valid NFS URL"); } return $in{'nfs_url'}; } # Use dfshares to see if the host exists and is up if ($in{nfs_host} !~ /^\S+$/) { &error("'$in{nfs_host}' is not a valid hostname"); } $out = `dfshares '$in{nfs_host}' 2>&1`; if ($out =~ /Unknown host/) { &error("The host '$in{nfs_host}' does not exist"); } elsif ($out =~ /Timed out/) { &error("The host '$in{nfs_host}' is down or does not ". "support NFS"); } elsif ($out =~ /Program not registered/) { &error("The host '$in{nfs_host}' does not support NFS"); } # Try a test mount to see if filesystem is available foreach (split(/\n/, $out)) { if (/^\s*([^ :]+):(\/\S+)\s+/) { $dirlist .= "$2\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>"); } $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 "ufs") { # Get the device name if ($in{ufs_dev} == 0) { $in{ufs_c} =~ /^[0-9]+$/ || &error("'$in{ufs_c}' is not a valid SCSI controller"); $in{ufs_t} =~ /^[0-9]+$/ || &error("'$in{ufs_t}' is not a valid SCSI target"); $in{ufs_d} =~ /^[0-9]+$/ || &error("'$in{ufs_d}' is not a valid SCSI unit"); $in{ufs_s} =~ /^[0-9]+$/ || &error("'$in{ufs_s}' is not a valid SCSI partition"); $dv = "/dev/dsk/c$in{ufs_c}t$in{ufs_t}d$in{ufs_d}s$in{ufs_s}"; } elsif ($in{ufs_dev} == 1) { $in{ufs_md} =~ /^[0-9]+$/ || &error("'$in{ufs_md}' is not a valid RAID unit"); $dv = "/dev/md/dsk/d$in{ufs_md}"; } else { $in{ufs_path} =~ /^\/\S+$/ || &error("'$in{ufs_path}' is not a valid pathname"); $dv = $in{ufs_path}; } &fstyp_check($dv, "ufs"); 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; }elsif ($_[0] eq "swap") { if ($in{swap_dev} == 0) { $in{swap_c} =~ /^[0-9]+$/ || &error("'$in{swap_c}' is not a valid SCSI controller"); $in{swap_t} =~ /^[0-9]+$/ || &error("'$in{swap_t}' is not a valid SCSI target"); $in{swap_d} =~ /^[0-9]+$/ || &error("'$in{swap_d}' is not a valid SCSI unit"); $in{swap_s} =~ /^[0-9]+$/ || &error("'$in{swap_s}' is not a valid SCSI partition"); $dv="/dev/dsk/c$in{swap_c}t$in{swap_t}d$in{swap_d}s$in{swap_s}"; } else { $dv = $in{swap_path}; } if (!open(SWAPFILE, $dv)) { if ($! =~ /No such file/ && $in{swap_dev}) { if ($dv !~ /^\/dev/) { &swap_form($dv); } else { &error("The swap file '$dv' does not exist"); } } elsif ($! =~ /No such file/) { &error("The SCSI target '$in{swap_t}' does not exist"); } elsif ($! =~ /No such device or address/) { &error("The partition '$in{swap_s}' does not exist"); } else { &error("Failed to open '$dv' : $!"); } } close(SWAPFILE); return $dv; }elsif ($_[0] eq "tmpfs") { # Ram-disk filesystems have no location return "swap"; }elsif ($_[0] eq "cachefs") { # In order to check the location for the caching filesystem, we need # to check the back filesystem if (!$in{cfs_noback}) { # The back filesystem is manually mounted.. hopefully local($bidx, @mlist, @binfo); $bidx = &get_mounted($in{cfs_backpath}, "*"); if ($bidx < 0) { &error("The back filesystem '$in{cfs_backpath}' is ". "not mounted"); } @mlist = &list_mounted(); @binfo = @{$mlist[$bidx]}; if ($binfo[2] ne $in{cfs_backfstype}) { &error("The back filesystem is '$binfo[2]', not ".
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -