Copying WROLPi nginx config on first startup so Controller is accessible.

This commit is contained in:
Roland 2026-02-26 17:38:36 -07:00
parent 603a2c010a
commit 8fab32ef75
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
3 changed files with 12 additions and 0 deletions

View file

@ -63,6 +63,8 @@ cp /opt/wrolpi/etc/raspberrypios/50x.html /var/www/50x.html
# Copy wrolpi.conf which defines the location blocks for reverse proxy.
[ -f /etc/nginx/conf.d/default.conf ] && rm /etc/nginx/conf.d/default.conf
cp /opt/wrolpi/etc/raspberrypios/wrolpi.conf /etc/nginx/conf.d/wrolpi.conf
# Remove default site (WROLPi nginx.conf doesn't use sites-enabled).
rm -f /etc/nginx/sites-enabled/default
# WROLPi needs a few privileged commands.
cp /opt/wrolpi/etc/raspberrypios/90-wrolpi /etc/sudoers.d/90-wrolpi

View file

@ -65,6 +65,8 @@ cp /opt/wrolpi/etc/raspberrypios/50x.html /var/www/50x.html
# Copy wrolpi.conf which defines the location blocks for reverse proxy.
[ -f /etc/nginx/conf.d/default.conf ] && rm /etc/nginx/conf.d/default.conf
cp /opt/wrolpi/etc/raspberrypios/wrolpi.conf /etc/nginx/conf.d/wrolpi.conf
# Remove default site (WROLPi nginx.conf doesn't use sites-enabled).
rm -f /etc/nginx/sites-enabled/default
# WROLPi needs a few privileged commands.
cp /opt/wrolpi/etc/raspberrypios/90-wrolpi /etc/sudoers.d/90-wrolpi

View file

@ -6,6 +6,14 @@ set -x
# Generate nginx certificate for HTTPS if it doesn't exist.
/opt/wrolpi/scripts/generate_certificates.sh
# Ensure nginx config files are in place (safeguard in case build didn't complete this).
if [ ! -f /etc/nginx/conf.d/wrolpi.conf ]; then
echo "wrolpi.conf missing, copying from /opt/wrolpi..."
cp /opt/wrolpi/etc/raspberrypios/wrolpi.conf /etc/nginx/conf.d/wrolpi.conf
fi
# Remove default site if it exists (WROLPi nginx.conf doesn't use sites-enabled).
rm -f /etc/nginx/sites-enabled/default
# Enable and start nginx now that certificates exist.
systemctl enable nginx
systemctl start nginx || echo "Warning: nginx failed to start"