Page MenuHomeSealhub

set_geo.sh
No OneTemporary

set_geo.sh

#!/bin/bash
error_msg=$((
echo "auth $(cat ~/.emulator_console_auth_token)"
echo "geo fix $1 $2 0.0"
sleep 0.2
) | telnet localhost 5554 2> /dev/null | grep KO: );
sleep 1
# Technically the phone supports (prints) 6 digits of precision,
# but the last one is subject to weird rounding, so just checking the first 5
new_1=$(printf "%.5f" $1)
new_2=$(printf "%.5f" $2)
correct=${new_2},${new_1}
if [ -z "${error_msg}" ]; then
# Check if the location was actually set, for some reason the location moching doesn't work,
# unless google maps is launched first, and is given access to the phone location
out=$(. /conf/get_location.sh);
curr_1=$(printf "%.5f" $(echo $out | sed 's/.*,//'))
curr_2=$(printf "%.5f" $(echo $out | sed 's/,.*//'))
if [[ "$curr_1" != "$new_1" || "$curr_2" != "$new_2" ]]; then
echo Failed to actually set the location, but detected a prev location set
exit 1
fi
echo Succesfully set the coordinates to: $out
exit 0
else
echo "$error_msg"
exit 2;
fi

File Metadata

Mime Type
text/x-shellscript
Expires
Sat, Nov 8, 07:09 (1 d, 20 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1034266
Default Alt Text
set_geo.sh (994 B)

Event Timeline