From e482c7a88f321e9dbd0206505c7878d6c18a5596 Mon Sep 17 00:00:00 2001 From: Roland Date: Wed, 18 Jan 2023 12:51:21 -0700 Subject: [PATCH] Use NetworkManager for hotspot. Use _renderd user to import maps. --- pi-gen/stage2/04-wrolpi/03-run-chroot.sh | 13 +++++++++++++ pi-gen/stage2/04-wrolpi/04-run-chroot.sh | 3 +++ scripts/import_map.sh | 4 ++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/pi-gen/stage2/04-wrolpi/03-run-chroot.sh b/pi-gen/stage2/04-wrolpi/03-run-chroot.sh index f4c86bcf..3a42ed49 100755 --- a/pi-gen/stage2/04-wrolpi/03-run-chroot.sh +++ b/pi-gen/stage2/04-wrolpi/03-run-chroot.sh @@ -2,6 +2,10 @@ set -e set -x +# Use Network Manager for Hotspot. +apt purge -y hostapd +apt autoremove -y + cat >> /etc/profile << 'EOF' alias ll='ls -lh' alias la='ll -a' @@ -34,6 +38,12 @@ cat >/etc/sudoers.d/90-wrolpi <<'EOF' %wrolpi ALL= NOPASSWD:/usr/bin/systemctl restart renderd.service %wrolpi ALL= NOPASSWD:/usr/bin/systemctl stop renderd.service %wrolpi ALL= NOPASSWD:/usr/bin/systemctl start renderd.service +%wrolpi ALL= NOPASSWD:/usr/bin/systemctl restart wrolpi-api.service +%wrolpi ALL= NOPASSWD:/usr/bin/systemctl stop wrolpi-api.service +%wrolpi ALL= NOPASSWD:/usr/bin/systemctl start wrolpi-api.service +%wrolpi ALL= NOPASSWD:/usr/bin/systemctl restart wrolpi-app.service +%wrolpi ALL= NOPASSWD:/usr/bin/systemctl stop wrolpi-app.service +%wrolpi ALL= NOPASSWD:/usr/bin/systemctl start wrolpi-app.service EOF chmod 660 /etc/sudoers.d/90-wrolpi @@ -47,3 +57,6 @@ cp /opt/wrolpi/etc/ubuntu20.04/wrolpi.target /etc/systemd/system/ systemctl enable wrolpi-api.service systemctl enable wrolpi-app.service +# NetworkManager for the hotspot. +systemctl enable NetworkManager + diff --git a/pi-gen/stage2/04-wrolpi/04-run-chroot.sh b/pi-gen/stage2/04-wrolpi/04-run-chroot.sh index 08a95468..f33b364a 100755 --- a/pi-gen/stage2/04-wrolpi/04-run-chroot.sh +++ b/pi-gen/stage2/04-wrolpi/04-run-chroot.sh @@ -32,3 +32,6 @@ cp /opt/wrolpi/etc/debian11/index.html \ /opt/wrolpi/modules/map/leaflet.js \ /opt/wrolpi/modules/map/leaflet.css /var/www/html/ chmod 644 /var/www/html/* + +mkdir /var/lib/mod_tile +chown -R _renderd:_renderd /var/lib/mod_tile diff --git a/scripts/import_map.sh b/scripts/import_map.sh index 7c464f0d..9cc4a3f3 100755 --- a/scripts/import_map.sh +++ b/scripts/import_map.sh @@ -58,7 +58,7 @@ if [[ ${1} == *.osm.pbf ]]; then pbf_path=${MERGED_TMP_FILE} fi - nice -n 18 osm2pgsql -d gis --create --slim -G --hstore \ + nice -n 18 osm2pgsql -d gis --create --slim -G --hstore -U _renderd -H 127.0.0.1 \ --tag-transform-script /opt/openstreetmap-carto/openstreetmap-carto.lua \ -C ${MAX_CACHE} \ --number-processes 3 \ @@ -70,7 +70,7 @@ elif [[ ${1} == *.dump ]]; then exit 7 fi # Import a Postgresql dump. - nice -n 18 pg_restore -j3 --no-owner -d gis "${1}" + nice -n 18 pg_restore -j3 --no-owner -d gis -U _renderd -h 127.0.0.1 "${1}" else echo "WROLPi: Cannot import unknown map file" exit 8