2
0
Fork 0

osm-garmin: add Containerfile

This commit is contained in:
Ducky 2023-09-26 02:13:31 +01:00
parent b37cf2742a
commit e52a69735c
5 changed files with 294 additions and 0 deletions

45
osm-garmin/app/daemon.sh Normal file
View file

@ -0,0 +1,45 @@
#!/usr/bin/env bash
. /app/utils.sh
sleep_build_fail="10" # 10 seconds
sleep_build_success="43200" # 12 hours
sleep_no_update="3600" # 1 hour
sleep_no_region="10" # 10 seconds
function wait() {
time="$1"
action="$2"
message="💤 Sleeping $time seconds"
[[ -n "$action" ]] && message="$message ($action)"
message="$message..."
echo "$message"
sleep $time
}
while :
do
regions="europe/andorra"
style="USERBEAM"
[[ -n "$OSMGARMIN_REGIONS" ]] && regions="$OSMGARMIN_REGIONS"
[[ -n "$OSMGARMIN_STYLE" ]] && style="$OSMGARMIN_STYLE"
regions_array="$(echo $regions | tr ";" "\n")"
for region in $regions_array; do
if [[ "$(check_osm_update "$region")" == "true" ]]; then
/app/build-gmap.sh "$region" "$style"
if [[ $? == 0 ]]; then
wait $sleep_build_success "build success"
else
wait $sleep_build_fail "build fail"
fi
else
wait $sleep_no_update "no update"
fi
done
done