fix: update mode now copies templates, static assets, install.sh

- update mode previously only rebuilt the binary
- Now also rsyncs templates/ and static/ to install dir
- Copies updated install.sh to install dir
- Fixes ownership of new files
- Uses sudo_if for systemctl restart
This commit is contained in:
Claus Lohmar 2026-06-01 23:18:40 +00:00
parent 8ff1a4175a
commit c386b150c4

View file

@ -68,6 +68,12 @@ if [ "${1:-}" = "-update" ]; then
cd "$INSTALL_DIR"
fi
# Copy updated templates, static assets, and config files.
info "Updating templates and static assets..."
sudo_if rsync -a --delete templates/ "$INSTALL_DIR/templates/" 2>/dev/null || true
sudo_if rsync -a --delete static/ "$INSTALL_DIR/static/" 2>/dev/null || true
sudo_if cp install.sh "$INSTALL_DIR/" 2>/dev/null || true
info "Rebuilding binary..."
if command -v go &>/dev/null; then
export GOMODCACHE="${INSTALL_DIR}/.go/mod"
@ -84,8 +90,11 @@ if [ "${1:-}" = "-update" ]; then
sudo_if chmod +x app
fi
# Fix ownership of any new files.
sudo_if chown -R "${APP_USER:-${SUDO_USER:-$(whoami)}}:${APP_USER:-${SUDO_USER:-$(whoami)}}" "$INSTALL_DIR" 2>/dev/null || true
info "Restarting service..."
systemctl restart "$SERVICE_NAME"
sudo_if systemctl restart "$SERVICE_NAME"
sleep 2
if systemctl is-active --quiet "$SERVICE_NAME"; then