#!/usr/bin/perl
$version = 2 ;

# nfsAddExports - Export a filesystem

# --- Initialization ---
# Deal with possible spaces in the input 
foreach $i (0 .. $#ARGV) {
   $data .= "@ARGV[$i] " ;
}
chop($data) ;

if($data eq "-v") {
    print "$version\n" ;
    exit(0) ;
}
 
# Discover OS type and run the appropriate command
chop($os = `uname -s`) ;

if($os eq "Linux") {
    $OS="linux" ;
    `PATH=/bin:/sbin:/usr/bin:/usr/sbin ; killall -HUP rpc.nfsd` ;
    # rpc.mountd is acting odd.  This should work.
    `PATH=/bin:/sbin:/usr/bin:/usr/sbin ; killall -HUP rpc.mountd` ;
} elsif($os eq "SunOS") {
    chop($ver = `uname -r`) ;
    ($major, $minor) = split(/\./, $ver) ;
    if($major == 5) {
        $OS = "solaris" ;
	`shareall` ;

    } else {
        $OS = "sunos" ;
	`exportfs -a -v` ;
    }

} elsif(($os eq "IRIX") | ($os eq "IRIX64"))  {
    $OS="irix" ;
    `exportfs -a -v` ;

} elsif($os eq "HP-UX") {
    $OS="hpux" ;
    `exportfs -a -v` ;
}


print "Exporting $data\n" ;

exit 0 ;


