From 1c2e3f3b5523c803a62b19ff68a186c654ea8283 Mon Sep 17 00:00:00 2001 From: ofirgalcon Date: Tue, 20 Dec 2022 19:12:24 +0000 Subject: [PATCH 1/3] Update pinpoint.sh --- pinpoint.sh | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) mode change 100644 => 100755 pinpoint.sh diff --git a/pinpoint.sh b/pinpoint.sh old mode 100644 new mode 100755 index 55b6511..0f9ec97 --- a/pinpoint.sh +++ b/pinpoint.sh @@ -14,7 +14,7 @@ # The aim is to reduce the usage of the Google API calls and thereby either keep you within # the free allowance or at least reduce the cost. # -# Many thanks are therefore given to Ofir Gil for this significant enhancement. +# Many thanks are therefore given to Ofir Gal for this significant enhancement. # # Script name scriptname=$(basename -- "$0") @@ -42,7 +42,10 @@ usage() debugLog="/var/log/pinpoint.log" function DebugLog { - [ $use_debug = "True" ] && echo "$1" >> "$debugLog" && echo "$1" + if [[ "${use_debug}" == "True" ]] || [[ "${use_debug}" == "true" ]] ; then + echo "$1" >> "$debugLog" + echo "$1" + fi } # fuzzy string comparison @@ -187,7 +190,7 @@ fi # # has wifi signal changed - if not then exit -if [ "$use_optim" = "True" ] ; then +if [[ "${use_optim}" == "True" ]] || [[ "${use_optim}" == "true" ]] ; then NewResult="" OldResult="$(cat /tmp/pinpoint-wifi-scan.txt)" || OldResult="" NewResult="$(echo $gl_ssids | awk '{print substr($0, 1, 22)}' | sort -t '$' -k2,2rn | head -1)" @@ -200,13 +203,13 @@ if [ "$use_optim" = "True" ] ; then NewSignal="$(echo "$NewResult" | awk '{print substr($0, 19, 4)}')" test $OldSignal || OldSignal="0" test $NewSignal || NewSignal="0" - SignalChange=$( echo "($OldSignal-$NewSignal)" | bc) + let SignalChange=OldSignal-NewSignal DebugLog "$(date)" DebugLog "$OldAP $OldSignal" DebugLog "$NewAP $NewSignal" DebugLog "signal change: $SignalChange" - - if (( $SignalChange > 12 )) || (( $SignalChange < -12 )) ; then + thrshld=12 + if (( SignalChange > thrshld )) || (( SignalChange < -thrshld )) ; then moved=1 DebugLog "significant signal change" else @@ -226,7 +229,6 @@ if [ "$use_optim" = "True" ] ; then LastStatus="$(defaults read "$resultslocation" CurrentStatus | grep 403)" LastAddress="$(defaults read "$resultslocation" Address)" - if ! (( $moved )) ; then DebugLog "Last status $LastStatus" DebugLog "Last address $LastAddress" @@ -345,7 +347,7 @@ else fi # Use Google to reverse geocode location to get street address -if [ "$use_geocode" == "True" ]; then +if [[ "${use_geocode}" == "True" ]] || [[ "${use_geocode}" == "true" ]] ; then DebugLog "Getting geocode" #address=$(curl -s "https://maps.googleapis.com/maps/api/geocode/json?latlng=$lat,$long") # If you get an error saying you need to supply a valid API key then try this line instead @@ -374,7 +376,7 @@ else fi # # Use Google to find elevation aka altitude -if [ "$use_altitude" == "True" ]; then +if [[ "${use_altitude}" == "True" ]] || [[ "${use_altitude}" == "true" ]] ; then altitude_result=$(curl -s "https://maps.googleapis.com/maps/api/elevation/json?locations=$lat,$long&key=$YOUR_API_KEY") altitude_status=`echo "$altitude_result" | grep -m1 "status" | awk -F ":" '{print $2}' | sed -e 's/^ "//' -e 's/.\{1\}$//'` if [ "$altitude_status" != "OK" ]; then From 129465d4abea2046ba0d1d8589126e7dd80ef2b5 Mon Sep 17 00:00:00 2001 From: ofirgalcon Date: Tue, 20 Dec 2022 19:13:41 +0000 Subject: [PATCH 2/3] Update pinpoint.sh --- pinpoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pinpoint.sh b/pinpoint.sh index 0f9ec97..f6a4455 100755 --- a/pinpoint.sh +++ b/pinpoint.sh @@ -19,7 +19,7 @@ # Script name scriptname=$(basename -- "$0") # Version number -versionstring="3.2.1" +versionstring="3.2.2" # get date and time in UTC hence timezone offset is zero rundate=`date -u +%Y-%m-%d\ %H:%M:%S\ +0000` #echo "$rundate" From cfd567a07e9cb65c958976ef80258f8aa0d84c8d Mon Sep 17 00:00:00 2001 From: ofirgalcon Date: Tue, 20 Dec 2022 19:30:51 +0000 Subject: [PATCH 3/3] Update installer_package.pkgproj --- installer_package/installer_package.pkgproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer_package/installer_package.pkgproj b/installer_package/installer_package.pkgproj index d48496f..83ef10f 100644 --- a/installer_package/installer_package.pkgproj +++ b/installer_package/installer_package.pkgproj @@ -542,7 +542,7 @@ USE_HFS+_COMPRESSION VERSION - 3.2.1 + 3.2.2 TYPE 0