From 2f43b34b791022fd747536479c3d2277ca8175b2 Mon Sep 17 00:00:00 2001 From: Roland Date: Tue, 1 Oct 2024 11:29:45 -0600 Subject: [PATCH] Moving wrolpi user creation above usage. --- repair.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/repair.sh b/repair.sh index 03c2a34e..cf45d48c 100755 --- a/repair.sh +++ b/repair.sh @@ -25,6 +25,14 @@ systemctl stop nginx || : systemctl stop renderd || : systemctl stop apache2 || : +# Create the WROLPi user +grep wrolpi: /etc/passwd || useradd -md /home/wrolpi wrolpi -s "$(command -v bash)" +[ -f /home/wrolpi/.pgpass ] || cat >/home/wrolpi/.pgpass <<'EOF' +127.0.0.1:5432:gis:_renderd:wrolpi +127.0.0.1:5432:wrolpi:wrolpi:wrolpi +EOF +chmod 0600 /home/wrolpi/.pgpass + # Reset any inadvertent changes to the WROLPi repo. Restore ownership in case this repair script fails. git config --global --add safe.directory /opt/wrolpi git reset HEAD --hard @@ -76,14 +84,6 @@ a2enmod headers systemctl enable renderd systemctl start renderd -# Create the WROLPi user -grep wrolpi: /etc/passwd || useradd -md /home/wrolpi wrolpi -s "$(command -v bash)" -[ -f /home/wrolpi/.pgpass ] || cat >/home/wrolpi/.pgpass <<'EOF' -127.0.0.1:5432:gis:_renderd:wrolpi -127.0.0.1:5432:wrolpi:wrolpi:wrolpi -EOF -chmod 0600 /home/wrolpi/.pgpass - # WROLPi needs a few privileged commands. cp /opt/wrolpi/etc/raspberrypios/90-wrolpi /etc/sudoers.d/90-wrolpi chmod 0440 /etc/sudoers.d/90-wrolpi