⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mount-lib.pl.old

📁 Unix下基于Web的管理工具
💻 OLD
📖 第 1 页 / 共 3 页
字号:
	printf "<td nowrap><input type=radio name=lnx_ro value=1 %s> Yes\n",		defined($options{"ro"}) ? "checked" : "";	printf "<input type=radio name=lnx_ro value=0 %s> No</td>\n",		defined($options{"ro"}) ? "" : "checked";	print "<td><b>Buffer writes to filesystem?</b></td>\n";	printf"<td nowrap><input type=radio name=lnx_sync value=0 %s> Yes\n",		defined($options{"sync"}) ? "" : "checked";	printf "<input type=radio name=lnx_sync value=1 %s> No</td> </tr>\n",		defined($options{"sync"}) ? "checked" : "";	print "<tr> <td><b>Allow device files?</b></td>\n";	printf "<td nowrap><input type=radio name=lnx_nodev value=0 %s> Yes\n",		defined($options{"nodev"}) ? "" : "checked";	printf "<input type=radio name=lnx_nodev value=1 %s> No</td>\n",		defined($options{"nodev"}) ? "checked" : "";	print "<td><b>Allow execution of binaries?</b></td>\n";	printf"<td nowrap><input type=radio name=lnx_noexec value=0 %s> Yes\n",		defined($options{"noexec"}) ? "" : "checked";	printf "<input type=radio name=lnx_noexec value=1 %s> No</td> </tr>\n",		defined($options{"noexec"}) ? "checked" : "";	print "<tr> <td><b>Disallow setuid programs?</b></td>\n";	printf "<td nowrap><input type=radio name=lnx_nosuid value=1 %s> Yes\n",		defined($options{"nosuid"}) ? "checked" : "";	printf "<input type=radio name=lnx_nosuid value=0 %s> No</td>\n",		defined($options{"nosuid"}) ? "" : "checked";	print "<td><b>Allow users to mount this filesystem?</b></td>\n";	printf"<td nowrap><input type=radio name=lnx_user value=1 %s> Yes\n",		defined($options{"user"}) ? "checked" : "";	printf "<input type=radio name=lnx_user value=0 %s> No</td> </tr>\n",		defined($options{"user"}) ? "" : "checked";	}if ($_[0] eq "nfs" && $gconfig{os_type} =~ /linux$/) {	# Linux nfs has some more options...	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>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>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>NFS version</b></td>\n";	printf "<td nowrap><input type=radio name=nfs_vers_def value=1 %s> Highest\n",		defined($options{"nfs_vers"}) ? "" : "checked";	printf "<input type=radio name=nfs_vers_def value=0 %s>\n",		defined($options{"nfs_vers"}) ? "checked" : "";	print "<input size=1 name=nfs_vers value=$options{vers}></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>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>RPC Protocol</b></td>\n";	printf "<td nowrap><input type=radio name=nfs_tcp value=1 %s> TCP\n",		defined($options{"tcp"}) ? "checked" : "";	printf "<input type=radio name=nfs_tcp value=0 %s> UDP</td> </tr>\n",		defined($options{"tcp"}) ? "" : "checked";	}if (($_[0] eq "fat" || $_[0] eq "vfat" || $_[0] eq "msdos" ||     $_[0] eq "umsdos") && $gconfig{os_type} =~ /linux$/) {	# All dos-based filesystems share some options	print "<tr> <td><b>User files are owned by</b></td>\n";	print "<td><select name=fat_uid>\n";	printf "<option value=\"\" %s> Default\n",		defined($options{"uid"}) ? "" : "selected";	setpwent();	while(@uinfo = getpwent()) {		printf "<option value=\"$uinfo[2]\" %s> $uinfo[0]\n",		  defined($options{"uid"}) && $options{"uid"} == $uinfo[2] ?			"selected" : "";		}	endpwent(); print "</select></td>\n";	print "<td><b>Group files are owned by</b></td>\n";	print "<td><select name=fat_gid>\n";	printf "<option value=\"\" %s> Default\n",		defined($options{"gid"}) ? "" : "selected";	setgrent();	while(@ginfo = getgrent()) {		printf "<option value=\"$ginfo[2]\" %s> $ginfo[0]\n",		  defined($options{"gid"}) && $options{"gid"} == $ginfo[2] ?			"selected" : "";		}	endgrent(); print "</select></td> </tr>\n";	print "<tr> <td><b>File naming rules</b></td>\n";	print "<td><select name=fat_check>\n";	printf "<option value=\"\" %s> Default\n",		defined($options{"check"}) ? "" : "selected";	printf "<option value=r %s> Relaxed\n",		$options{"check"} =~ /^r/ ? "selected" : "";	printf "<option value=n %s> Normal\n",		$options{"check"} =~ /^n/ ? "selected" : "";	printf "<option value=s %s> Strict\n",		$options{"check"} =~ /^s/ ? "selected" : "";	print "</select></td>\n";	print "<td><b>DOS-Unix newline conversion</b></td>\n";	print "<td><select name=fat_conv>\n";	printf "<option value=\"\" %s> Default\n",		defined($options{"conv"}) ? "" : "selected";	printf "<option value=b %s> None\n",		$options{"conv"} =~ /^b/ ? "selected" : "";	printf "<option value=t %s> All files\n",		$options{"conv"} =~ /^t/ ? "selected" : "";	printf "<option value=a %s> Text files only\n",		$options{"conv"} =~ /^a/ ? "selected" : "";	print "</select></td> </tr>\n";	print "<tr> <td><b>File permissions mask</b></td>\n";	printf "<td><input type=radio name=fat_umask_def value=1 %s> Default\n",		defined($options{"umask"}) ? "" : "checked";	printf "<input type=radio name=fat_umask_def value=0 %s>\n",		defined($options{"umask"}) ? "checked" : "";	print "<input size=5 name=fat_umask value=\"$options{umask}\"></td>\n";	print "<td><b>Report errors on <tt>chown</tt> attempts?</b></td>\n";	printf "<td nowrap><input type=radio name=fat_quiet value=0 %s> Yes\n",		defined($options{"quiet"}) ? "" : "checked";	printf "<input type=radio name=fat_quiet value=1 %s> No</td> </tr>\n",		defined($options{"quiet"}) ? "checked" : "";	}if ($_[0] eq "vfat" && $gconfig{os_type} =~ /linux$/) {	# vfat has some extra options beyond fat	print "<tr> <td><b>Translate Unicode characters?</b></td>\n";	printf "<td><input type=radio name=fat_uni_xlate value=1 %s> Yes\n",		defined($options{"uni_xlate"}) ? "checked" : "";	printf "<input type=radio name=fat_uni_xlate value=0 %s> No</td>\n",		defined($options{"uni_xlate"}) ? "" : "checked";	print "<td><b>Allow names that differ only in case?</b></td>\n";	printf "<td nowrap><input type=radio name=fat_posix value=1 %s> Yes\n",		defined($options{"posix"}) ? "" : "checked";	printf "<input type=radio name=fat_posix value=0 %s> No</td> </tr>\n",		defined($options{"posix"}) ? "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" && $gconfig{os_type} eq "solaris") {	local($out, $temp, $mout, $dirlist);	# 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 = `/usr/sbin/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 = `$config{mount_command} $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	`$config{unmount_command} $temp`;	rmdir($temp);	return "$in{nfs_host}:$in{nfs_dir}";	}elsif ($_[0] eq "nfs" && $gconfig{os_type} eq "solaris") {	# 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};		}	# Use df to check if this is a valid filesystem	$out = `/usr/sbin/df -F ufs $dv 2>&1`;	if ($out =~ /is of type/) {		&error("'$dv' is not a UFS formatted filesystem");		}	elsif ($out =~ /not a block device/) {		&error("The SCSI target for '$dv' does not exist");		}	elsif ($out =~ /No such device/) {		&error("The disk partition for '$dv' does not exist");		}	elsif ($out =~ /Permission denied/) {		&error("Permission denied accessing the device '$dv'");		}	return $dv;	}}# check_options(type)# Read options for some filesystem from %in, and use them to update the# %options array. Options handled by the user interface will be set or# removed, while unknown options will be left untouched.sub check_options{local($k, @rv);if ($_[0] eq "nfs" && $gconfig{os_type} eq "solaris") {	if ($in{nfs_ro}) {		# read-only (and thus no quota)		$options{"ro"} = ""; delete($options{"rw"});		delete($options{"rq"}); delete($options{"quota"});		}	elsif ($in{nfs_quota}) {		# read-write, with quota		delete($options{"ro"}); $options{"rw"} = "";		$options{"quota"} = "";		}	else {		# read-write, without quota		delete($options{"ro"}); $options{"rw"} = "";		delete($options{"quota"});		}	delete($options{"nosuid"}); delete($options{"suid"});	if ($in{nfs_nosuid}) { $options{"nosuid"} = ""; }	delete($options{"grpid"});	if ($in{nfs_grpid}) { $options{"grpid"} = ""; }	delete($options{"soft"}); delete($options{"hard"});	if ($in{nfs_soft}) { $options{"soft"} = ""; }	delete($options{"bg"}); delete($options{"fg"});	if ($in{nfs_bg}) { $options{"bg"} = ""; }	delete($options{"intr"}); delete($options{"nointr"});	if ($in{nfs_intr}) { $options{"intr"} = ""; }	delete($options{"vers"});	if (!$in{nfs_vers_def}) { $options{"vers"} = $in{nfs_vers}; }	delete($options{"proto"});	if ($in{nfs_proto} ne "") { $options{"proto"} = $in{nfs_proto}; }	delete($options{"port"});	if (!$in{nfs_port_def}) { $options{"port"} = $in{nfs_port}; }	delete($options{"timeo"});	if (!$in{nfs_timeo_def}) { $options{"timeo"} = $in{nfs_timeo}; }	delete($options{"secure"});	if ($in{nfs_secure}) { $options{"secure"} = ""; }	delete($options{"kerberos"});	if ($in{nfs_kerberos}) { $options{"kerberos"} = ""; }	}# Return options stringforeach $k (keys %options) {	if ($options{$k} eq "") { push(@rv, $k); }	else { push(@rv, "$k=$options{$k}"); }	}return @rv ? join(',' , @rv) : "-";}# Include the correct OS-specific functions file$os_lib_file = "./$gconfig{os_type}-lib.pl";if (-r $os_lib_file) {	require $os_lib_file;	}else { die "This OS is not supported!"; }1;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -