From 5d8764ad25a271ce7bd196bfe1a568e50ceb72e0 Mon Sep 17 00:00:00 2001 From: shuki Date: Fri, 6 Mar 2026 15:38:28 +0200 Subject: [PATCH] Fix installer crash when enabling web dashboard as non-root user The grep -v pipeline combined with set -eo pipefail caused the entire installer to exit silently when the user answered "y" to web dashboard. Replace with proper if/else and add user-level systemd service support (systemctl --user) for non-root installs. Co-Authored-By: Claude Opus 4.6 --- scripts/install.sh | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index c7cb23c..b7066c4 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -182,9 +182,40 @@ if [ "$enable_web" = "y" ] || [ "$enable_web" = "Y" ]; then WEB_PASS="$api_key" # Install systemd service if [ "$MODE" = "root" ]; then - "$INSTALL_DIR/bin/gniza" web install-service 2>&1 | grep -v "^Access\|^GNIZA web" || warn "Failed to install web service" + if "$INSTALL_DIR/bin/gniza" web install-service 2>/dev/null; then + info "Web dashboard systemd service installed." + else + warn "Failed to install web service. Start manually: gniza web start" + fi else - warn "Systemd service installation requires root. Start manually: gniza web start" + # User-level systemd service + _user_service_dir="$HOME/.config/systemd/user" + mkdir -p "$_user_service_dir" + cat > "$_user_service_dir/gniza-web.service" </dev/null || true + systemctl --user enable gniza-web 2>/dev/null || true + systemctl --user restart gniza-web 2>/dev/null || true + if systemctl --user is-active gniza-web &>/dev/null; then + info "Web dashboard user service installed and started." + else + warn "Could not start user service. Start manually: gniza web start" + fi fi fi