From 8230174fcdf746f41e13cb89540fb1a07f552461 Mon Sep 17 00:00:00 2001 From: Roland Date: Mon, 9 Oct 2023 12:20:51 -0600 Subject: [PATCH] Map initialization script will only ask to reset if the map database exists. --- repair.sh | 2 +- scripts/initialize_map_db.sh | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/repair.sh b/repair.sh index 39c0a3eb..f401f4d4 100755 --- a/repair.sh +++ b/repair.sh @@ -104,7 +104,7 @@ cp /opt/wrolpi/etc/raspberrypios/mod_tile.conf /etc/apache2/conf-available/mod_t carto -v # Initialize the map if it has not been initialized. -sudo -u postgres psql -c '\l' | grep gis || yes | /opt/wrolpi/scripts/initialize_map_db.sh +sudo -u postgres psql -c '\l' | grep gis || /opt/wrolpi/scripts/initialize_map_db.sh cp /opt/wrolpi/etc/raspberrypios/renderd.conf /etc/renderd.conf # Configure Apache2 to listen on 8084. diff --git a/scripts/initialize_map_db.sh b/scripts/initialize_map_db.sh index 96e2c89a..b8405372 100755 --- a/scripts/initialize_map_db.sh +++ b/scripts/initialize_map_db.sh @@ -4,7 +4,9 @@ source /opt/wrolpi/wrolpi/scripts/lib.sh -yes_or_no "Are you sure you want to initialize the map database? Data from imported maps will be lost." || exit 0 +sudo -u postgres psql -c '\l' 2>/dev/null | grep gis >/dev/null && ( + yes_or_no "Are you sure you want to initialize the map database? Data from imported maps will be lost." || exit 0 +) set -x