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