multi-user changes to grass

Anthony Anger geaa at wanda.jcu.edu.au
Tue Mar 15 02:15:12 EST 1994


Greetings, 
	   
	   in our use of Grass here at James Cook University
(Australia), rather than having all the grass users (both students and
academic staff), storing their information under the grass data area, we
endeavoured to find a way in that the users' data could be stored in
their own areas, yet still be accessed in the normal way from grass.  In
the end, a system by which the users' mapsets were symbolically linked
to a subdirectory under their own home directories.  

  The system was implemented by modifying the grass shell script, and
also creating one small C program.  This program should be setgid (set
group-id) to whatever user group the data is stored as.  The location
directories' permissions should be set writable by the group.   I will
append the relevant code below...  We will most likely modify the xgrass
shell script in a similar manner.

  What we were wondering though, was if anybody else had come across a
similar situation, and if so, how they had handled it.  We would love to
hear from you with any comments.  

  Also, we are also trying to figure out a (preferably simple :) ) way
to give each xgrass user their own unique set of monitors.  Does anybody
have any suggestions??  We would love to hear from you in either case.


				Anthony.
   

----------------------------------------------------------------------------

 -- grass4.1 shell script --

#!/bin/sh -x

# grass 4.1 execution script - setup for ikarus.jcu.edu.au

GISBASE=/export/home/apps/grass4.1
export GISBASE

#  --
# Local modifications:

GRASSDATA=/export/home/apps/grass.data
GRASSUSER=`whoami` || exit 1


for i in $GRASSDATA/*
do

  if [ -d $i ]
    then	# perform this only on real locations (directories)

      LOCATION=`basename $i`

	# if no directory or symbolic link currently exists...
      if [ ! -h $GRASSDATA/$LOCATION/$GRASSUSER -a ! \
             -d $GRASSDATA/$LOCATION/$GRASSUSER ]
        then
	
	# create a grass.data directory in their $HOME dir if it doesn't exist
          if [ ! -d $HOME/grass.data ]
            then
              mkdir $HOME/grass.data || exit 1;
          fi

	# create location in their own grass database
          if [ ! -d $HOME/grass.data/$LOCATION ]
            then
              mkdir $HOME/grass.data/$LOCATION || exit 1;
          fi

	# symbolically link their database into the main grass database
          $GISBASE/etc/symlink $GRASSDATA/$LOCATION/$GRASSUSER  \
                               $HOME/grass.data/$LOCATION
      fi

  fi

done

#  --

exec $GISBASE/etc/GIS.sh

 -- end of grass4.1 shell script --

----------------------------------------------------------------------------

 -- symlink.c source code --

/* symlink.c */

/* 
  Author: Anthony Anger  (Anthony.Anger at jcu.edu.au)
  Created: 3/3/94
*/

/* this program has been created to run setgid and create symbolic links in 
  the grass.data directories (of course it can just be used to create 
  symbolic links, if you wish... 	*/

main( int argc, char *argv[] )
{
  if ( argc != 3 )
    {
      printf("\n  Usage: %s <symbolic link name> <link destination>\n", 
		argv[0] );
      printf( "\nThis program creates a sybolic link which is named by ");
      printf("the first parameter.\nThe interpreted destination of the");
      printf(" symbolic link is given by the second parameter.  \n");
      exit(1);
    }

  if ( symlink( argv[2], argv[1] ) < 0 )
    {
      perror(argv[0]);
      exit(1);
    }
   else exit(0);
}

 -- end of symlink.c source code --


----------------------------------------------------------------------------

--
Anthony Anger 
Anthony.Anger at jcu.edu.au



More information about the grass-dev mailing list