diff --git a/debian-live-config/config/hooks/normal/9999-wrolpi.hook.chroot b/debian-live-config/config/hooks/normal/9999-wrolpi.hook.chroot index 66582c23..43d3d956 100644 --- a/debian-live-config/config/hooks/normal/9999-wrolpi.hook.chroot +++ b/debian-live-config/config/hooks/normal/9999-wrolpi.hook.chroot @@ -47,10 +47,7 @@ sed -i 's/port = 5433/port = 5432/' /etc/postgresql/15/main/postgresql.conf mkdir /media/wrolpi # Install WROLPi Help. -git clone https://github.com/wrolpi/wrolpi-help.git /opt/wrolpi-help || : -(cd /opt/wrolpi-help && git fetch && git checkout master && git reset --hard origin/master) -python3 -m venv /opt/wrolpi-help/venv -/opt/wrolpi-help/venv/bin/pip3 install -r /opt/wrolpi-help/requirements.txt +/opt/wrolpi/scripts/install_help_service.sh cp /opt/wrolpi/etc/raspberrypios/wrolpi-*.service /etc/systemd/system/ cp /opt/wrolpi/etc/raspberrypios/wrolpi.target /etc/systemd/system/ diff --git a/pi-gen/stage2/04-wrolpi/04-run-chroot.sh b/pi-gen/stage2/04-wrolpi/04-run-chroot.sh index 51d89695..044bdb6e 100755 --- a/pi-gen/stage2/04-wrolpi/04-run-chroot.sh +++ b/pi-gen/stage2/04-wrolpi/04-run-chroot.sh @@ -55,10 +55,7 @@ usermod -aG _renderd wrolpi chown -R _renderd:_renderd /var/cache/renderd/tiles # Install WROLPi Help. -git clone https://github.com/wrolpi/wrolpi-help.git /opt/wrolpi-help || : -(cd /opt/wrolpi-help && git fetch && git checkout master && git reset --hard origin/master) -python3 -m venv /opt/wrolpi-help/venv -/opt/wrolpi-help/venv/bin/pip3 install -r /opt/wrolpi-help/requirements.txt +/opt/wrolpi/scripts/install_help_service.sh # Create the media directory for the wrolpi user. echo '/dev/sda1 /media/wrolpi auto defaults,nofail 0 0' | tee -a /etc/fstab diff --git a/scripts/install_debian_12.sh b/scripts/install_debian_12.sh index 87e964fb..567b2d27 100755 --- a/scripts/install_debian_12.sh +++ b/scripts/install_debian_12.sh @@ -39,10 +39,7 @@ if [[ ! -f /opt/wrolpi-blobs/gis-map.dump.gz || ! -s /opt/wrolpi-blobs/gis-map.d fi # Install WROLPi Help. -git clone https://github.com/wrolpi/wrolpi-help.git /opt/wrolpi-help || : -(cd /opt/wrolpi-help && git fetch && git checkout master && git reset --hard origin/master) -python3 -m venv /opt/wrolpi-help/venv -/opt/wrolpi-help/venv/bin/pip3 install -r /opt/wrolpi-help/requirements.txt +/opt/wrolpi/scripts/install_help_service.sh # Repair will install configs and restart services. /opt/wrolpi/repair.sh diff --git a/scripts/install_help_service.sh b/scripts/install_help_service.sh new file mode 100755 index 00000000..ad48a7d0 --- /dev/null +++ b/scripts/install_help_service.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +# Re-execute this script if it wasn't called with sudo. +if [ $EUID != 0 ]; then + sudo "$0" "$@" + exit $? +fi + +set -x +set -e + +# Install WROLPi Help repo. +git clone https://github.com/wrolpi/wrolpi-help.git /opt/wrolpi-help || : +(cd /opt/wrolpi-help && git fetch && git checkout master && git reset --hard origin/master) +python3 -m venv /opt/wrolpi-help/venv +/opt/wrolpi-help/venv/bin/pip3 install -r /opt/wrolpi-help/requirements.txt + +# Install the systemd service. +cp /opt/wrolpi/etc/raspberrypios/wrolpi-help.service /etc/systemd/system/ +systemctl enable wrolpi-help.service diff --git a/scripts/install_raspberrypios.sh b/scripts/install_raspberrypios.sh index 3bc3f206..0f634935 100755 --- a/scripts/install_raspberrypios.sh +++ b/scripts/install_raspberrypios.sh @@ -39,10 +39,7 @@ if [[ ! -f /opt/wrolpi-blobs/gis-map.dump.gz || ! -s /opt/wrolpi-blobs/gis-map.d fi # Install WROLPi Help. -git clone https://github.com/wrolpi/wrolpi-help.git /opt/wrolpi-help || : -(cd /opt/wrolpi-help && git fetch && git checkout master && git reset --hard origin/master) -python3 -m venv /opt/wrolpi-help/venv -/opt/wrolpi-help/venv/bin/pip3 install -r /opt/wrolpi-help/requirements.txt +/opt/wrolpi/scripts/install_help_service.sh # Repair will install configs and restart services. /opt/wrolpi/repair.sh