[GRASS-SVN] r58888 - grass/branches/develbranch_6/raster/r.li/r.li.setup

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Feb 5 13:06:08 PST 2014


Author: hamish
Date: 2014-02-05 13:06:08 -0800 (Wed, 05 Feb 2014)
New Revision: 58888

Modified:
   grass/branches/develbranch_6/raster/r.li/r.li.setup/r.li.setup
Log:
set up temporary region, quote GISBASE path

Modified: grass/branches/develbranch_6/raster/r.li/r.li.setup/r.li.setup
===================================================================
--- grass/branches/develbranch_6/raster/r.li/r.li.setup/r.li.setup	2014-02-05 19:34:20 UTC (rev 58887)
+++ grass/branches/develbranch_6/raster/r.li/r.li.setup/r.li.setup	2014-02-05 21:06:08 UTC (rev 58888)
@@ -5,7 +5,6 @@
 # MODULE:       r.li.setup
 #
 # AUTHOR(S):    Spano Lucio Davide & Claudio Porta
-#          
 #
 # PURPOSE:     Configuration editor for r.li.<index>. It sets sampling frame and 
 #              sample areas to analyze, the configuration is raster map indipendent.
@@ -14,22 +13,43 @@
 # Read the COPYING file that comes with GRASS for details.
 #
 #############################################################################
+
 #%Module
 #%  description: Configuration editor for r.li.'index'
 #%  keywords: raster, landscape structure analysis
 #%End
 
 if  [ -z "$GISBASE" ] ; then
-   echo "You must be in GRASS GIS to run this program."
+   echo "You must be in GRASS GIS to run this program." 1>&2
    exit 1
 fi
 
+
+cleanup()
+{
+   # remove temporary region
+   eval `g.findfile elem=windows file="tmp_rlisetup.$$" | grep '^name='`
+   if [ -n "$name" ] ; then
+      unset WIND_OVERRIDE
+      g.remove region="tmp_rlisetup.$$" --quiet
+   fi
+}
+trap "cleanup" 2 3 15
+
+
 if [ $# -eq 0 ] ; then
-   $GISBASE/etc/r.li.setup/r.li.setup.main
+   # setup internal region
+   g.region save="tmp_rlisetup.$$"
+   WIND_OVERRIDE="tmp_rlisetup.$$"
+   export WIND_OVERRIDE
+
+   "$GISBASE"/etc/r.li.setup/r.li.setup.main
+
+   cleanup
    exit 0
 fi
 
+
 if [ "$1" != "@ARGS_PARSED@" ] ; then
-  exec g.parser "$0" "$@"
+   exec g.parser "$0" "$@"
 fi
-



More information about the grass-commit mailing list