osm-garmin: various
parent
8a2cafd2ee
commit
bcf7ff90d8
|
@ -9,4 +9,4 @@ RUN dnf install --assumeyes --setopt=install_weak_deps=False java-1.8.0-openjdk
|
|||
RUN /app/install-mkgmap.sh
|
||||
RUN dnf clean --assumeyes all
|
||||
|
||||
CMD ["/app/daemon.sh"]
|
||||
CMD ["/app/osm-garmin.sh"]
|
|
@ -83,16 +83,8 @@ function cleanup() {
|
|||
rm -f "$build_dir/*"
|
||||
}
|
||||
|
||||
function exec_mkgmap() {
|
||||
java -jar /opt/mkgmap/mkgmap.jar $@
|
||||
}
|
||||
|
||||
function exec_splitter() {
|
||||
java -jar /opt/splitter/splitter.jar $@
|
||||
}
|
||||
|
||||
function update_bounds() {
|
||||
function download_bounds() {
|
||||
function update_bound_item() {
|
||||
type="$1"
|
||||
bounds_url_prefix="https://www.thkukuk.de/osm/data"
|
||||
|
||||
|
@ -101,8 +93,8 @@ function update_bounds() {
|
|||
rm -f "$bounds_dir/$type.zip"
|
||||
}
|
||||
|
||||
download_bounds "bounds"
|
||||
#download_bounds "sea"
|
||||
update_bound_item "bounds"
|
||||
update_bound_item "sea"
|
||||
}
|
||||
|
||||
function update_osm_map() {
|
||||
|
@ -149,7 +141,7 @@ if [[ $OSMGARMIN_SKIP_UPDATE_MAPS != "true" ]]; then
|
|||
|
||||
[[ $is_updates == "false" ]] && is_updates="true"
|
||||
else
|
||||
echo "⚠️ No updates to \"$region\""
|
||||
echo "⚠️ No updates for \"$region\""
|
||||
fi
|
||||
else
|
||||
echo "⚠️ Region \"$region\" does not exist"
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
. /app/utils.sh
|
||||
|
||||
sleep_time=3600
|
||||
sleep_time_fail=60
|
||||
|
||||
function wait() {
|
||||
delay="$1"
|
||||
echo "💤 Sleeping $delay seconds..."
|
||||
sleep $delay
|
||||
}
|
||||
|
||||
while :
|
||||
do
|
||||
/app/build-gmap.sh "$OSMGARMIN_REGIONS" "$OSMGARMIN_STYLE"
|
||||
|
||||
if [[ $? == 0 ]]; then
|
||||
wait $sleep_time
|
||||
else
|
||||
wait $sleep_time_fail
|
||||
fi
|
||||
done
|
|
@ -0,0 +1,55 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
. /app/utils.sh
|
||||
|
||||
command="$1"
|
||||
arguments="${@:2}"
|
||||
me_filename="$(basename "$(realpath -s "$0")")"
|
||||
|
||||
if [[ "$commnad" == "" ]]; then
|
||||
die "No command given. See '$me_command help'"
|
||||
fi
|
||||
|
||||
function exec_daemon() {
|
||||
sleep_time=3600
|
||||
sleep_time_fail=60
|
||||
|
||||
function wait() {
|
||||
delay="$1"
|
||||
echo "💤 Sleeping $delay seconds..."
|
||||
sleep $delay
|
||||
}
|
||||
|
||||
while :
|
||||
do
|
||||
/app/build-gmap.sh "$OSMGARMIN_REGIONS" "$OSMGARMIN_STYLE"
|
||||
|
||||
if [[ $? == 0 ]]; then
|
||||
wait $sleep_time
|
||||
else
|
||||
wait $sleep_time_fail
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
function exec_help() {
|
||||
echo "$me_filename
|
||||
|
||||
Usage:
|
||||
$me_filename daemon / $me_filename
|
||||
Start daemon to build maps periodically
|
||||
|
||||
$me_filename help
|
||||
Output this usage text
|
||||
"
|
||||
|
||||
exit 0
|
||||
}
|
||||
|
||||
case "$command" in
|
||||
""|"daemon") exec_daemon ;;
|
||||
"help") exec_help ;;
|
||||
*)
|
||||
die "Command '$command' not recognized. See '$me_filename help' for help"
|
||||
;;
|
||||
esac
|
|
@ -1,8 +1,12 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
osm_source_prefix="https://download.geofabrik.de/"
|
||||
osm_source_suffix="-latest.osm.pbf"
|
||||
osm_source_name="geofabrik"
|
||||
|
||||
bounds_dir="/data/build/bounds"
|
||||
build_dir="/data/build/tmp"
|
||||
maps_dir="/data/build/osm"
|
||||
maps_dir="/data/build/osm/$osm_source_name"
|
||||
out_dir="/data/maps"
|
||||
styles_dir="/data/styles"
|
||||
tiles_dir="/data/build/tiles"
|
||||
|
@ -40,6 +44,14 @@ function check_osm_update() {
|
|||
echo $update
|
||||
}
|
||||
|
||||
function exec_mkgmap() {
|
||||
java -jar /opt/mkgmap/mkgmap.jar $@
|
||||
}
|
||||
|
||||
function exec_splitter() {
|
||||
java -jar /opt/splitter/splitter.jar $@
|
||||
}
|
||||
|
||||
function get_md5() {
|
||||
file="$1"
|
||||
echo "$(md5sum "$file" | cut -d' ' -f1)"
|
||||
|
@ -52,10 +64,10 @@ function get_md5_dir() {
|
|||
|
||||
function get_pbf_url() {
|
||||
region="$1"
|
||||
echo "https://download.geofabrik.de/$region-latest.osm.pbf"
|
||||
echo "${osm_source_prefix}${region}${osm_source_suffix}"
|
||||
}
|
||||
|
||||
function get_region_shortname() {
|
||||
region="$1"
|
||||
echo "$(echo "$region" | sed "s/\//./g")"
|
||||
echo "${region##*/}"
|
||||
}
|
Loading…
Reference in New Issue