瀏覽代碼

fix: use robust systemd service detection in updater

uefigs139 8 月之前
父節點
當前提交
78f17614e7
共有 1 個文件被更改,包括 2 次插入 和 1 次删除
  1. 2 1
      install/update.sh

+ 2 - 1
install/update.sh

@@ -108,7 +108,8 @@ if [ -z "$BRANCH" ]; then
   [ "$BRANCH" = "HEAD" ] && BRANCH="main"
 fi
 
-if ! systemctl list-unit-files --type=service | grep -q "^${SERVICE_NAME}\.service"; then
+load_state="$(systemctl show "$SERVICE_NAME" --property=LoadState --value 2>/dev/null || true)"
+if [ -z "$load_state" ] || [ "$load_state" = "not-found" ]; then
   die "Service not found: ${SERVICE_NAME}.service"
 fi