Xref: feenix.metronet.com info.grass.user:2034 Path: feenix.metronet.com!news.utdallas.edu!wupost!howland.reston.ans.net!vixen.cso.uiuc.edu!gateway From: greg@towhee.cor2.epa.gov (Greg Koerper) Newsgroups: info.grass.user Subject: re: access to PERMANENT (w/code) Date: 19 Aug 93 16:30:21 GMT Organization: University of Illinois at Urbana Lines: 108 Approved: Usenet@ux1.cso.uiuc.edu Message-ID: <9308191630.AA01518@towhee.cor2.epa.gov> Reply-To: grassu-list@max.cecer.army.mil NNTP-Posting-Host: ux1.cso.uiuc.edu Originator: daemon@ux1.cso.uiuc.edu > I am installing XGRASS4.1 (binary version) to be used of several user > at our department. BUT, how can I give the other users access to the > PERMANENT location (from the Global, Spearfish data sets). > I have tried the access function in grass, and the chmod outside > grass, but without any success. The other user can not get in contact > with the existing data sets. > -- I don't suggest that users share access to PERMANENT. Instead, you can make copies of the few (and small) files that a user needs as a local PERMANENT, and then use soft UNIX links (ln -s) to provide read access to these databases. I have included a perl script that I have built for local use which builds a GRASS database for a new user in dir grass_mapsets, adds 3 locations ("us.albers", "us.latlong", "world.latlong") to which centralized, shared mapsets are then soft linked (but note that the PERMANENT mapset is copied, not linked--these PERMANENT files are bare bones and do not contain vector, site, or raster data), and additionally builds the location spearfish. For spearfish, only 4 essential files are copied to a locally owned PERMANENT. Then the original PERMANENT is linked to the spearfish LOCATION as the spearfish MAPSET. This hack provides full access to shared data, both local databases and OGI supplied (like spearfish), without the hassle of potential database corruption. I'd welcome comments. greg ****************************************************************************** Greg Koerper Internet: greg@heart.cor.epa.gov ManTech Environmental Technology, Inc. UUCP: hplabs!hp-pcd!orstcs!koerper US EPA Environmental Research Lab 200 SW 35th St., JSB Corvallis, OR 97333 Rush Limbaugh plucks the heartstrings of America: (503) 754-4490 "I'm OK, because they're not!" fax: (503) 754-4338 ****************************************************************************** #!/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 = ; 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";