warn "One or more preprocessing steps failed. The corresponding routing services will not be started."
fi
}
safe_copy_map(){
local src="$1";local dest="$2"
if["${dry_run}"=true];then
warn "[DRY RUN] Would copy ${src} -> ${dest}"
return 0
fi
mkdir -p"$(dirname "${dest}")"
if[!-f"${src}"];then
err "Map source file does not exist: ${src}"
exit 1
fi
info "Copying map to processing directory: ${dest}"
cp -f"${src}""${dest}"
}
# -------------------------
# Start routed services
# -------------------------
start_routed_services(){
info "Starting routed services..."
if["${dry_run}"=true];then
warn "[DRY RUN] Would start routed containers via docker compose"
return 0
fi
local services_to_start=()
for profile in"${PROFILE_ARR[@]}";do
local pdata="${work_dir}/${profile}-data"
# Check if preprocessing was successful by looking for the output files
if[-f"${pdata}/map.osrm"];then
services_to_start+=("osrm-routed-${profile}")
else
warn "Skipping 'osrm-routed-${profile}' because preprocessed data was not found in ${pdata}"
fi
done
if[${#services_to_start[@]}-eq 0 ];then
err "No successfully preprocessed profiles found. Cannot start any routing services."
return 1
fi
info "Starting services: ${services_to_start[*]}"
docker compose -f"${COMPOSE_FILE}" up -d--remove-orphans"${services_to_start[@]}"
success "Routed services started."
}
# -------------------------
# Start frontend
# -------------------------
start_frontend(){
if["${no_frontend}"=true];then
info "Frontend installation skipped (--no-frontend)"
return 0
fi
if["${dry_run}"=true];then
warn "[DRY RUN] Would start osrm-frontend via docker compose"
return 0
fi
info "Starting frontend service..."
docker compose -f"${COMPOSE_FILE}" up -d--remove-orphans osrm-frontend
success "Frontend started on host port ${frontend_port}"
}
}
# -------------------------
# -------------------------
# NGPM hints
# Command Implementations
# -------------------------
# -------------------------
generate_ngpm_hints(){
run_install(){
info "Generating NGPM hints at ${NGPM_HINTS}"
info "Starting OSRM installation for map instance: '${map_name}'"
{
if[-f"${COMPOSE_FILE}"]&&! ask_confirm "Instance '${map_name}' may exist. Re-running will recreate containers. Continue?";then info "Installation aborted.";exit 0;fi