diff --git a/scripts/deploy.sh b/scripts/deploy.sh index d64edd0..21b1cd9 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -177,20 +177,22 @@ if [ '${COPY_SHARED[$TARGET]}' = '1' ]; then fi echo ' Deploying the homepage...' - mkdir -p /srv/homepage - cp shared/homepage/index.html shared/homepage/admin.html shared/homepage/app.js \\ + ${SUDO} mkdir -p /srv/homepage + ${SUDO} cp shared/homepage/index.html shared/homepage/admin.html shared/homepage/app.js \\ shared/homepage/style.css shared/homepage/services.json /srv/homepage/ - [ -d shared/homepage/fonts ] && cp -r shared/homepage/fonts /srv/homepage/ + if [ -d shared/homepage/fonts ]; then ${SUDO} cp -r shared/homepage/fonts /srv/homepage/; fi # The last master deployment datetime (Q43): the deployed commit's datetime. DEPLOYED_AT=\"\$(git log -1 --format=%cI)\" - printf 'window.DEPLOYED_AT = \"%s\";\\n' \"\$DEPLOYED_AT\" > /srv/homepage/deployed.js + printf 'window.DEPLOYED_AT = \"%s\";\\n' \"\$DEPLOYED_AT\" > /tmp/deployed.js + ${SUDO} cp /tmp/deployed.js /srv/homepage/deployed.js + ${SUDO} chmod -R a+rX /srv/homepage # The status checker: install the timer + service, run it once, enable it. ${SUDO} cp scripts/homepage-status.py /usr/local/bin/homepage-status.py ${SUDO} cp scripts/homepage-status.service scripts/homepage-status.timer /etc/systemd/system/ ${SUDO} systemctl daemon-reload ${SUDO} systemctl enable homepage-status.timer ${SUDO} systemctl restart homepage-status.timer - python3 /usr/local/bin/homepage-status.py /srv/homepage/services.json /srv/homepage/status.json + ${SUDO} python3 /usr/local/bin/homepage-status.py /srv/homepage/services.json /srv/homepage/status.json fi if [ '${COMPOSE_UP[$TARGET]}' = '1' ]; then