2 # Filesystem functions for Solaris (works for me on 2.5)
4 $smbmount = &has_command("rumba") ? "rumba" :
5 &has_command("shlight") ? "shlight" : undef;
7 # Return information about a filesystem, in the form:
8 # directory, device, type, options, fsck_order, mount_at_boot
9 # If a field is unused or ignored, a - appears instead of the value.
10 # Swap-filesystems (devices or files mounted for VM) have a type of 'swap',
11 # and 'swap' in the directory field
14 return @list_mounts_cache if (@list_mounts_cache);
15 local(@rv, @p, $_, $i); $i = 0;
17 # List normal filesystem mounts
18 open(FSTAB, $config{fstab_file});
22 @p = split(/\s+/, $_);
23 if ($p[3] eq "swap") { $p[2] = "swap"; }
24 if ($p[3] eq "proc") { $p[0] = "proc"; }
25 $rv[$i++] = [ $p[2], $p[0], $p[3], $p[6], $p[4], $p[5] ];
29 # List automount points
30 open(AUTOTAB, $config{autofs_file});
33 if (!/\S/ || /^[+\-]/) { next; }
34 @p = split(/\s+/, $_);
35 if ($p[2] eq "") { $p[2] = "-"; }
36 else { $p[2] =~ s/^-//g; }
37 $rv[$i++] = [ $p[0], $p[1], "autofs", $p[2], "-", "yes" ];
41 @list_mounts_cache = @rv;
46 # create_mount(directory, device, type, options, fsck_order, mount_at_boot)
47 # Add a new entry to the fstab file, and return the index of the new entry
50 local($len, @mlist, $fcsk, $dir);
51 if ($_[2] eq "autofs") {
52 # An autofs mount.. add to /etc/auto_master
53 $len = grep { $_->[2] eq "autofs" } (&list_mounts());
54 &open_tempfile(AUTOTAB, ">> $config{autofs_file}");
55 &print_tempfile(AUTOTAB, "$_[0] $_[1]",($_[3] eq "-" ? "" : " -$_[3]"),"\n");
56 &close_tempfile(AUTOTAB);
59 # Add to the fstab file
60 $len = grep { $_->[2] ne "autofs" } (&list_mounts());
61 &open_tempfile(FSTAB, ">> $config{fstab_file}");
62 if ($_[2] eq "ufs" || $_[2] eq "s5fs") {
63 ($fsck = $_[1]) =~ s/\/dsk\//\/rdsk\//g;
66 if ($_[2] eq "swap") { $dir = "-"; }
67 else { $dir = $_[0]; }
68 &print_tempfile(FSTAB, "$_[1] $fsck $dir $_[2] $_[4] $_[5] $_[3]\n");
69 &close_tempfile(FSTAB);
71 undef(@list_mounts_cache);
77 # Delete some mount from the table
80 local(@fstab, $i, $line, $_);
81 open(FSTAB, $config{fstab_file});
86 &open_tempfile(FSTAB, "> $config{fstab_file}");
88 chop; ($line = $_) =~ s/#.*$//g;
89 if ($line =~ /\S/ && $i++ == $_[0]) {
90 # found the line not to include
92 else { &print_tempfile(FSTAB, $_,"\n"); }
94 &close_tempfile(FSTAB);
96 open(AUTOTAB, $config{autofs_file});
99 &open_tempfile(AUTOTAB, "> $config{autofs_file}");
101 chop; ($line = $_) =~ s/#.*$//g;
102 if ($line =~ /\S/ && $line !~ /^[+\-]/ && $i++ == $_[0]) {
103 # found line not to include..
105 else { &print_tempfile(AUTOTAB, $_,"\n"); }
107 &close_tempfile(AUTOTAB);
108 undef(@list_mounts_cache);
112 # change_mount(num, directory, device, type, options, fsck_order, mount_at_boot)
113 # Change an existing permanent mount
116 local(@fstab, @autotab, $i, $line, $fsck, $dir, $_);
119 open(FSTAB, $config{fstab_file});
122 &open_tempfile(FSTAB, "> $config{fstab_file}");
124 chop; ($line = $_) =~ s/#.*$//g;
125 if ($line =~ /\S/ && $i++ == $_[0]) {
126 # Found the line to replace
127 if ($_[3] eq "ufs" || $_[3] eq "s5fs") {
128 ($fsck = $_[2]) =~ s/\/dsk\//\/rdsk\//g;
130 else { $fsck = "-"; }
131 if ($_[3] eq "swap") { $dir = "-"; }
132 else { $dir = $_[1]; }
133 &print_tempfile(FSTAB, "$_[2] $fsck $dir $_[3] $_[5] $_[6] $_[4]\n");
135 else { &print_tempfile(FSTAB, $_,"\n"); }
137 &close_tempfile(FSTAB);
139 open(AUTOTAB, $config{autofs_file});
140 @autotab = <AUTOTAB>;
142 &open_tempfile(AUTOTAB, "> $config{autofs_file}");
144 chop; ($line = $_) =~ s/#.*$//g;
145 if ($line =~ /\S/ && $line !~ /^[+\-]/ && $i++ == $_[0]) {
146 # Found the line to replace
147 &print_tempfile(AUTOTAB, "$_[1] $_[2] ",
148 ($_[4] eq "-" ? "" : "-$_[4]"),"\n");
150 else { &print_tempfile(AUTOTAB, $_,"\n"); }
152 &close_tempfile(AUTOTAB);
153 undef(@list_mounts_cache);
158 # Return a list of all the currently mounted filesystems and swap files.
159 # The list is in the form:
160 # directory device type options
161 # For swap files, the directory will be 'swap'
164 return @list_mounted_cache if (@list_mounted_cache);
165 local(@rv, @p, $_, $i, $r);
166 &open_execute_command(SWAP, "swap -l 2>/dev/null", 1, 1);
168 if (/^(\/\S+)\s+/) { push(@rv, [ "swap", $1, "swap", "-" ]); }
171 &open_tempfile(MNTTAB, "/etc/mnttab");
173 s/#.*$//g; if (!/\S/) { next; }
174 @p = split(/\s+/, $_);
175 if ($p[0] =~ /:vold/) { next; }
176 if ($p[0] =~ /^(rumba|shlight)-(\d+)$/) {
178 local($args, $ps); $p[3] = "pid=$2";
179 $ps = (-x "/usr/ucb/ps") ? "/usr/ucb/ps auwwwwx $2"
180 : "ps -o args -f $2";
181 &backquote_command($ps, 1) =~ /(rumba|shlight)\s+\/\/([^\/]+)\/(.*\S)\s+(\/\S+)(.*)/ || next;
182 $serv = $2; $shar = $3; $p[2] = "rumba"; $args = $5;
183 if ($args =~ /\s+-s\s+(\S+)/ && $1 ne $serv) {
184 $p[0] = "\\\\$1\\$shar";
185 $p[3] .= ",machinename=$serv";
187 else { $p[0] = "\\\\$serv\\$shar"; }
188 if ($args =~ /\s+-c\s+(\S+)/) { $p[3] .= ",clientname=$1"; }
189 if ($args =~ /\s+-U\s+(\S+)/) { $p[3] .= ",username=$1"; }
190 if ($args =~ /\s+-u\s+(\S+)/) { $p[3] .= ",uid=$1"; }
191 if ($args =~ /\s+-g\s+(\S+)/) { $p[3] .= ",gid=$1"; }
192 if ($args =~ /\s+-f\s+(\S+)/) { $p[3] .= ",fmode=$1"; }
193 if ($args =~ /\s+-d\s+(\S+)/) { $p[3] .= ",dmode=$1"; }
194 if ($args =~ /\s+-C/) { $p[3] .= ",noupper"; }
195 if ($args =~ /\s+-P\s+(\S+)/) { $p[3] .= ",password=$1"; }
196 if ($args =~ /\s+-S/) { $p[3] .= ",readwrite"; }
197 if ($args =~ /\s+-w/) { $p[3] .= ",readonly"; }
198 if ($args =~ /\s+-e/) { $p[3] .= ",attr"; }
200 else { $p[3] = join(',' , (grep {!/^dev=/} split(/,/ , $p[3]))); }
201 push(@rv, [ $p[1], $p[0], $p[2], $p[3] ]);
203 &close_tempfile(MNTTAB);
205 if ($r->[2] eq "cachefs" && $r->[1] =~ /\.cfs_mnt_points/) {
206 # Oh no.. a caching filesystem mount. Fiddle things so that
208 for($i=0; $i<@rv; $i++) {
209 if ($rv[$i]->[0] eq $r->[1]) {
210 # Found the automatically mounted entry. lose it
211 $r->[1] = $rv[$i]->[1];
218 @list_mounted_cache = @rv;
223 # mount_dir(directory, device, type, options)
224 # Mount a new directory from some device, with some options. Returns 0 if ok,
225 # or an error string if failed. If the directory is 'swap', then mount as
230 if ($_[0] eq "swap") {
231 # Adding a swap device
232 $out = &backquote_logged("swap -a $_[1] 2>&1");
233 if ($?) { return $out; }
236 # Mounting a directory
237 if ($_[2] eq "cachefs") {
238 # Mounting a caching filesystem.. need to create cache first
240 &parse_options("cachefs", $_[3]);
241 if (!(-r "$options{cachedir}/.cfs_resource")) {
242 # The cache directory does not exist.. set it up
243 if (-d $options{cachedir} &&
244 !rmdir($options{"cachedir"})) {
245 return &text('solaris_ecacheexists',
246 $options{'cachedir'});
248 $out = &backquote_logged("cfsadmin -c $options{cachedir} 2>&1");
249 if ($?) { return $out; }
252 if ($_[2] eq "rumba") {
253 # call 'rumba' to mount
254 local(%options, $shortname, $shar, $opts, $rv);
255 &parse_options("rumba", $_[3]);
256 $shortname = &get_system_hostname();
257 if ($shortname =~ /^([^\.]+)\.(.+)$/) { $shortname = $1; }
258 $_[1] =~ /^\\\\(.+)\\(.+)$/;
259 $shar = "//".($options{machinename} ?$options{machinename} :$1).
262 (defined($options{'clientname'}) ?
263 "-c $options{'clientname'} " : "-c $shortname ").
264 (defined($options{'username'}) ?
265 "-U $options{'username'} " : "").
266 (defined($options{'uid'}) ? "-u $options{'uid'} " : "").
267 (defined($options{'gid'}) ? "-g $options{'gid'} " : "").
268 (defined($options{'fmode'}) ? "-f $options{'fmode'} " : "").
269 (defined($options{'dmode'}) ? "-d $options{'dmode'} " : "").
270 (defined($options{'noupper'}) ? "-C " : "").
271 (defined($options{'password'}) ?
272 "-P $options{'password'} " : "-n ").
273 (defined($options{'readwrite'}) ? "-S " : "").
274 (defined($options{'readonly'}) ? "-w " : "").
275 (defined($options{'attr'}) ? "-e " : "");
276 local $rtemp = &transname();
277 $rv = &system_logged("rumba \"$shar\" $_[0] $opts >$rtemp 2>&1 </dev/null");
278 $out = `cat $rtemp`; unlink($rtemp);
279 if ($rv) { return "<pre>$out</pre> : rumba \"$shar\" $_[0] $opts"; }
282 $opts = $_[3] eq "-" ? "" : "-o \"$_[3]\"";
283 $out = &backquote_logged("mount -F $_[2] $opts -- $_[1] $_[0] 2>&1");
284 if ($?) { return $out; }
287 undef(@list_mounted_cache);
292 # unmount_dir(directory, device, type)
293 # Unmount a directory (or swap device) that is currently mounted. Returns 0 if
294 # ok, or an error string if failed
297 if ($_[0] eq "swap") {
298 $out = &backquote_logged("swap -d $_[1] 2>&1");
300 elsif ($_[2] eq "rumba") {
301 # kill the process (if nobody is in the directory)
303 if (&backquote_command("fuser -c $_[0] 2>/dev/null", 1) =~ /\d/) {
304 return &text('solaris_ebusy', $_[0]);
306 if (&backquote_command("cat /etc/mnttab", 1) =~
307 /(rumba|shlight)-(\d+)\s+$dir\s+nfs/) {
308 &kill_logged('TERM', $2) || return $text{'solaris_ekill'};
311 return $text{'solaris_epid'};
316 $out = &backquote_logged("umount $_[0] 2>&1");
318 undef(@list_mounted_cache);
319 if ($?) { return $out; }
324 # disk_space(type, directory)
325 # Returns the amount of total and free space for some filesystem, or an
326 # empty array if not appropriate.
329 if (&get_mounted($_[1], "*") < 0) { return (); }
330 if ($_[0] eq "fd" || $_[0] eq "proc" || $_[0] eq "swap" || $_[0] eq "autofs") {
333 if (&backquote_command("df -k ".quotemeta($_[1]), 1) =~
334 /Mounted on\n\S+\s+(\S+)\s+(\S+)\s+(\S+)/) {
336 # Size is sometimes zero on Solaris? Fake it..
348 # Returns an array of all the supported filesystem types. If a filesystem is
349 # found that is not one of the supported types, generate_location() and
350 # generate_options() will not be called for it.
353 local @fs = ("ufs", "nfs", "hsfs", "pcfs", "lofs", "cachefs",
354 "swap", "tmpfs", "autofs");
355 if (&running_in_zone()) {
356 # Only the filesystems are available in zones
357 @fs = ( "tmpfs", "autofs", "nfs" );
359 push(@fs, $smbmount) if ($smbmount);
360 push(@fs, "udfs") if ($gconfig{'os_version'} >= 8);
361 push(@fs, "xmemfs") if ($gconfig{'os_version'} >= 8 &&
362 $gconfig{'os_version'} <= 10);
368 # Given a short filesystem type, return a human-readable name for it
372 %fsmap = ("ufs","Solaris Unix Filesystem",
373 "nfs","Network Filesystem",
374 "hsfs","ISO9660 CD-ROM",
375 "pcfs","MS-DOS Filesystem",
376 "lofs","Loopback Filesystem",
377 "cachefs","Caching Filesystem",
378 "swap","Virtual Memory",
380 "xmemfs","Large RAM Disk",
381 "autofs","Automounter Filesystem",
382 "proc","Process Image Filesystem",
383 "fd","File Descriptor Filesystem",
384 "mntfs","Filesystems List",
385 "udfs","DVD Filesystem",
386 "rumba","Windows Networking Filesystem");
387 return $config{long_fstypes} && $fsmap{$_[0]} ? $fsmap{$_[0]} : uc($_[0]);
392 # Given a filesystem type, returns 4 numbers that determine how the file
393 # system can be mounted, and whether it can be fsck'd
396 if ($_[0] eq "ufs" || $_[0] eq "cachefs" || $_[0] eq "s5fs") {
399 elsif ($_[0] eq "rumba") { return (0, 1, 0, 0); }
400 else { return (2, 1, 0, 0); }
404 # multiple_mount(type)
405 # Returns 1 if filesystems of this type can be mounted multiple times, 0 if not
408 return ($_[0] eq "nfs" || $_[0] eq "tmpfs" || $_[0] eq "cachefs" ||
409 $_[0] eq "autofs" || $_[0] eq "lofs" || $_[0] eq "rumba" || $_[0] eq "xmemfs");
413 # generate_location(type, location)
414 # Output HTML for editing the mount location of some filesystem.
415 sub generate_location
417 if ($_[0] eq "nfs") {
418 # NFS mount from some host and directory
419 if ($_[1] =~ /^nfs:/) { $nfsmode = 2; }
420 elsif (!$_[1] || $_[1] =~ /^([A-z0-9\-\.]+):([^,]+)$/) {
421 $nfsmode = 0; $nfshost = $1; $nfspath = $2;
423 else { $nfsmode = 1; }
424 if ($gconfig{'os_version'} >= 2.6) {
425 # Solaris 2.6 can list multiple NFS servers in mount
426 print "<tr> <td><b>$text{'solaris_nsource'}</b></td>\n";
427 printf "<td><input type=radio name=nfs_serv value=0 %s>\n",
428 $nfsmode == 0 ? "checked" : "";
429 print "<b>$text{'solaris_nhost'}</b></td>\n";
430 print "<td><input name=nfs_host size=20 value=\"$nfshost\">\n";
431 &nfs_server_chooser_button("nfs_host");
432 print " <b>$text{'solaris_ndir'}</b>\n";
433 print "<input name=nfs_dir size=20 value=\"$nfspath\">\n";
434 &nfs_export_chooser_button("nfs_host", "nfs_dir");
435 print "</td> </tr>\n";
437 print "<tr> <td></td>\n";
438 printf "<td><input type=radio name=nfs_serv value=1 %s>\n",
439 $nfsmode == 1 ? "checked" : "";
440 print "<b>$text{'solaris_nmult'}</b></td>\n";
441 printf "<td><input name=nfs_list size=40 value=\"%s\">\n",
442 $nfsmode == 1 ? $_[1] : "";
443 print "</td> </tr>\n";
445 if ($gconfig{'os_version'} >= 7) {
446 print "<tr> <td></td> <td>\n";
447 printf "<input type=radio name=nfs_serv value=2 %s>\n",
448 $nfsmode == 2 ? "checked" : "";
449 print "<b>$text{'solaris_webnfs'}</b></td> <td>\n";
450 printf "<input name=nfs_url size=40 value=\"%s\">\n",
451 $nfsmode == 2 ? $_[1] : "";
452 print "</td> </tr>\n";
456 print "<tr> <td><b>$text{'solaris_nhost'}</b></td>\n";
457 print "<td><input name=nfs_host size=20 value=\"$nfshost\">\n";
458 &nfs_server_chooser_button("nfs_host");
460 print "<td><b>$text{'solaris_ndir'}</b></td>\n";
461 print "<td><input name=nfs_dir size=20 value=\"$nfspath\">\n";
462 &nfs_export_chooser_button("nfs_host", "nfs_dir");
463 print "</td> </tr>\n";
466 elsif ($_[0] eq "tmpfs" || $_[0] eq "xmemfs") {
467 # Location is irrelevant for tmpfs and xmemfs filesystems
469 elsif ($_[0] eq "ufs") {
470 # Mounted from a normal disk, raid (MD) device or from
472 print "<tr> <td valign=top><b>$text{'solaris_ufs'}</b></td>\n";
473 print "<td colspan=3>\n";
474 &foreign_require("format");
476 if ($_[1] =~ /^\/dev\/dsk\/c([0-9]+)t([0-9]+)d([0-9]+)s([0-9]+)$/ ||
477 $_[1] =~ /^\/dev\/dsk\/c([0-9]+)d([0-9]+)s([0-9]+)$/) {
480 elsif ($_[1] eq "") {
483 elsif ($_[1] =~ /^\/dev\/md\/dsk\/d([0-9]+)$/) {
491 local $sel = &format::partition_select("ufs_disk", $_[1], 0,
492 $ufs_dev ? \$found : undef);
493 printf "<input type=radio name=ufs_dev value=0 %s> %s : %s<br>\n",
494 $ufs_dev == 0 ? "checked" : "", $text{'solaris_scsi'}, $sel;
496 printf "<input type=radio name=ufs_dev value=1 %s> %s :\n",
497 $ufs_dev == 1 ? "checked" : "",
498 $text{'solaris_raid'};
499 printf "%s <input name=ufs_md size=3 value=\"%s\"><br>\n",
500 $text{'solaris_unit'},
501 $_[1] =~ /^\/dev\/md\/dsk\/d([0-9]+)$/ ? $1 : "";
503 printf "<input type=radio name=ufs_dev value=2 %s> %s :\n",
504 $ufs_dev == 2 ? "checked" : "", $text{'solaris_otherdev'};
505 printf "<input name=ufs_path size=20 value=\"%s\"><br>\n",
506 $ufs_dev == 2 ? $_[1] : "";
507 print "</td> </tr>\n";
509 elsif ($_[0] eq "swap") {
510 # Swapping to a disk partition or a file
511 print "<tr> <td valign=top><b>$text{'solaris_swapfile'}</b></td>\n";
512 print "<td colspan=3>\n";
513 &foreign_require("format");
515 if ($_[1] =~ /^\/dev\/dsk\/c([0-9]+)t([0-9]+)d([0-9]+)s([0-9]+)$/ ||
516 $_[1] =~ /^\/dev\/dsk\/c([0-9]+)d([0-9]+)s([0-9]+)$/) {
519 elsif ($_[1] eq "") {
527 local $sel = &format::partition_select("swap_disk", $_[1], 0,
528 $swap_dev ? \$found : undef);
529 printf "<input type=radio name=swap_dev value=0 %s> %s : %s<br>\n",
530 $swap_dev == 0 ? "checked" : "", $text{'solaris_scsi'}, $sel;
532 printf "<input type=radio name=swap_dev value=1 %s> %s :\n",
533 $swap_dev == 1 ? "checked" : "", $text{'solaris_file'};
534 printf "<input name=swap_path size=20 value=\"%s\"><br>\n",
535 $swap_dev == 1 ? $_[1] : "";
536 print "</td> </tr>\n";
538 elsif ($_[0] eq "hsfs" || $_[0] eq "udfs") {
539 # Mounting a SCSI cdrom or DVD
540 if ($_[0] eq "hsfs") {
541 print "<tr> <td valign=top><b>$text{'solaris_cdrom'}</b></td>\n";
544 print "<tr> <td valign=top><b>$text{'solaris_dvd'}</b></td>\n";
546 print "<td colspan=3>\n";
547 if ($_[1] =~ /^\/dev\/dsk\/c([0-9]+)t([0-9]+)d([0-9]+)s([0-9]+)$/) {
549 $scsi_c = $1; $scsi_t = $2; $scsi_d = $3; $scsi_s = $4;
551 elsif ($_[1] eq "") {
553 $scsi_c = 0; $scsi_t = 6; $scsi_d = 0; $scsi_s = 0;
556 $hsfs_dev = 2; $scsi_path = $_[1];
558 printf "<input type=radio name=ufs_dev value=0 %s> $text{'solaris_scsi'}:\n",
559 $hsfs_dev == 0 ? "checked" : "";
560 print "$text{'solaris_ctrlr'} <input name=ufs_c size=3 value=\"$scsi_c\">\n";
561 print "$text{'solaris_target'} <input name=ufs_t size=3 value=\"$scsi_t\">\n";
562 print "$text{'solaris_unit'} <input name=ufs_d size=3 value=\"$scsi_d\">\n";
563 print "$text{'solaris_part'} <input name=ufs_s size=3 value=\"$scsi_s\"><br>\n";
565 printf "<input type=radio name=ufs_dev value=2 %s> $text{'solaris_otherdev'}:\n",
566 $hsfs_dev == 2 ? "checked" : "";
567 print "<input name=ufs_path size=20 value=\"$scsi_path\"><br>\n";
568 print "</td> </tr>\n";
570 elsif ($_[0] eq "pcfs") {
571 # Mounting a SCSI msdos filesystem
572 print "<tr> <td valign=top><b>$text{'solaris_msdos'}</b></td>\n";
573 print "<td colspan=3>\n";
574 &foreign_require("format");
576 if ($_[1] =~ /^\/dev\/dsk\/c([0-9]+)t([0-9]+)d([0-9]+)s([0-9]+)$/ ||
577 $_[1] =~ /^\/dev\/dsk\/c([0-9]+)d([0-9]+)s([0-9]+)$/) {
580 elsif ($_[1] eq "") {
588 local $sel = &format::partition_select("ufs_disk", $_[1], 0,
589 $pcfs_dev ? \$found : undef);
590 printf "<input type=radio name=ufs_dev value=0 %s> %s : %s<br>\n",
591 $pcfs_dev == 0 ? "checked" : "", $text{'solaris_scsi'}, $sel;
593 printf "<input type=radio name=ufs_dev value=2 %s> %s :\n",
594 $pcfs_dev == 2 ? "checked" : "", $text{'solaris_file'};
595 printf "<input name=ufs_path size=20 value=\"%s\"><br>\n",
596 $pcfs_dev == 2 ? $_[1] : "";
597 print "</td> </tr>\n";
599 elsif ($_[0] eq "lofs") {
600 # Mounting some directory to another location
601 print "<tr> <td><b>$text{'solaris_orig'}</b></td>\n";
602 print "<td><input name=lofs_src size=30 value=\"$_[1]\">\n";
603 print &file_chooser_button("lofs_src", 1);
604 print "</td> </tr>\n";
606 elsif ($_[0] eq "cachefs") {
607 # Mounting a cached filesystem of some type.. need a location for
608 # the source of the mount
609 print "<tr> <td><b>$text{'solaris_cache'}</b></td>\n";
610 print "<td><input name=cfs_src size=20 value=\"$_[1]\"></td> </tr>\n";
612 elsif ($_[0] eq "autofs") {
613 # An automounter entry.. can be -hosts, -xfn or from some mapping
614 print "<tr> <td valign=top><b>$text{'solaris_automap'}</b></td>\n";
615 printf "<td><input type=radio name=autofs_type value=0 %s>\n",
616 $_[1] eq "-hosts" || $_[1] eq "-xfn" ? "" : "checked";
617 printf "Use map <input name=autofs_map size=20 value=\"%s\"><br>\n",
618 $_[1] eq "-hosts" || $_[1] eq "-xfn" ? "" : $_[1];
619 printf "<input type=radio name=autofs_type value=1 %s>\n",
620 $_[1] eq "-hosts" ? "checked" : "";
621 print "$text{'solaris_autohosts'}<br>\n";
622 printf "<input type=radio name=autofs_type value=2 %s>\n",
623 $_[1] eq "-xfn" ? "checked" : "";
624 print "$text{'solaris_autoxfn'}</td> </tr>\n";
626 elsif ($_[0] eq "rumba") {
628 $_[1] =~ /^\\\\(.*)\\(.*)$/;
629 print "<tr> <td><b>$text{'solaris_server'}</b></td>\n";
630 print "<td><input name=rumba_server value=\"$1\" size=20>\n";
631 &smb_server_chooser_button("rumba_server");
633 print "<td><b>$text{'solaris_share'}</b></td>\n";
634 print "<td><input name=rumba_share value=\"$2\" size=20>\n";
635 &smb_share_chooser_button("rumba_server", "rumba_share");
636 print "</td> </tr>\n";
641 # generate_options(type, newmount)
642 # Output HTML for editing mount options for a partilcar filesystem
646 if ($_[0] eq "nfs") {
647 # Solaris NFS has many options, not all of which are editable here
648 print "<tr> <td><b>$text{'solaris_ro'}</b></td>\n";
649 printf "<td nowrap><input type=radio name=nfs_ro value=1 %s> $text{'yes'}\n",
650 defined($options{"ro"}) ? "checked" : "";
651 printf "<input type=radio name=nfs_ro value=0 %s> $text{'no'}</td>\n",
652 defined($options{"ro"}) ? "" : "checked";
654 print "<td><b>$text{'solaris_nosuid'}</b></td>\n";
655 printf "<td nowrap><input type=radio name=nfs_nosuid value=1 %s> $text{'yes'}\n",
656 defined($options{"nosuid"}) ? "checked" : "";
657 printf "<input type=radio name=nfs_nosuid value=0 %s> $text{'no'}</td> </tr>\n",
658 defined($options{"nosuid"}) ? "" : "checked";
660 print "<tr> <td><b>$text{'solaris_grpid'}</b></td>\n";
661 printf "<td nowrap><input type=radio name=nfs_grpid value=0 %s> $text{'yes'}\n",
662 defined($options{"grpid"}) ? "" : "checked";
663 printf "<input type=radio name=nfs_grpid value=1 %s> $text{'no'}</td>\n",
664 defined($options{"grpid"}) ? "checked" : "";
666 print "<td><b>$text{'solaris_soft'}</b></td>\n";
667 printf "<td nowrap><input type=radio name=nfs_soft value=1 %s> $text{'yes'}\n",
668 defined($options{"soft"}) ? "checked" : "";
669 printf "<input type=radio name=nfs_soft value=0 %s> $text{'no'}</td> </tr>\n",
670 defined($options{"soft"}) ? "" : "checked";
672 print "<tr> <td><b>$text{'solaris_bg'}</b></td>\n";
673 printf "<td nowrap><input type=radio name=nfs_bg value=1 %s> $text{'yes'}\n",
674 defined($options{"bg"}) ? "checked" : "";
675 printf "<input type=radio name=nfs_bg value=0 %s> $text{'no'}</td>\n",
676 defined($options{"bg"}) ? "" : "checked";
678 print "<td><b>$text{'solaris_quota'}</b></td>\n";
679 printf "<td nowrap><input type=radio name=nfs_quota value=1 %s> $text{'yes'}\n",
680 defined($options{"quota"}) ? "checked" : "";
681 printf "<input type=radio name=nfs_quota value=0 %s> $text{'no'}</td> </tr>\n",
682 defined($options{"quota"}) ? "" : "checked";
684 print "<tr> <td><b>$text{'solaris_nointr'}</b></td>\n";
685 printf "<td nowrap><input type=radio name=nfs_nointr value=0 %s> $text{'yes'}\n",
686 defined($options{"nointr"}) ? "" : "checked";
687 printf "<input type=radio name=nfs_nointr value=1 %s> $text{'no'}</td>\n",
688 defined($options{"nointr"}) ? "checked" : "";
690 print "<td><b>$text{'solaris_nfsver'}</b></td>\n";
691 printf "<td nowrap><input type=radio name=nfs_vers_def value=1 %s> $text{'solaris_highest'}\n",
692 defined($options{"vers"}) ? "" : "checked";
693 printf "<input type=radio name=nfs_vers_def value=0 %s>\n",
694 defined($options{"vers"}) ? "checked" : "";
695 print "<input size=2 name=nfs_vers value=$options{vers}></td> </tr>\n";
697 print "<tr> <td><b>$text{'solaris_proto'}</b></td>\n";
698 print "<td nowrap><select name=proto>\n";
699 printf "<option value=\"\" %s> $text{'default'}\n",
700 defined($options{"proto"}) ? "" : "selected";
701 &open_tempfile(NETCONFIG, "/etc/netconfig");
703 if (!/^([A-z0-9\_\-]+)\s/) { next; }
704 printf "<option value=\"$1\" %s> $1\n",
705 $options{"proto"} eq $1 ? "selected" : "";
707 &close_tempfile(NETCONFIG);
708 print "</select></td>\n";
710 print "<td><b>$text{'solaris_port'}</b></td>\n";
711 printf "<td nowrap><input type=radio name=nfs_port_def value=1 %s> $text{'default'}\n",
712 defined($options{"port"}) ? "" : "checked";
713 printf "<input type=radio name=nfs_port_def value=0 %s>\n",
714 defined($options{"port"}) ? "checked" : "";
715 print "<input size=5 name=nfs_port value=$options{port}></td> </tr>\n";
717 print "<tr> <td><b>$text{'solaris_timeo'}</b></td>\n";
718 printf "<td nowrap><input type=radio name=nfs_timeo_def value=1 %s> $text{'default'}\n",
719 defined($options{"timeo"}) ? "" : "checked";
720 printf "<input type=radio name=nfs_timeo_def value=0 %s>\n",
721 defined($options{"timeo"}) ? "checked" : "";
722 printf "<input size=5 name=nfs_timeo value=$options{timeo}></td>\n";
724 print "<td><b>$text{'solaris_retrans'}</b></td>\n";
725 printf "<td nowrap><input type=radio name=nfs_retrans_def value=1 %s> $text{'default'}\n",
726 defined($options{"retrans"}) ? "" : "checked";
727 printf "<input type=radio name=nfs_retrans_def value=0 %s>\n",
728 defined($options{"retrans"}) ? "checked" : "";
729 print "<input size=5 name=nfs_retrans value=$options{retrans}></td> </tr>\n";
731 print "<tr> <td><b>$text{'solaris_auth'}</b></td>\n";
732 $nfs_auth = $options{'sec'} ? $options{'sec'} :
733 defined($options{"secure"}) ? "dh" :
734 defined($options{"kerberos"}) ? "krb" : "";
735 print "<td><select name=nfs_auth>\n";
736 printf "<option value=\"\" %s> $text{'solaris_none'}\n",
737 $nfs_auth eq "" ? "selected" : "";
738 printf "<option value=dh %s> $text{'solaris_des'}\n",
739 $nfs_auth eq "dh" ? "selected" : "";
740 printf "<option value=krb %s> $text{'solaris_krb'}\n",
741 $nfs_auth eq "krb" ? "selected" : "";
742 print "</select></td>\n";
744 if ($gconfig{'os_version'} >= 7) {
745 print "<td><b>$text{'solaris_public'}</b></td> <td>\n";
746 printf "<input type=radio name=nfs_public value=1 %s> $text{'yes'}\n",
747 defined($options{'public'}) ? "checked" : "";
748 printf "<input type=radio name=nfs_public value=0 %s> $text{'no'}\n",
749 defined($options{'public'}) ? "" : "checked";
754 if ($_[0] eq "ufs") {
755 # Solaris UFS also has many options, not all of which are here
756 print "<tr> <td><b>$text{'solaris_ro'}</b></td>\n";
757 printf "<td nowrap><input type=radio name=ufs_ro value=1 %s> $text{'yes'}\n",
758 defined($options{"ro"}) ? "checked" : "";
759 printf "<input type=radio name=ufs_ro value=0 %s> $text{'no'}</td>\n",
760 defined($options{"ro"}) ? "" : "checked";
762 print "<td><b>$text{'solaris_nosuid'}</b></td>\n";
763 printf "<td nowrap><input type=radio name=ufs_nosuid value=1 %s> $text{'yes'}\n",
764 defined($options{"nosuid"}) ? "checked" : "";
765 printf "<input type=radio name=ufs_nosuid value=0 %s> $text{'no'}</td> </tr>\n",
766 defined($options{"nosuid"}) ? "" : "checked";
768 print "<tr> <td><b>$text{'solaris_nointr'}</b></td>\n";
769 printf "<td nowrap><input type=radio name=ufs_nointr value=0 %s> $text{'yes'}\n",
770 defined($options{"nointr"}) ? "" : "checked";
771 printf "<input type=radio name=ufs_nointr value=1 %s> $text{'no'}</td>\n",
772 defined($options{"nointr"}) ? "checked" : "";
774 print "<td><b>$text{'solaris_quotab'}</b></td>\n";
775 printf "<td nowrap><input type=radio name=ufs_quota value=1 %s> $text{'yes'}\n",
776 defined($options{"quota"}) || defined($options{"rq"}) ?
778 printf "<input type=radio name=ufs_quota value=0 %s> $text{'no'}</td> </tr>\n",
779 defined($options{"quota"}) || defined($options{"rq"}) ?
782 print "<tr> <td><b>$text{'solaris_onerror'}</b></td>\n";
783 print "<td><select name=ufs_onerror>\n";
784 foreach ('panic', 'lock', 'umount', 'repair') {
785 next if ($_ eq "repair" && $gconfig{'os_version'} >= 10);
786 printf "<option value=\"$_\" %s> $_\n",
787 $options{onerror} eq $_ ||
788 !defined($options{onerror}) && $_ eq "panic" ? "selected" : "";
790 print "</select></td>\n";
792 if ($gconfig{'os_version'} >= 7) {
793 print "<td><b>$text{'solaris_noatime'}</b></td> <td>\n";
794 if ($gconfig{'os_version'} >= 8) {
795 printf "<input type=radio name=ufs_noatime value=0 %s> $text{'solaris_immed'}\n",
796 defined($options{'nodfratime'}) ? "checked" : "";
797 printf "<input type=radio name=ufs_noatime value=1 %s> $text{'solaris_defer'}\n",
798 !defined($options{'nodfratime'}) &&
799 !defined($options{'noatime'}) ? "checked" : "";
800 printf "<input type=radio name=ufs_noatime value=2 %s> $text{'no'}</td> </tr>\n",
801 defined($options{'noatime'}) ? "checked" : "";
804 printf "<input type=radio name=ufs_noatime value=0 %s> $text{'yes'}\n",
805 defined($options{'noatime'}) ? "" : "checked";
806 printf "<input type=radio name=ufs_noatime value=1 %s> $text{'no'}</td> </tr>\n",
807 defined($options{'noatime'}) ? "checked" : "";
810 print "<tr> <td><b>$text{'solaris_force'}</b></td> <td>\n";
811 printf "<input type=radio name=ufs_force value=1 %s> $text{'yes'}\n",
812 defined($options{'forcedirectio'}) ? "checked" : "";
813 printf "<input type=radio name=ufs_force value=0 %s> $text{'no'}</td>\n",
814 defined($options{'forcedirectio'}) ? "" : "checked";
816 print "<td><b>$text{'solaris_nolarge'}</td> <td>\n";
817 printf "<input type=radio name=ufs_nolarge value=0 %s> $text{'yes'}\n",
818 defined($options{'nolargefiles'}) ? "" : "checked";
819 printf "<input type=radio name=ufs_nolarge value=1 %s> $text{'no'}</td> </tr>\n",
820 defined($options{'nolargefiles'}) ? "checked" : "";
822 print "<tr> <td><b>$text{'solaris_logging'}</td> <td>\n";
823 printf "<input type=radio name=ufs_logging value=1 %s> $text{'yes'}\n",
824 defined($options{'logging'}) ? "checked" : "";
825 printf "<input type=radio name=ufs_logging value=0 %s> $text{'no'}</td> </tr>\n",
826 defined($options{'logging'}) ? "" : "checked";
829 print "<td><b>$text{'solaris_toosoon'}</b></td>\n";
830 $options{toosoon} =~ /([0-9]+)([A-z])/;
831 print "<td nowrap><input size=5 name=ufs_toosoon_time value='$1'>\n";
832 print "<select name=ufs_toosoon_units>\n";
833 foreach $u ('s', 'm', 'h', 'd', 'w', 'y') {
834 printf "<option value=%s %s> %s\n",
835 $u, $2 eq $u ? "selected" : "", $text{"solaris_time_$u"};
837 print "</select></td> </tr>\n";
840 if ($_[0] eq "hsfs") {
841 # Solaris hsfs is used for CDROMs
842 print "<tr> <td><b>$text{'solaris_nrr'}</b></td>\n";
843 printf "<td nowrap><input type=radio name=hsfs_nrr value=1 %s> $text{'yes'}\n",
844 defined($options{"nrr"}) ? "checked" : "";
845 printf "<input type=radio name=hsfs_nrr value=0 %s> $text{'no'}</td>\n",
846 defined($options{"nrr"}) ? "" : "checked";
848 print "<td><b>$text{'solaris_notraildot'}</b></td>\n";
849 printf "<td nowrap><input type=radio name=hsfs_notraildot value=1 %s> $text{'yes'}\n",
850 defined($options{"notraildot"}) ? "checked" : "";
851 printf "<input type=radio name=hsfs_notraildot value=0 %s> $text{'no'}</td> </tr>\n",
852 defined($options{"notraildot"}) ? "" : "checked";
854 print "<tr> <td><b>$text{'solaris_nomaplcase'}</b></td>\n";
855 printf "<td nowrap><input type=radio name=hsfs_nomaplcase value=0 %s> $text{'yes'}\n",
856 defined($options{"nomaplcase"}) ? "" : "checked";
857 printf "<input type=radio name=hsfs_nomaplcase value=1 %s> $text{'no'}</td>\n",
858 defined($options{"nomaplcase"}) ? "checked" : "";
860 print "<td><b>$text{'solaris_nosuid'}</b></td>\n";
861 printf"<td nowrap><input type=radio name=hsfs_nosuid value=1 %s> $text{'yes'}\n",
862 defined($options{"nosuid"}) ? "checked" : "";
863 printf "<input type=radio name=hsfs_nosuid value=0 %s> $text{'no'}</td> </tr>\n",
864 defined($options{"nosuid"}) ? "" : "checked";
866 if ($_[0] eq "pcfs") {
867 # Solaris pcfs for for FAT filesystems. It doesn't have many options
868 print "<tr> <td width=25%><b>$text{'solaris_ro'}</b></td> <td width=25%>\n";
869 printf "<input type=radio name=pcfs_ro value=1 %s> $text{'yes'}\n",
870 defined($options{"ro"}) ? "checked" : "";
871 printf "<input type=radio name=pcfs_ro value=0 %s> $text{'no'}</td>\n",
872 defined($options{"ro"}) ? "" : "checked";
874 if ($gconfig{'os_version'} >= 7) {
875 print "<td><b>$text{'solaris_foldcase'}</b></td> <td>\n";
876 printf "<input type=radio name=pcfs_foldcase value=1 %s> $text{'yes'}\n",
877 defined($options{'foldcase'}) ? "checked" : "";
878 printf "<input type=radio name=pcfs_foldcase value=0 %s> $text{'no'}</td>\n",
879 defined($options{'foldcase'}) ? "" : "checked";
882 print "<td colspan=2></td> </tr>\n";
885 if ($_[0] eq "lofs") {
886 # LOFS is a loopback filesystem
887 print "<tr> <td><b>$text{'solaris_ro'}</b></td>\n";
888 printf "<td nowrap><input type=radio name=ufs_ro value=1 %s> $text{'yes'}\n",
889 defined($options{"ro"}) ? "checked" : "";
890 printf "<input type=radio name=ufs_ro value=0 %s> $text{'no'}</td>\n",
891 defined($options{"ro"}) ? "" : "checked";
893 print "<td><b>$text{'solaris_nosuid'}</b></td>\n";
894 printf "<td nowrap><input type=radio name=ufs_nosuid value=1 %s> $text{'yes'}\n",
895 defined($options{"nosuid"}) ? "checked" : "";
896 printf "<input type=radio name=ufs_nosuid value=0 %s> $text{'no'}</td> </tr>\n",
897 defined($options{"nosuid"}) ? "" : "checked";
899 if ($_[0] eq "tmpfs") {
900 # Solaris tmpfs (virtual memory) filesystem.
901 print "<tr> <td><b>$text{'solaris_size'}</b> </td>\n";
902 printf"<td><input type=radio name=tmpfs_size_def value=1 %s> $text{'solaris_max'}\n",
903 defined($options{"size"}) ? "" : "checked";
904 printf" <input type=radio name=tmpfs_size_def value=0 %s>\n",
905 defined($options{"size"}) ? "checked" : "";
906 ($tmpsz = $options{size}) =~ s/[A-z]+$//g;
907 print "<input name=tmpfs_size size=6 value=\"$tmpsz\">\n";
908 print "<select name=tmpfs_unit>\n";
909 printf "<option value=m %s> MB\n",
910 $options{"size"} =~ /m$/ ? "selected" : "";
911 printf "<option value=k %s> kB\n",
912 $options{"size"} =~ /k$/ ? "selected" : "";
913 printf "<option value=b %s> bytes\n",
914 $options{"size"} !~ /(k|m)$/ ? "selected" : "";
915 print "</select></td>\n";
917 print "<td><b>$text{'solaris_nosuid'}</b></td> <td nowrap>\n";
918 printf "<input type=radio name=tmpfs_nosuid value=1 %s> $text{'yes'}\n",
919 defined($options{"nosuid"}) ? "checked" : "";
920 printf "<input type=radio name=tmpfs_nosuid value=0 %s> $text{'no'}</td>\n",
921 defined($options{"nosuid"}) ? "" : "checked";
924 if ($_[0] eq "swap") {
925 # Solaris swap has no options
926 print "<tr> <td><i>$text{'solaris_noopts'}</i></td> </tr>\n";
928 if ($_[0] eq "cachefs") {
929 # The caching filesystem has lots of options.. cachefs mounts can
930 # be of an existing 'manually' mounted back filesystem, or of a
931 # back-filesystem that has been automatically mounted by the cache.
932 # The user should never see the automatic mountings made by cachefs.
933 print "<tr> <td><b>$text{'solaris_backfs'}</b></td>\n";
934 print "<td nowrap><select name=cfs_backfstype>\n";
935 if (!defined($options{backfstype})) { $options{backfstype} = "nfs"; }
936 foreach (&list_fstypes()) {
937 if ($_ eq "cachefs") { next; }
938 printf "<option value=\"$_\" %s>$_\n",
939 $_ eq $options{backfstype} ? "selected" : "";
941 print "</select></td>\n";
943 print "<td><b>$text{'solaris_backpath'}</b></td>\n";
944 printf"<td nowrap><input type=radio name=cfs_noback value=1 %s> $text{'solaris_auto'}\n",
945 defined($options{"backpath"}) ? "" : "checked";
946 printf "<input type=radio name=cfs_noback value=0 %s>\n",
947 defined($options{"backpath"}) ? "checked" : "";
948 print "<input size=10 name=cfs_backpath value=\"$options{backpath}\"></td> </tr>\n";
950 print "<tr> <td><b>$text{'solaris_cachedir'}</b></td>\n";
951 printf "<td nowrap><input size=10 name=cfs_cachedir value=\"%s\"></td>\n",
952 defined($options{"cachedir"}) ? $options{"cachedir"} : "/cache";
954 print "<td><b>$text{'solaris_wmode'}</b></td>\n";
955 printf"<td nowrap><input type=radio name=cfs_wmode value=0 %s> $text{'solaris_waround'}\n",
956 defined($options{"non-shared"}) ? "" : "checked";
957 printf "<input type=radio name=cfs_wmode value=1 %s> $text{'solaris_nshared'}\n",
958 defined($options{"non-shared"}) ? "checked" : "";
959 print "</td> </tr>\n";
961 print "<tr> <td><b>$text{'solaris_con'}</b></td>\n";
962 print "<td><select name=cfs_con>\n";
963 print "<option value=1> $text{'solaris_period'}\n";
964 printf "<option value=0 %s> $text{'solaris_never'}\n",
965 defined($options{"noconst"}) ? "selected" : "";
966 printf "<option value=2 %s> $text{'solaris_demand'}\n",
967 defined($options{"demandconst"}) ? "selected" : "";
968 print "</select></td>\n";
970 print "<td><b>$text{'solaris_local'}</b></td>\n";
971 printf "<td nowrap><input type=radio name=cfs_local value=1 %s> $text{'yes'}\n",
972 defined($options{"local-access"}) ? "checked" : "";
973 printf "<input type=radio name=cfs_local value=0 %s> $text{'no'}</td> </tr>\n",
974 defined($options{"local-access"}) ? "" : "checked";
976 print "<tr> <td><b>$text{'solaris_ro'}</b></td>\n";
977 printf "<td nowrap><input type=radio name=cfs_ro value=1 %s> $text{'yes'}\n",
978 defined($options{"ro"}) ? "checked" : "";
979 printf "<input type=radio name=cfs_ro value=0 %s> $text{'no'}</td>\n",
980 defined($options{"ro"}) ? "" : "checked";
982 print "<td><b>$text{'solaris_nosuid'}</b></td>\n";
983 printf "<td nowrap><input type=radio name=cfs_nosuid value=1 %s> $text{'yes'}\n",
984 defined($options{"nosuid"}) ? "checked" : "";
985 printf "<input type=radio name=cfs_nosuid value=0 %s> $text{'no'}</td> </tr>\n",
986 defined($options{"nosuid"}) ? "" : "checked";
988 if ($_[0] eq "autofs") {
989 # Autofs has lots of options, depending on the type of file
990 # system being automounted.. the fstype options determines this
992 $fstype = $options{fstype} eq "" ? "nfs" : $options{fstype};
993 if ($gconfig{'os_version'} >= 2.6) {
994 print "<tr> <td><b>$text{'solaris_nobrowse'}</b></td> <td>\n";
995 printf "<input type=radio name=auto_nobrowse value=0 %s> $text{'yes'}\n",
996 defined($options{'nobrowse'}) ? "" : "checked";
997 printf "<input type=radio name=auto_nobrowse value=1 %s> $text{'no'}\n",
998 defined($options{'nobrowse'}) ? "checked" : "";
999 print "</td> <td colspan=2></td> </tr>\n";
1001 &generate_options($fstype);
1002 print "<input type=hidden name=autofs_fstype value=\"$fstype\">\n";
1004 if ($_[0] eq "rumba") {
1005 # SMB filesystems have a few options..
1006 print "<tr> <td><b>$text{'solaris_mname'}</b></td>\n";
1007 printf "<td><input type=radio name=rumba_mname_def value=1 %s> $text{'solaris_auto'}\n",
1008 defined($options{"machinename"}) ? "" : "checked";
1009 printf "<input type=radio name=rumba_mname_def value=0 %s>\n",
1010 defined($options{"machinename"}) ? "checked" : "";
1011 print "<input size=10 name=rumba_mname value=\"$options{machinename}\"></td>\n";
1013 print "<td><b>$text{'solaris_cname'}</b></td>\n";
1014 printf "<td><input type=radio name=rumba_cname_def value=1 %s> $text{'solaris_auto'}\n",
1015 defined($options{"clientname"}) ? "" : "checked";
1016 printf "<input type=radio name=rumba_cname_def value=0 %s>\n",
1017 defined($options{"clientname"}) ? "checked" : "";
1018 print "<input size=10 name=rumba_cname value=\"$options{clientname}\"></td> </tr>\n";
1020 print "<tr> <td><b>$text{'solaris_username'}</b></td>\n";
1021 print "<td><input name=rumba_username size=15 value=\"$options{username}\"></td>\n";
1023 print "<td><b>$text{'solaris_password'}</b></td>\n";
1024 print "<td><input type=password name=rumba_password size=15 value=\"$options{password}\"></td> </tr>\n";
1026 print "<tr> <td><b>$text{'solaris_uid'}</b></td>\n";
1027 printf "<td><input name=rumba_uid size=8 value=\"%s\">\n",
1028 defined($options{'uid'}) ? getpwuid($options{'uid'}) : "";
1029 print &user_chooser_button("rumba_uid", 0),"</td>\n";
1031 print "<td><b>$text{'solaris_gid'}</b></td>\n";
1032 printf "<td><input name=rumba_gid size=8 value=\"%s\">\n",
1033 defined($options{'gid'}) ? getgrgid($options{'gid'}) : "";
1034 print &group_chooser_button("rumba_gid", 0),"</td>\n";
1036 print "<tr> <td><b>$text{'solaris_fmode'}</b></td>\n";
1037 printf "<td><input name=rumba_fmode size=5 value=\"%s\"></td>\n",
1038 defined($options{fmode}) ? $options{fmode} : "755";
1040 print "<td><b>$text{'solaris_dmode'}</b></td>\n";
1041 printf "<td><input name=rumba_dmode size=5 value=\"%s\"></td> </tr>\n",
1042 defined($options{dmode}) ? $options{dmode} : "755";
1044 print "<tr> <td><b>$text{'solaris_readwrite'}</b></td>\n";
1045 printf"<td nowrap><input type=radio name=rumba_readwrite value=1 %s> $text{'yes'}\n",
1046 defined($options{"readwrite"}) ? "checked" : "";
1047 printf "<input type=radio name=rumba_readwrite value=0 %s> $text{'no'}</td>\n",
1048 defined($options{"readwrite"}) ? "" : "checked";
1050 print "<td><b>$text{'solaris_readonly'}</b></td>\n";
1051 printf"<td nowrap><input type=radio name=rumba_readonly value=1 %s> $text{'yes'}\n",
1052 defined($options{"readonly"}) ? "checked" : "";
1053 printf "<input type=radio name=rumba_readonly value=0 %s> $text{'no'}</td> </tr>\n",
1054 defined($options{"readonly"}) ? "" : "checked";
1056 print "<tr> <td><b>$text{'solaris_noupper'}</b></td>\n";
1057 printf"<td nowrap><input type=radio name=rumba_noupper value=0 %s> $text{'yes'}\n",
1058 defined($options{"noupper"}) ? "" : "checked";
1059 printf "<input type=radio name=rumba_noupper value=1 %s> $text{'no'}</td>\n",
1060 defined($options{"noupper"}) ? "checked" : "";
1062 print "<td><b>$text{'solaris_attr'}</b></td>\n";
1063 printf"<td nowrap><input type=radio name=rumba_attr value=1 %s> $text{'yes'}\n",
1064 defined($options{"attr"}) ? "checked" : "";
1065 printf "<input type=radio name=rumba_attr value=0 %s> $text{'no'}</td> </tr>\n",
1066 defined($options{"attr"}) ? "" : "checked";
1068 if ($_[0] eq "udfs") {
1069 # Solaris udfs is used for DVDs
1070 print "<tr> <td><b>$text{'solaris_ro'}</b></td>\n";
1071 printf "<td nowrap><input type=radio name=udfs_ro value=1 %s> $text{'yes'}\n",
1072 defined($options{"ro"}) ? "checked" : "";
1073 printf "<input type=radio name=udfs_ro value=0 %s> $text{'no'}</td>\n",
1074 defined($options{"ro"}) ? "" : "checked";
1076 print "<td><b>$text{'solaris_nosuid'}</b></td>\n";
1077 printf "<td nowrap><input type=radio name=udfs_nosuid value=1 %s> $text{'yes'}\n",
1078 defined($options{"nosuid"}) ? "checked" : "";
1079 printf "<input type=radio name=udfs_nosuid value=0 %s> $text{'no'}</td> </tr>\n",
1080 defined($options{"nosuid"}) ? "" : "checked";
1082 if ($_[0] eq "xmemfs") {
1083 # Solaris xmemfs (virtual memory) filesystem.
1084 print "<tr> <td><b>$text{'solaris_size'}</b> </td>\n";
1085 printf"<td><input type=radio name=xmemfs_size_def value=1 %s> $text{'solaris_max'}\n",
1086 defined($options{"size"}) ? "" : "checked";
1087 printf" <input type=radio name=xmemfs_size_def value=0 %s>\n",
1088 defined($options{"size"}) ? "checked" : "";
1089 ($tmpsz = $options{size}) =~ s/[A-z]+$//g;
1090 print "<input name=xmemfs_size size=6 value=\"$tmpsz\">\n";
1091 print "<select name=xmemfs_unit>\n";
1092 printf "<option value=m %s> MB\n",
1093 $options{"size"} =~ /m$/ ? "selected" : "";
1094 printf "<option value=k %s> kB\n",
1095 $options{"size"} =~ /k$/ ? "selected" : "";
1096 printf "<option value=b %s> bytes\n",
1097 $options{"size"} !~ /(k|m)$/ ? "selected" : "";
1098 print "</select></td>\n";
1100 print "<td><b>$text{'solaris_largebsize'}</b></td>\n";
1101 printf "<td nowrap><input type=radio name=xmemfs_largebsize value=1 %s> $text{'yes'}\n",
1102 defined($options{"largebsize"}) ? "checked" : "";
1103 printf "<input type=radio name=xmemfs_largebsize value=0 %s> $text{'no'}</td> </tr>\n",
1104 defined($options{"largebsize"}) ? "" : "checked";
1109 # check_location(type)
1110 # Parse and check inputs from %in, calling &error() if something is wrong.
1111 # Returns the location string for storing in the fstab file
1114 if ($_[0] eq "nfs") {
1115 local($out, $temp, $mout, $dirlist);
1117 if ($in{'nfs_serv'} == 1) {
1118 # multiple servers listed.. assume the user has a brain
1119 return $in{'nfs_list'};
1121 elsif ($in{'nfs_serv'} == 2) {
1122 # NFS url.. check syntax
1123 if ($in{'nfs_url'} !~ /^nfs:\/\/([^\/ ]+)(\/([^\/ ]*))?$/) {
1124 &error(&text('solaris_eurl', $in{'nfs_url'}));
1126 return $in{'nfs_url'};
1129 # Use dfshares to see if the host exists and is up
1130 if ($in{nfs_host} !~ /^\S+$/) {
1131 &error(&text('solaris_ehost', $in{'nfs_host'}));
1133 $out = &backquote_command("dfshares '$in{nfs_host}' 2>&1");
1134 if ($out =~ /Unknown host/) {
1135 &error(&text('solaris_ehost2', $in{'nfs_host'}));
1137 elsif ($out =~ /Timed out/) {
1138 &error(&text('solaris_edown', $in{'nfs_host'}));
1140 elsif ($out =~ /Program not registered/) {
1141 &error(&text('solaris_enfs', $in{'nfs_host'}));
1144 # Try a test mount to see if filesystem is available
1145 foreach (split(/\n/, $out)) {
1146 if (/^\s*([^ :]+):(\/\S+)\s+/) { $dirlist .= "$2\n"; }
1148 if ($in{nfs_dir} !~ /^\S+$/) {
1149 &error(&text('solaris_enfsdir', $in{'nfs_dir'},
1150 $in{'nfs_host'}, "<pre>$dirlist</pre>"));
1152 $temp = &transname();
1153 &make_dir($temp, 0755);
1154 $mout = &backquote_command("mount $in{nfs_host}:$in{nfs_dir} $temp 2>&1");
1155 if ($mout =~ /No such file or directory/) {
1157 &error(&text('solaris_enfsdir', $in{'nfs_dir'},
1158 $in{'nfs_host'}, "<pre>$dirlist</pre>"));
1160 elsif ($mout =~ /Permission denied/) {
1162 &error(&text('solaris_enfsperm', $in{'nfs_dir'}, $in{'nfs_host'}));
1166 &error(&text('solaris_enfsmount', "<tt>$mout</tt>"));
1168 # It worked! unmount
1169 &execute_command("umount $temp");
1170 &unlink_file($temp);
1171 return "$in{nfs_host}:$in{nfs_dir}";
1173 elsif ($_[0] eq "ufs" || $_[0] eq "pcfs") {
1174 # Get the device name
1175 if ($in{ufs_dev} == 0) {
1176 $dv = $in{'ufs_disk'};
1178 elsif ($in{ufs_dev} == 1) {
1179 $in{ufs_md} =~ /^[0-9]+$/ ||
1180 &error(&text('solaris_eraid', $in{'ufs_md'}));
1181 $dv = "/dev/md/dsk/d$in{ufs_md}";
1184 $in{ufs_path} =~ /^\/\S+$/ ||
1185 &error(&text('solaris_epath', $in{'ufs_path'}));
1186 $dv = $in{ufs_path};
1189 &fstyp_check($dv, $_[0]);
1192 elsif ($_[0] eq "hsfs" || $_[0] eq "udfs") {
1193 # Get the device name
1194 if ($in{ufs_dev} == 0) {
1195 $in{ufs_c} =~ /^[0-9]+$/ ||
1196 &error(&text('solaris_ectrlr', $in{'ufs_c'}));
1197 $in{ufs_t} =~ /^[0-9]+$/ ||
1198 &error(&text('solaris_etarget', $in{'ufs_t'}));
1199 $in{ufs_d} =~ /^[0-9]+$/ ||
1200 &error(&text('solaris_eunit', $in{'ufs_d'}));
1201 $in{ufs_s} =~ /^[0-9]+$/ ||
1202 &error(&text('solaris_epart', $in{'ufs_s'}));
1203 $dv = "/dev/dsk/c$in{ufs_c}t$in{ufs_t}d$in{ufs_d}s$in{ufs_s}";
1206 $in{ufs_path} =~ /^\/\S+$/ ||
1207 &error(&text('solaris_epath', $in{'ufs_path'}));
1208 $dv = $in{ufs_path};
1213 elsif ($_[0] eq "lofs") {
1214 # Get and check the original directory
1215 $dv = $in{'lofs_src'};
1216 if (!(-r $dv)) { &error(&text('solaris_eexist', $dv)); }
1217 if (!(-d $dv)) { &error(&text('solaris_edir', $dv)); }
1220 elsif ($_[0] eq "swap") {
1221 if ($in{swap_dev} == 0) {
1222 $dv = $in{'swap_disk'};
1224 else { $dv = $in{swap_path}; }
1226 if (!open(SWAPFILE, $dv)) {
1227 if ($! =~ /No such file/ && $in{swap_dev}) {
1228 if ($dv !~ /^\/dev/) {
1232 &error(&text('solaris_eswapfile', $dv));
1235 elsif ($! =~ /No such file/) {
1236 &error(&text('solaris_etarget', $in{'swap_t'}));
1238 elsif ($! =~ /No such device or address/) {
1239 &error(&text('solaris_epart', $in{'swap_s'}));
1242 &error(&text('solaris_eopen', $dv, $!));
1248 elsif ($_[0] eq "tmpfs") {
1249 # Ram-disk filesystems have no location
1252 elsif ($_[0] eq "xmemfs") {
1253 # Large ram-disk filesystems have no location
1256 elsif ($_[0] eq "cachefs") {
1257 # In order to check the location for the caching filesystem, we need
1258 # to check the back filesystem
1259 if (!$in{cfs_noback}) {
1260 # The back filesystem is manually mounted.. hopefully
1261 local($bidx, @mlist, @binfo);
1262 $bidx = &get_mounted($in{cfs_backpath}, "*");
1264 &error(&text('solaris_ebackfs', $in{'cfs_backpath'}));
1266 @mlist = &list_mounted();
1267 @binfo = @{$mlist[$bidx]};
1268 if ($binfo[2] ne $in{cfs_backfstype}) {
1269 &error(&text('solaris_ebacktype', $binfo[2], $in{'cfs_backfstype'}));
1273 # Need to automatically mount the back filesystem.. check
1274 # it for sanity first.
1276 $in{cfs_src} =~ /^\S+$/ ||
1277 &error(&text('solaris_ecsrc', $in{'cfs_src'}));
1279 return $in{cfs_src};
1281 elsif ($_[0] eq "autofs") {
1282 # An autofs filesystem can be either mounted from the special
1283 # -hosts and -xfn maps, or from a normal map. The map can be a file
1284 # name (if it starts with /), or an NIS map (if it doesn't)
1285 if ($in{autofs_type} == 0) {
1287 $in{autofs_map} =~ /\S/ ||
1288 &error($text{'solaris_eautomap'});
1289 if ($in{autofs_map} =~ /^\// && !(-r $in{autofs_map})) {
1290 &error(&text('solaris_eautofile', $in{'autofs_map'}));
1292 return $in{autofs_map};
1294 elsif ($in{autofs_type} == 1) {
1295 # Special hosts map (automount all shares from some host)
1299 # Special FNS map (not sure what this does)
1303 elsif ($_[0] eq "rumba") {
1304 # Cannot check much here..
1305 return "\\\\$in{rumba_server}\\$in{rumba_share}";
1310 # fstyp_check(device, type)
1311 # Check if some device exists, and contains a filesystem of the given type,
1312 # using the fstyp command.
1315 local($out, $part, $found);
1317 # Check if the device/partition actually exists
1318 if ($_[0] =~ /^\/dev\/dsk\/c(.)t(.)d(.)s(.)$/) {
1319 # mounting a normal scsi device..
1320 $out = &backquote_command("prtvtoc -h $_[0] 2>&1");
1321 if ($out =~ /No such file or directory|No such device or address/) {
1322 &error(&text('solaris_etarget2', $_[0]));
1325 foreach (split(/\n/, $out)) {
1326 /^\s+([0-9]+)\s+([0-9]+)/;
1332 &error(&text('solaris_epart2', $_[0]));
1335 elsif ($_[0] =~ /^\/dev\/md\/dsk\/d(.)$/) {
1336 # mounting a multi-disk (raid) device..
1337 $out = &backquote_command("prtvtoc -h $_[0] 2>&1");
1338 if ($out =~ /No such file or directory|No such device or address/) {
1339 &error(&text('solaris_eraid2', $_[0]));
1342 &error(&text('solaris_enopart', $_[0]));
1347 if (!open(DEV, $_[0])) {
1348 if ($! =~ /No such file or directory/) {
1349 &error(&text('solaris_edevfile', $_[0]));
1351 elsif ($! =~ /No such device or address/) {
1352 &error(&text('solaris_edevice', $_[0]));
1358 # Check the filesystem type
1359 $out = &backquote_command("fstyp $_[0] 2>&1");
1360 if ($out =~ /^([A-Za-z0-9]+)\n$/) {
1361 if ($1 eq $_[1]) { return; }
1363 # Wrong filesystem type
1364 &error(&text('solaris_efstyp', $_[0], &fstype_name($1)));
1368 &error(&text('solaris_efstyp2', $out));
1373 # check_options(type)
1374 # Read options for some filesystem from %in, and use them to update the
1375 # %options array. Options handled by the user interface will be set or
1376 # removed, while unknown options will be left untouched.
1380 if ($_[0] eq "nfs") {
1381 # NFS has lots of options to parse
1382 if ($in{'nfs_ro'}) {
1384 $options{"ro"} = ""; delete($options{"rw"});
1388 $options{"rw"} = ""; delete($options{"ro"});
1391 delete($options{'quota'}); delete($options{'noquota'});
1392 if ($in{'nfs_quota'}) { $options{'quota'} = ""; }
1394 delete($options{"nosuid"}); delete($options{"suid"});
1395 if ($in{nfs_nosuid}) { $options{"nosuid"} = ""; }
1397 delete($options{"grpid"});
1398 if ($in{nfs_grpid}) { $options{"grpid"} = ""; }
1400 delete($options{"soft"}); delete($options{"hard"});
1401 if ($in{nfs_soft}) { $options{"soft"} = ""; }
1403 delete($options{"bg"}); delete($options{"fg"});
1404 if ($in{nfs_bg}) { $options{"bg"} = ""; }
1406 delete($options{"intr"}); delete($options{"nointr"});
1407 if ($in{nfs_nointr}) { $options{"nointr"} = ""; }
1409 delete($options{"vers"});
1410 if (!$in{nfs_vers_def}) { $options{"vers"} = $in{nfs_vers}; }
1412 delete($options{"proto"});
1413 if ($in{nfs_proto} ne "") { $options{"proto"} = $in{nfs_proto}; }
1415 delete($options{"port"});
1416 if (!$in{nfs_port_def}) { $options{"port"} = $in{nfs_port}; }
1418 delete($options{"timeo"});
1419 if (!$in{nfs_timeo_def}) { $options{"timeo"} = $in{nfs_timeo}; }
1421 delete($options{"secure"}); delete($options{"kerberos"});
1422 delete($options{"sec"});
1423 if ($gconfig{'os_version'} >= 2.6) {
1424 if ($in{'nfs_auth'}) { $options{'sec'} = $in{'nfs_auth'}; }
1427 if ($in{'nfs_auth'} eq "dh") { $options{"secure"} = ""; }
1428 elsif ($in{'nfs_auth'} eq "krb") { $options{"kerberos"} = ""; }
1431 if ($gconfig{'os_version'} >= 7) {
1432 delete($options{'public'});
1433 $options{'public'} = "" if ($in{'nfs_public'});
1436 elsif ($_[0] eq "ufs") {
1437 # UFS also has lots of options..
1439 # read-only (and thus no quota)
1440 $options{"ro"} = ""; delete($options{"rw"});
1441 delete($options{"rq"}); delete($options{"quota"});
1443 elsif ($in{ufs_quota}) {
1444 # read-write, with quota
1445 delete($options{"ro"}); $options{"rw"} = "";
1446 $options{"quota"} = "";
1449 # read-write, without quota
1450 delete($options{"ro"}); $options{"rw"} = "";
1451 delete($options{"quota"});
1454 delete($options{"nosuid"});
1455 if ($in{ufs_nosuid}) { $options{"nosuid"} = ""; }
1457 delete($options{"intr"}); delete($options{"nointr"});
1458 if ($in{ufs_nointr}) { $options{"nointr"} = ""; }
1460 delete($options{"onerror"});
1461 if ($in{ufs_onerror} ne "panic") {
1462 $options{"onerror"} = $in{ufs_onerror};
1465 if ($gconfig{'os_version'} >= 7) {
1466 if ($gconfig{'os_version'} >= 8) {
1467 delete($options{'noatime'});
1468 delete($options{'dfratime'}); delete($options{'nodfratime'});
1469 if ($in{'ufs_noatime'} == 0) { $options{'nodfratime'} = ""; }
1470 elsif ($in{'ufs_noatime'} == 2) { $options{'noatime'} = ""; }
1473 delete($options{'noatime'});
1474 $options{'noatime'} = "" if ($in{'ufs_noatime'});
1477 delete($options{'forcedirectio'});
1478 delete($options{'noforcedirectio'});
1479 $options{'forcedirectio'} = "" if ($in{'ufs_force'});
1481 delete($options{'nolargefiles'});delete($options{'largefiles'});
1482 $options{'nolargefiles'} = "" if ($in{'ufs_nolarge'});
1484 delete($options{'logging'}); delete($options{'nologging'});
1485 $options{'logging'} = "" if ($in{'ufs_logging'});
1488 delete($options{"toosoon"});
1489 if ($in{ufs_toosoon_time}) {
1490 $options{"toosoon"} = $in{ufs_toosoon_time}.
1491 $in{ufs_toosoon_units};
1495 elsif ($_[0] eq "lofs") {
1496 # LOFS has a few options
1497 if ($in{'nfs_ro'}) {
1499 $options{"ro"} = ""; delete($options{"rw"});
1503 $options{"rw"} = ""; delete($options{"ro"});
1506 delete($options{"nosuid"});
1507 if ($in{ufs_nosuid}) { $options{"nosuid"} = ""; }
1509 elsif ($_[0] eq "swap") {
1510 # Swap has no options to parse
1512 elsif ($_[0] eq "pcfs") {
1513 # PCFS has only 2 options
1514 delete($options{'ro'}); delete($options{'rw'});
1515 $options{'ro'} = "" if ($in{'pcfs_ro'});
1517 delete($options{'foldcase'}); delete($options{'nofoldcase'});
1518 $options{'foldcase'} = "" if ($in{'pcfs_foldcase'});
1520 elsif ($_[0] eq "hsfs") {
1521 # Options for ISO-9660 filesystems
1522 delete($options{'nrr'});
1523 $options{'nrr'} = "" if ($in{'hsfs_nrr'});
1525 delete($options{"notraildot"});
1526 $options{"notraildot"} = "" if ($in{'hsfs_notraildot'});
1528 delete($options{'nomaplcase'});
1529 $options{'nomaplcase'} = "" if ($in{'hsfs_nomaplcase'});
1531 delete($options{'nosuid'});
1532 $options{'nosuid'} = "" if ($in{'hsfs_nosuid'});
1534 elsif ($_[0] eq "tmpfs") {
1535 # Ram-disk filesystems have only two options
1536 delete($options{"size"});
1537 if (!$in{"tmpfs_size_def"}) {
1538 $options{"size"} = "$in{tmpfs_size}$in{tmpfs_unit}";
1541 delete($options{"nosuid"});
1542 if ($in{'tmpfs_nosuid'}) { $options{"nosuid"} = ""; }
1544 elsif ($_[0] eq "xmemfs") {
1545 # Large ram-disk filesystems have only two options
1546 delete($options{"size"});
1547 if (!$in{"xmemfs_size_def"}) {
1548 $options{"size"} = "$in{xmemfs_size}$in{xmemfs_unit}";
1551 delete($options{"largebsize"});
1552 if ($in{'xmemfs_largebsize'}) { $options{"largebsize"} = ""; }
1554 delete($options{'rw'});
1556 elsif ($_[0] eq "cachefs") {
1557 # The caching filesystem has lots of options
1558 $options{"backfstype"} = $in{"cfs_backfstype"};
1560 delete($options{"backpath"});
1561 if (!$in{"cfs_noback"}) {
1562 # A back filesystem was given.. (alreadys checked)
1563 $options{"backpath"} = $in{"cfs_backpath"};
1566 if ($in{"cfs_cachedir"} !~ /^\/\S+/) {
1567 &error(&text('solaris_ecachedir', $in{'cfs_cachedir'}));
1569 $options{"cachedir"} = $in{"cfs_cachedir"};
1571 delete($options{"write-around"}); delete($options{"non-shared"});
1572 if ($in{"cfs_wmode"}) {
1573 $options{"non-shared"} = "";
1576 delete($options{"noconst"}); delete($options{"demandconst"});
1577 if ($in{"cfs_con"} == 0) { $options{"noconst"} = ""; }
1578 elsif ($in{"cfs_con"} == 2) { $options{"demandconst"} = ""; }
1580 delete($options{"ro"}); delete($options{"rw"});
1581 if ($in{"cfs_ro"}) { $options{"ro"} = ""; }
1583 delete($options{"suid"}); delete($options{"nosuid"});
1584 if ($in{"cfs_nosuid"}) { $options{"nosuid"} = ""; }
1586 elsif ($_[0] eq "autofs") {
1587 # The options for autofs depend on the type of the automounted
1589 $options{"fstype"} = $in{"autofs_fstype"};
1590 if ($gconfig{'os_version'} >= 2.6) {
1591 delete($options{'nobrowse'}); delete($options{'browse'});
1592 $options{'nobrowse'} = "" if ($in{'auto_nobrowse'});
1594 return &check_options($options{"fstype"});
1596 elsif ($_[0] eq "rumba") {
1597 # Options for smb filesystems..
1598 delete($options{machinename});
1599 if (!$in{rumba_mname_def}) { $options{machinename} = $in{rumba_mname}; }
1601 delete($options{clientname});
1602 if (!$in{rumba_cname_def}) { $options{clientname} = $in{rumba_cname}; }
1604 delete($options{username});
1605 if ($in{rumba_username}) { $options{username} = $in{rumba_username}; }
1607 delete($options{password});
1608 if ($in{rumba_password}) { $options{password} = $in{rumba_password}; }
1610 delete($options{uid});
1611 if ($in{rumba_uid} ne "") { $options{uid} = getpwnam($in{rumba_uid}); }
1613 delete($options{gid});
1614 if ($in{rumba_gid} ne "") { $options{gid} = getgrnam($in{rumba_gid}); }
1616 delete($options{fmode});
1617 if ($in{rumba_fmode} !~ /^[0-7]{3}$/) {
1618 &error(&text('solaris_efmode', $in{'rumba_fmode'}));
1620 elsif ($in{rumba_fmode} ne "755") { $options{fmode} = $in{rumba_fmode}; }
1622 delete($options{dmode});
1623 if ($in{rumba_dmode} !~ /^[0-7]{3}$/) {
1624 &error(&text('solaris_edmode', $in{'rumba_dmode'}));
1626 elsif ($in{rumba_dmode} ne "755") { $options{dmode} = $in{rumba_dmode}; }
1628 delete($options{'readwrite'});
1629 if ($in{'rumba_readwrite'}) { $options{'readwrite'} = ""; }
1631 delete($options{'readonly'});
1632 if ($in{'rumba_readonly'}) { $options{'readonly'} = ""; }
1634 delete($options{'attr'});
1635 if ($in{'rumba_attr'}) { $options{'attr'} = ""; }
1637 delete($options{'noupper'});
1638 if ($in{'rumba_noupper'}) { $options{'noupper'} = ""; }
1640 elsif ($_[0] eq "udfs") {
1641 # The DVD filesystem has only 2 options
1642 delete($options{'ro'}); delete($options{'rw'});
1643 $options{'ro'} = "" if ($in{'udfs_ro'});
1645 delete($options{"nosuid"});
1646 if ($in{'udfs_nosuid'}) { $options{"nosuid"} = ""; }
1649 # Return options string
1650 foreach $k (keys %options) {
1651 if ($options{$k} eq "") { push(@rv, $k); }
1652 else { push(@rv, "$k=$options{$k}"); }
1654 return @rv ? join(',' , @rv) : "-";
1658 # create_swap(path, size, units)
1659 # Attempt to create a swap file
1663 $out = &backquote_logged("mkfile $_[1]$_[2] $_[0] 2>&1");
1665 &unlink_file($_[0]);
1666 return "mkfile failed : $out";
1672 # exports_list(host, dirarray, clientarray)
1673 # Fills the directory and client array references with exports from some
1674 # host. Returns an error string if something went wrong
1677 local($dref, $cref, $out, $_);
1678 $dref = $_[1]; $cref = $_[2];
1679 $out = &backquote_command("showmount -e ".quotemeta($_[0])." 2>&1", 1);
1680 if ($?) { return $out; }
1681 foreach (split(/\n/, $out)) {
1682 if (/^(\/\S*)\s+(.*)$/) {
1683 push(@$dref, $1); push(@$cref, $2);
1690 # Returns a useable broadcast address for finding NFS servers
1694 $out = &backquote_command("ifconfig -a 2>&1", 1);
1695 if ($out =~ /broadcast\s+(\S+)/) { return $1; }
1696 return "255.255.255.255";
1699 # device_name(device)
1700 # Converts a device name to a human-readable form
1703 return $_[0] =~ /\/dev\/dsk\/c(\d+)t(\d+)d(\d+)s(\d+)$/ ?
1704 &text('solaris_scsidev', "$1", "$2", "$3", "$4") :
1705 $_[0] =~ /^\/dev\/md\/dsk\/d([0-9]+)$/ ?
1706 &text('solaris_mddev', "$1") :
1707 $_[0] =~ /^\/dev\/dsk\/c(\d+)d(\d+)s(\d+)$/ ?
1708 &text('solaris_idedev', "$1", "$2", "$3") :
1710 $text{'solaris_autohosts'} :
1712 $text{'solaris_autoxfn'} :
1718 return ( $config{'fstab_file'}, $config{'autofs_file'} );