#!/bin/sh

. /lib/functions.sh
. /lib/netifd/netifd-proto.sh

if [ "$ACTION" == "ifup" ] && [ "$DEVICE" == "wwan-wan" ]
then
        local device=$(uci get geolocationd.geolocation.device)
        [ -e "$device" ] || {
        	logger "it doesnt exist $device needed by geolocationd."
        }
	#just at boot
	uptime_seconds=$(cat /proc/uptime | cut -d '.' -f 1)
	[ "$uptime_seconds" -lt 300 ] && {
            #filter already known locations?
            ubus call geolocationd update
        }                           
fi
 
