grass environment

Greg Koerper greg at dubious.cor2.epa.gov
Wed Jun 1 18:46:08 EDT 1994


> 
> I am trying to set up a grass users group on our workstation so that
> multiple users can access GRASS. I have the permissions set for the grass
> data directory so that the group "grass" has read,write,exe access.
> However, when a user who is part of this group starts up grass and
> specifies the mapset/location, this message shows up:
> 
> Sorry, no access to <<maps>>.
> 
> Mapsets in location <wachob>
> ----------------------
>    PERMANENT              maps                
> 
> note: you do not have access to any of these mapsets
> ----------------------
> 
> If anyone has some idea what is going on here, info would be appreciated!
>  
> The setup in the user's .cshrc is this:
> 
> 
> setenv GISBASE /tools/grass/grass4.0/sun4
> alias grass4 \$GISBASE/etc/GIS.sh
> 
> 
> and the .grassrc is this:
> 
> q
>         LOCATION: wachob
> MAPSET: maps
> GISDBASE: /sea/grassdata  
> (except for the q - sorry, typo)
> 
> Please mail any responses directly to me: meh at zoosun1.uwyo.edu
> as I am not subsribed to this list.
> 
> Thanks in advance!
> Margo Herdendorf
> 

We keep the following script in /usr/local/bin/grass4.  If a new user is
identified, then the perl script new_user.p is executed to attach shared
databases through soft links.

grass4:

# Bourne script for entering grass4.1 using executables on heart

BASENAME=`basename $0`

GIS="/files/data/heart/data1/grassdir/grass4.1"
# DIR="/files/data/hydro/data2/grass4.1"
DIR=${GIS}/bin

if [ ! -d $DIR ]
then
    echo "One moment . . . I need to mount disks attached to heart"
    nfsmount heart
fi

PATH=$DIR:$PATH

export GIS PATH
# export GIS GISDBASE PATH

# for new users, create the initial GISDBASE
if [ ! -s "$HOME/.grassrc4" ]
then
    echo "One moment . . . establishing GRASS database linkages for you"
    $GIS/../home/new_user.p
fi

trap 'exit' 0 1 2 3 15

if [ $BASENAME = "grass4" ]
then
	grass4.1.new
else
	home=`cd;pwd`

	# if xgrass databases not specified, use the database from .grassrc4
	if [ ! -f "$home/.xgrass/databases" ]
	then
		if [ -f "$home/.grassrc4" ]
		then
			if [ ! -d "$home/.xgrass" ]
			then
				mkdir $home/.xgrass
			fi
			grep GISDBASE $home/.grassrc4 | sed -e 's:^.* /:/:' \
			 > $home/.xgrass/databases
		fi
	fi
	xgrass4.1.new $*
fi

new_user.p:
#!/usr/local/bin/perl
# written to attach ERL-C GRASS Database to new GRASS user's database


#require "getopts.pl";

#&Getopts ('w');

$home = $ENV{'HOME'};
$dir = $opt_w ? "/dsk/heart2" : "/files/data/heart/data1";

#kludge
if (! -d $dir) {
    $dir = "/dsk/heart2";
	}
@locations = ("us.albers", "us.latlong", "world.latlong");

if (! -d "$home/grass_mapsets") {
	mkdir ("$home/grass_mapsets", 0755);
	}

chdir ("$home/grass_mapsets");
foreach $i (@locations) {
	if (! -d $i) {
		mkdir ($i, 0755);
		}
	chdir ($i);
	open (FILES, "ls $dir/grassdir/grass.data/$i |");
	@list = <FILES>;
	foreach $mapset (@list) {
		chop $mapset;
		next if $mapset =~ /^[a-z]/;
		next if $mapset =~ /README/;
		next if -d $mapset || -l $mapset;
		if ($mapset eq "PERMANENT") {
			system ("cp -r $dir/grassdir/grass.data/$i/$mapset $mapset");
			}
		else {
			system ("ln -s $dir/grassdir/grass.data/$i/$mapset $mapset");
			}
		}
	chdir ("$home/grass_mapsets");
	}

# also connect spearfish data
if (! -d "spearfish") {
	mkdir ("spearfish", 0755);
	}
chdir ("spearfish");
unless (-d "PERMANENT" || -l "PERMANENT") {
	mkdir ("PERMANENT", 0755);
	chdir ("PERMANENT");
	foreach $file ("DEFAULT_WIND", "MYNAME", "SEARCH_PATH", "WIND") {
		system "cp $dir/grassdir/home/data/spearfish/PERMANENT/$file $file";
		}
	chdir ("$home/grass_mapsets/spearfish");
	}

# (-d "spearfish" || -l "spearfish") ? print "yes\n" : print "no\n";
unless (-d "spearfish" || -l "spearfish") {
	system "ln -s $dir/grassdir/home/data/spearfish/PERMANENT spearfish";
	}
		

# write out a .grassrc4 file
open (GRASS, "> $home/.grassrc4");
print GRASS "GISDBASE: $home/grass_mapsets\n";
print GRASS "LOCATION_NAME: us.albers\n";
print GRASS "MAPSET: PERMANENT\n";



More information about the grass-user mailing list