[GRASS-SVN] r30046 - grass/trunk/scripts/r.in.srtm

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Feb 9 22:30:45 EST 2008


Author: hamish
Date: 2008-02-09 22:30:45 -0500 (Sat, 09 Feb 2008)
New Revision: 30046

Modified:
   grass/trunk/scripts/r.in.srtm/r.in.srtm
Log:
remove 'file' test, replace with 'unzip -t'. Bug #39

Modified: grass/trunk/scripts/r.in.srtm/r.in.srtm
===================================================================
--- grass/trunk/scripts/r.in.srtm/r.in.srtm	2008-02-10 01:14:11 UTC (rev 30045)
+++ grass/trunk/scripts/r.in.srtm/r.in.srtm	2008-02-10 03:30:45 UTC (rev 30046)
@@ -128,13 +128,17 @@
 
 if [ -f "$FILE.hgt.zip" ] ; then
     #### check if we have unzip
-    if [ ! -x "`which unzip`" ] || [ ! -x "`which file`" ] ; then
-	g.message -e "\"unzip\" and \"file\" are required, please install them first"
+    if [ ! -x "`which unzip`" ] ; then
+	g.message -e "The \"unzip\" program is required, please install it first"
 	exit 1
     fi
 
     # really a ZIP file?
-    if [ "`file -ib "$FILE.hgt.zip"`" != "application/x-zip" ] ; then
+    # make it quiet in a safe way (just in case -qq isn't portable)
+    UNZIP=-qq
+    export UNZIP
+    unzip -t "$FILE.hgt.zip" 
+    if [ $? -ne 0 ] ; then
 	g.message -e "'$FILE.hgt.zip' does not appear to be a valid zip file."
 	exit 1
     fi



More information about the grass-commit mailing list