home *** CD-ROM | disk | FTP | other *** search
- #!/usr/bin/perl
- #
- # smount/unmount v1.0 - 06/12/91 - by Brendan Kehoe (brendan@cs.widener.edu)
- # Based on a program by chogan@maths.tcd.ie [I think, I forget :-)]
- #
- ($program = $ARGV[0]) =~ s%.*/%%;
- #
- # List of directories that anybody can mount and unmount:
- #
- %legal = ("/src", "Source archive",
- "/pcfs", "MS-DOS Diskette [same as `$program floppy']",
- "/cdrom", "CD-Rom [same as `$program cdrom']",
- "/home/xy", "The Xy Project",
- "/home/foo", "FooBar Group" );
- #
- # If these are different on your system, change them:
- #
- $prog'mount = "/etc/mount";
- $prog'umount = "/etc/umount";
- $mnt'cdrom = "/cdrom"; # where yoru CD Rom mounts
- $mnt'floppy = "/pcfs"; # Where your pcfs is set up to mount on
- #
- # -- You shouldn't have to change anything else --
- sub smount'listem {
- print " Legal directories are:\n";
- foreach $dir (sort (keys legal)) { print "\t$dir\t\t($legal{$dir})\n"; }
- }
-
- $option = $ARGV[1];
-
- if ($program eq "unmount") { $MOUNT = $prog'umount; }
- else { $MOUNT = $prog'mount; }
-
- if ( $option eq "-l" ) { &smount'listem; exit 0; }
-
- exec($MOUNT, $mnt'cdrom) if $option eq "cdrom";
- exec($MOUNT, $mnt'floppy) if $option eq "floppy";
- if (! $legal{$option}) { print "Illegal directory!"; &smount'listem; exit 0; }
- exec($MOUNT, $option) if $legal{$option};
-