Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com Date: Fri, 26 Nov 1999 19:53:41 -0800 (PST) From: James Ganong Message-Id: <199911270353.TAA49251@bigseal.ucsc.edu> To: cygwin AT sourceware DOT cygnus DOT com Subject: perl prog that writes a windows .bat file that recreates mounts i was inspired by Phil Edwards entry in the todo list at http://sourceware.cygnus.com/cgi-bin/cygwin-todo.cgi?19991124.133151 "Some kind of 'fstab'" to write a simple perl prog that dumps out the current mount configuration into a .bat file that can run from windows that will recreate the current mount setup. here it is: (i wrote this using cygwin v1.0 i don't know if mount works the same on other versions) #!/contrib/bin/perl @fstab=`mount`; $mount_path = &which_windows_style_path("mount"); $umount_path = &which_windows_style_path("umount"); print "$umount_path --remove-all-mounts \n"; for (@fstab) { next if /^Device/; chomp; ($device,$dir,$type,$flags)= split; $device =~ s/\\/\//g; $options="-f "; # i force them all, it seems to work better! $options .= "-s " if $type =~ /system/; $options .= "-b " if $flags =~ /binmode/; $options .= "-x " if $flags =~ /exec/; print "$mount_path $options $device $dir \n"; } sub which_windows_style_path { $command =shift; for (split ':', $ENV{PATH}) { for ("$_/$command") { if (-x $_){ if ($_ eq "./$command") { $pwd = `pwd`; chomp $pwd; $_ = "$pwd/$command"; } $_ = `cygpath -w $_`; chomp; return $_; } } } die "could not find path to $command"; } -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com