From 844bc9468c1d509ae93890670a37ca647ab52bdc Mon Sep 17 00:00:00 2001 From: Roland Date: Wed, 22 Nov 2023 15:08:29 -0700 Subject: [PATCH] Installing help during image build. Using wrolpi.local hostname for all links. --- .../config/hooks/normal/9999-wrolpi.hook.chroot | 6 ++++++ pi-gen/stage2/04-wrolpi/04-run-chroot.sh | 16 +++++++++++++++- scripts/install_debian_12.sh | 9 +-------- scripts/install_raspberrypios.sh | 9 +-------- 4 files changed, 23 insertions(+), 17 deletions(-) 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 a7ff5aa5..66582c23 100644 --- a/debian-live-config/config/hooks/normal/9999-wrolpi.hook.chroot +++ b/debian-live-config/config/hooks/normal/9999-wrolpi.hook.chroot @@ -46,6 +46,12 @@ 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 + cp /opt/wrolpi/etc/raspberrypios/wrolpi-*.service /etc/systemd/system/ cp /opt/wrolpi/etc/raspberrypios/wrolpi.target /etc/systemd/system/ cp /opt/wrolpi/etc/raspberrypios/renderd.conf /etc/renderd.conf diff --git a/pi-gen/stage2/04-wrolpi/04-run-chroot.sh b/pi-gen/stage2/04-wrolpi/04-run-chroot.sh index 1a4442dc..51d89695 100755 --- a/pi-gen/stage2/04-wrolpi/04-run-chroot.sh +++ b/pi-gen/stage2/04-wrolpi/04-run-chroot.sh @@ -24,6 +24,14 @@ Type=Link URL=http://127.0.0.1 Icon=/opt/wrolpi/icon.png EOF +cat >/home/pi/Desktop/wrolpi-help.desktop <<'EOF' +[Desktop Entry] +Encoding=UTF-8 +Name=WROLPi Help +Type=Link +URL=http://127.0.0.1:8086 +Icon=/opt/wrolpi-help/venv/lib/python3.11/site-packages/mkdocs/themes/mkdocs/img/favicon.ico +EOF chown -R pi:pi /home/pi chmod 0600 /home/pi/.pgpass usermod -aG wrolpi pi @@ -46,6 +54,12 @@ usermod -aG _renderd wrolpi [ ! -d /var/cache/renderd/tiles ] && mkdir /var/cache/renderd/tiles 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 + # Create the media directory for the wrolpi user. echo '/dev/sda1 /media/wrolpi auto defaults,nofail 0 0' | tee -a /etc/fstab mkdir -p /media/wrolpi @@ -54,7 +68,7 @@ cat >/home/wrolpi/.pgpass <<'EOF' 127.0.0.1:5432:wrolpi:wrolpi:wrolpi EOF chmod 0600 /home/wrolpi/.pgpass -chown -R wrolpi:wrolpi /media/wrolpi /home/wrolpi +chown -R wrolpi:wrolpi /media/wrolpi /home/wrolpi /opt/wrolpi* set +x diff --git a/scripts/install_debian_12.sh b/scripts/install_debian_12.sh index 90861574..87e964fb 100755 --- a/scripts/install_debian_12.sh +++ b/scripts/install_debian_12.sh @@ -49,12 +49,6 @@ python3 -m venv /opt/wrolpi-help/venv set +x -ip=$(hostname -I | cut -d' ' -f1) -if [[ $ip == *":"* ]]; then - # Don't suggest the ipv6 address. - ip=$(hostname -I | cut -d' ' -f2) -fi - echo " WROLPi has successfully been installed! @@ -66,11 +60,10 @@ file permissions if necessary: Start the WROLPi services using: # sudo systemctl start wrolpi.target -then navigate to: http://${ip} +then navigate to: http://wrolpi.local Or, join to the Wifi hotspot: SSID: WROLPi Password: wrolpi hotspot -When on the hotspot, WROLPi is accessible at http://192.168.0.1 " diff --git a/scripts/install_raspberrypios.sh b/scripts/install_raspberrypios.sh index 56175bf3..3bc3f206 100755 --- a/scripts/install_raspberrypios.sh +++ b/scripts/install_raspberrypios.sh @@ -49,12 +49,6 @@ python3 -m venv /opt/wrolpi-help/venv set +x -ip=$(hostname -i | cut -d' ' -f1) -if [[ $ip == *":"* ]]; then - # Don't suggest the ipv6 address. - ip=$(hostname -i | cut -d' ' -f2) -fi - echo " WROLPi has successfully been installed! @@ -66,11 +60,10 @@ file permissions if necessary: Start the WROLPi services using: # sudo systemctl start wrolpi.target -then navigate to: http://${ip} +then navigate to: http://wrolpi.local Or, join to the Wifi hotspot: SSID: WROLPi Password: wrolpi hotspot -When on the hotspot, WROLPi is accessible at http://192.168.0.1 "