home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
misc
/
volume22
/
smount1.1
/
part01
/
smount.pl
< prev
next >
Wrap
Perl Script
|
1991-08-28
|
1KB
|
45 lines
#!/usr/bin/perl
#
# smount/unmount v1.1 - 08/26/91 - by Brendan Kehoe (brendan@cs.widener.edu)
# Based on a program by Emmet Hogan.
#
($program = $ARGV[0]) =~ s%.*/%%;
$ENV{'PATH'} = '/bin:/usr/etc';
$ENV{'SHELL'} = '/bin/sh' if $ENV{'SHELL'} ne '';
$ENV{'IFS'} = '' if $ENV{'IFS'} ne '';
#
# 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 your 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};