[GRASS-SVN] r38227 - grass-addons/general/g.extension.add
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Jul 5 07:56:32 EDT 2009
Author: neteler
Date: 2009-07-05 07:56:32 -0400 (Sun, 05 Jul 2009)
New Revision: 38227
Modified:
grass-addons/general/g.extension.add/g.extension.add
Log:
use g.tempfile TMPDIR approach
Modified: grass-addons/general/g.extension.add/g.extension.add
===================================================================
--- grass-addons/general/g.extension.add/g.extension.add 2009-07-05 11:02:56 UTC (rev 38226)
+++ grass-addons/general/g.extension.add/g.extension.add 2009-07-05 11:56:32 UTC (rev 38227)
@@ -41,8 +41,16 @@
# definitions
SVNURL_ADDONS=https://svn.osgeo.org/grass/grass-addons/
-MYTMP=/tmp
+#make a temporary directory
+TMPDIR="`g.tempfile pid=$$`"
+if [ $? -ne 0 ] || [ -z "$TMPDIR" ] ; then
+ g.message "Unable to create temporary files"
+ exit 1
+fi
+rm -f "$TMPDIR"
+mkdir "$TMPDIR"
+
# check if we have the svn client
if [ ! -x "`which svn`" ] ; then
echo "ERROR: svn client required. Please install subversion first." 1>&2
@@ -84,11 +92,12 @@
MODULECLASS=`expand_module_class_name $CLASSCHAR`
cleanup(){
- cd ${MYTMP}
- rm -rf ${MYTMP}/${MODULE}
+ cd ${TMPDIR}
+ rm -rf ${TMPDIR}/${MODULE}
+ rmdir "$TMPDIR"
}
-cd ${MYTMP}
+cd ${TMPDIR}
g.message message="Fetching ${MODULE} from GRASS-Addons SVN (be patient)..."
svn co ${SVNURL_ADDONS}/${MODULECLASS}/${MODULE}
@@ -96,7 +105,7 @@
g.message -e message="GRASS Addon ${MODULE} not found in repository"
exit 1
else
- cd ${MYTMP}/${MODULE}
+ cd ${TMPDIR}/${MODULE}
g.message message="Compiling ${MODULE}..."
make MODULE_TOPDIR=${GISBASE}
if [ $? -ne 0 ] ; then
More information about the grass-commit
mailing list