[GRASS-SVN] r49320 - in grass/branches/releasebranch_6_4: lib/init scripts/g.extension

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Nov 21 17:35:08 EST 2011


Author: hamish
Date: 2011-11-21 14:35:08 -0800 (Mon, 21 Nov 2011)
New Revision: 49320

Modified:
   grass/branches/releasebranch_6_4/lib/init/init.sh
   grass/branches/releasebranch_6_4/scripts/g.extension/g.extension
Log:
backport from devbr6: init.sh=if GRASS_ADDON_PATH is not set, then
   set it to ~/.grass6/addons. g.extension(.sh)=https -> http;
   if prefix= doesn't exist try to create it; fix symlink test when
   the default prefix is used.


Modified: grass/branches/releasebranch_6_4/lib/init/init.sh
===================================================================
--- grass/branches/releasebranch_6_4/lib/init/init.sh	2011-11-21 22:09:53 UTC (rev 49319)
+++ grass/branches/releasebranch_6_4/lib/init/init.sh	2011-11-21 22:35:08 UTC (rev 49320)
@@ -7,14 +7,14 @@
 #   	    	Huidae Cho - Korea - grass4u at gmail.com
 #   	    	Justin Hickey - Thailand - jhickey at hpcc.nectec.or.th
 #   	    	Markus Neteler - Germany/Italy - neteler at itc.it
-#		Hamish Bowman - New Zealand - hamish_nospam at yahoo,com
+#		Hamish Bowman - New Zealand - hamish_b at yahoo,com
 # PURPOSE:  	The source file for this shell script is in
 #   	    	src/general/init/init.sh. It sets up some environment
 #   	    	variables and the lock file. It also parses any remaining
 #   	    	command line options for setting the GISDBASE, LOCATION, and/or
 #   	    	MAPSET. Finally it starts GRASS with the appropriate user
 #   	    	interface and cleans up after it is finished.
-# COPYRIGHT:    (C) 2000 by the GRASS Development Team
+# COPYRIGHT:    (C) 2000-2011 by the GRASS Development Team
 #
 #               This program is free software under the GNU General Public
 #   	    	License (>=v2). Read the file COPYING that comes with GRASS
@@ -256,11 +256,12 @@
 	LCL=`echo "$LANG" | sed 's/\(..\)\(.*\)/\1/'`
 fi
 
-if [ -n "$GRASS_ADDON_PATH" ] ; then
-   PATH="$GISBASE/bin:$GISBASE/scripts:$GRASS_ADDON_PATH:$PATH"
-else
-   PATH="$GISBASE/bin:$GISBASE/scripts:$PATH"
+# if it doesn't exist set it to something so that g.extension's default is reasonable
+if [ -z "$GRASS_ADDON_PATH" ] ; then
+    GRASS_ADDON_PATH="$HOME/.grass6/addons"
+    export GRASS_ADDON_PATH
 fi
+PATH="$GISBASE/bin:$GISBASE/scripts:$GRASS_ADDON_PATH:$PATH"
 export PATH
 
 # Set LD_LIBRARY_PATH to find GRASS shared libraries

Modified: grass/branches/releasebranch_6_4/scripts/g.extension/g.extension
===================================================================
--- grass/branches/releasebranch_6_4/scripts/g.extension/g.extension	2011-11-21 22:09:53 UTC (rev 49319)
+++ grass/branches/releasebranch_6_4/scripts/g.extension/g.extension	2011-11-21 22:35:08 UTC (rev 49320)
@@ -41,7 +41,7 @@
 #% key_desc: url
 #% description: SVN Addons repository URL
 #% required: yes
-#% answer: https://svn.osgeo.org/grass/grass-addons
+#% answer: http://svn.osgeo.org/grass/grass-addons
 #%end
 #%option
 #% key: prefix
@@ -234,8 +234,12 @@
 if [ -d "$PREFIX" ] ; then
     MYINST_DIR="$PREFIX"
 else
-    g.message -e "'$PREFIX' does not exist"
-    exit 1
+    g.message -w "'$PREFIX' does not exist. Creating ..."
+    mkdir -p "$PREFIX"
+    if [ $? -ne 0 ] || [ ! -d "$PREFIX" ] ; then
+	g.message -e "Unable to create '$PREFIX' directory"
+	exit 1
+    fi
 fi
 
 if [ ! -w "$PREFIX" -a $SYSADMIN -ne 1 ] ; then
@@ -386,7 +390,7 @@
      exit 1
    fi
 
-   if [ "$MYINST_DIR" = "$GRASS_ADDON_PATH1" ] ; then
+   if [ "$MYINST_DIR" = "$GRASS_ADDON_PATH1" ] || [ "$MYINST_DIR" = ~/.grass6/addons  ] ; then
       # symlink into path which is actually in the $PATH
       ln -s "$MYINST_DIR/$PROGTYPE/$MODULE" "$MYINST_DIR/"
    fi



More information about the grass-commit mailing list