Skip to content

Commit

Permalink
Merge pull request #7 from kevinmcox/3.0.4
Browse files Browse the repository at this point in the history
Bug fixes
  • Loading branch information
jelockwood authored Oct 20, 2020
2 parents 0239a43 + 2252c77 commit 533400a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion installer_package/installer_package.pkgproj
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@
<key>USE_HFS+_COMPRESSION</key>
<false/>
<key>VERSION</key>
<string>3.0.2</string>
<string>3.0.4</string>
</dict>
<key>TYPE</key>
<integer>0</integer>
Expand Down
16 changes: 8 additions & 8 deletions pinpoint.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
# Copyright John E. Lockwood (2018-2019)
# Copyright John E. Lockwood (2018-2020)
#
# pinpoint a script to find your Mac's location
#
Expand All @@ -10,7 +10,7 @@
# Script name
scriptname=$(basename -- "$0")
# Version number
versionstring="3.0.3"
versionstring="3.0.4"
# get date and time in UTC hence timezone offset is zero
rundate=`date -u +%Y-%m-%d\ %H:%M:%S\ +0000`
#echo "$rundate"
Expand Down Expand Up @@ -170,11 +170,11 @@ echo "$result"
#
# Get HTTP result code, if 400 it implies it failed, if 200 it succeeded
# A 400 or 404 error might mean none of your detect WiFi BSSIDs are known to Google
resultcode=`echo "$result" | grep "HTTP" | awk '{print $2}'`
resultcode=`echo "$result" | grep "HTTP/2" | awk '{print $2}'`
echo "Result code = $resultcode"
if [ $resultcode != "200" ]; then
if [ "$resultcode" != "200" ]; then
if [ -e "$resultslocation" ]; then
reason=`echo "$result" | grep "HTTP" | awk -F ": " '{print $2}'`
reason=`echo "$result" | grep "reason" | awk -F ": " '{print $2}'`
defaults write "$resultslocation" CurrentStatus -string "Error $resultcode - $reason"
defaults write "$resultslocation" LastRun -string "$rundate"
defaults write "$resultslocation" StaleLocation -string "Yes"
Expand Down Expand Up @@ -257,10 +257,10 @@ else
# This is done in order to be backwards compatible with the previous Location Services based version of pinpoint
ls_enabled=`defaults read "/var/db/locationd/Library/Preferences/ByHost/com.apple.locationd" LocationServicesEnabled`
echo "ls_enabled = $ls_enabled"
if [ "$ls_enabled" == "True" ]; then
defaults write "$resultslocation" LS_Enabled -bool TRUE
if [ "$ls_enabled" == "1" ]; then
defaults write "$resultslocation" LS_Enabled -int 1
else
defaults write "$resultslocation" LS_Enabled -bool FALSE
defaults write "$resultslocation" LS_Enabled -int 0
fi
defaults write "$resultslocation" LastLocationRun -string "$rundate"
defaults write "$resultslocation" LastRun -string "$rundate"
Expand Down

0 comments on commit 533400a

Please sign in to comment.