--- /usr/sbin/supermount.bor	Tue Sep 18 01:34:52 2001
+++ /usr/sbin/supermount	Tue Sep 25 11:37:51 2001
@@ -6,12 +6,12 @@
 # $Id: supermount,v 1.6 2000/04/13 23:10:32 chmouel Exp $
 
 my $file = '/etc/fstab';
-my $ofile;
+my ($ofile, $mpoint);
   
 #"bad" or "nessesary" options for "normal" and "supermount" entry
 # "bad" options can be regexp.
-my @normal_bad = qw ( fs=\S+ dev=\S+);
-my @super_bad = qw (sync user);
+my @normal_bad = qw ( fs=\S+ dev=\S+ --);
+my @super_bad = qw (sync user noauto);
 my @normal_must = qw (user noauto nodev nosuid);
 my @super_must = qw (nodev nosuid);
 my $fs_ok = '(auto|vfat|iso9660)';
@@ -22,6 +22,8 @@
   $_ = shift;
   if (/^--file=([^ \t]+)/ || /^-f=([^ \t]+)/) {
     $file = $1;
+  } elsif (/^--mountpoint=([^ \t]+)/ || /^-m=([^ \t]+)/) {
+    $mpoint = $1;
   } elsif (/^--infile/ || /^-i/) {
     $infile++;
   } elsif (/^--help/ || /^-h/ || /^-\?/) {
@@ -45,7 +47,7 @@
 while (<FH>) {
   my ($dev, $point, $fs, $opt, $d1, $d2) = split;
   my @opt = split (',', $opt);
-  if ( $disable && ($fs eq "supermount") ) {
+  if ( $disable && ($fs eq "supermount") && (!defined($mpoint) || $point eq $mpoint) ) {
     my @must;
     map { m/^fs=(\S+)/ && ($fs = $1); 
 	  m/dev=(\S+)/ && ($dev= $1); } @opt;
@@ -60,18 +62,17 @@
     $opt = join (',' , @opt); 
     print "$dev\t$point\t$fs $opt\t$d1 $d2\n";
     next;
-  } elsif ( $enable && ( 
-			$fs eq "iso9660" || 
-			( ( $fs =~ m/$fs_ok/ ) &&
-			 (   ($dev =~ /^\/dev\/($dev_ok)$/) 
-			  || ($opt =~ m/(^|.*,)user.*/ )
-			 )
-			)
-		       )
+  } elsif ( $enable && (!defined($mpoint) || $point eq $mpoint) &&
+            ( $fs eq "iso9660" || 
+			  ( $fs =~ m/$fs_ok/ &&
+			    $dev =~ /^\/dev\/($dev_ok)$/
+		      )
+	        ) &&
+			 ($opt =~ m/(^|.*,)user.*/)
 	    ) {
     &clean_options(\@opt,\@super_must, \@super_bad);
     $opt = join (',' , @opt); 
-    print "$point\t$point\tsupermount\tfs=$fs,dev=$dev,$opt 0 0\n";
+    print "$point\t$point\tsupermount\tfs=$fs,dev=$dev,--,$opt 0 0\n";
     next;
   }
   print;
@@ -96,14 +97,22 @@
 Usage: $0 [OPTION]... <disable | enable>
 Enable or disable supermount in fstab. 
 
-  -f=FILE, --file=FILE:	 Specify an alternarte fstab file (default: /etc/fstab).
-  -i,	      --infile:  Modify directly in the file.
+  -m=DIR, --mountpoint=DIR: Specifiy single mount point to enable/disable (default: all)
+  -f=FILE, --file=FILE:	    Specify an alternarte fstab file (default: /etc/fstab).
+  -i,	      --infile:     Modify directly in the file.
 
 EOF
   exit($e);
 }
 __END__
  CHANGELOG:
+Thu Feb 25 2001 Andrej Borsenkow <Andrej.Borsenkow@mow.siemens.ru>
+- added ``--'' as delimiter for supermount fs options to avoid mount errors on fs-specific options
+- added --mountpoint option to operate on single mount point
+- changed condition to enable supermount to (($fs eq iso9660) || (($fs =~ m/$fs_ok) &&
+ ($dev =~ /^\/dev\/($dev_ok)$/))) && ($opt =~ m/(^|.*,)user.*/ ) 
+Before it tried to supermount Windows vfat partitions that were defined with user option.
+
 Thu Apr 13 2000 Denis Havlik <denis@mandrakesoft.com>
 - moved definitions of "good" and "bad" fs-options, "allowed fs-s" and "good devices" to top of the script for easier maintainance.
 -  added &clean_options(\@opt,\@must, \@bad) function, which parses the @opt
@@ -113,6 +122,3 @@
 - changed the rules used to decide which mount points are going to be 
 supermounted to: ($fs eq "iso9660") || (( $fs =~ m/$fs_ok/ ) &&
  (($dev =~ /^\/dev\/($dev_ok)$/) || ($opt =~ m/(^|.*,)user.*/ )) )
- TODO:  
-add --mountpoint option to get targeted supermount-enabling/disabling on
- the single moint point. 
