From c386b150c47e9b9347c4bf28a45a5847b5b8467b Mon Sep 17 00:00:00 2001 From: cclohmar Date: Mon, 1 Jun 2026 23:18:40 +0000 Subject: [PATCH] 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 --- install.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 55ced3a..502b64c 100755 --- a/install.sh +++ b/install.sh @@ -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