[DebianGIS-dev] r1807 - packages/gpsdrive/branches/etch/src
nd-guest at alioth.debian.org
nd-guest at alioth.debian.org
Mon Dec 22 20:15:53 UTC 2008
Author: nd-guest
Date: 2008-12-22 20:15:53 +0000 (Mon, 22 Dec 2008)
New Revision: 1807
Modified:
packages/gpsdrive/branches/etch/src/geo-code
Log:
Applied patch from 2.10~pre4-6.dfsg-1 to geo-nearest but
use mktemp -d to avoid race condition.
Modified: packages/gpsdrive/branches/etch/src/geo-code
===================================================================
--- packages/gpsdrive/branches/etch/src/geo-code 2008-12-22 19:33:23 UTC (rev 1806)
+++ packages/gpsdrive/branches/etch/src/geo-code 2008-12-22 20:15:53 UTC (rev 1807)
@@ -83,6 +83,7 @@
#
error() {
echo "`basename $PROGNAME`: $1" >&2
+ remove_cruft
exit 1
}
@@ -130,8 +131,9 @@
a) SQLMATCH=all;;
D) DEBUG="$OPTARG";;
U) echo "Getting latest version of this script..."
- curl -o$UPDATEcodeFILE "$UPDATEcodeURL"
- echo "Latest version is in $UPDATEcodeFILE"
+ destdir=`mktemp -d`
+ curl -o$destdir/$UPDATEcodeFILE "$UPDATEcodeURL"
+ echo "Latest version is in $destdir/$UPDATEcodeFILE"
exit
;;
h|\?) usage;;
@@ -243,16 +245,17 @@
do
[ -f $i ] && rm -f $i
done
+ rmdir $TMP
}
#
# Main Program
#
-TMP=/tmp/geo$$
-STYLE=${TMP}.style
-COORDS=${TMP}.coords
-OUTWAY=${TMP}.way
-MAP=${TMP}.gif
+TMP=`mktemp -d`
+STYLE=${TMP}/style
+COORDS=${TMP}/coords
+OUTWAY=${TMP}/way
+MAP=${TMP}/gif
UA="Mozilla/5.0"
if [ "$GURL" != "" ]; then
@@ -269,7 +272,6 @@
| head -n1 \
`
if [ "$URL" = "" ]; then
- cp $COORDS /tmp/geo.google
error "Unable to lookup telephone number or name with Google"
else
URL="http://maps.yahoo.com/$URL"
@@ -295,7 +297,7 @@
fi
if [ $DEBUG -gt 0 ]; then
- filter="tee /tmp/geo.yahoo"
+ filter="tee `mktemp`"
else
filter=cat
fi
@@ -306,9 +308,9 @@
-e 's/.*slt=\([^%]*\).*sln=\([^%]*\).*Create.*/\1 \2/p' \
> $COORDS
-if [ $DEBUG -gt 0 ]; then
- cp $COORDS /tmp/geo.coords
-fi
+#if [ $DEBUG -gt 0 ]; then
+# cp -d $COORDS /tmp/geo.coords
+#fi
#
# Convert the coords, address, and type to the desired
More information about the Pkg-grass-devel
mailing list