richardphibel / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
ac3a84
From 4161593c24ea24f03bc89d74147e7209dc02ba80 Mon Sep 17 00:00:00 2001
ac3a84
From: Mike Yuan <me@yhndnzj.com>
ac3a84
Date: Sat, 3 Dec 2022 20:27:47 +0800
ac3a84
Subject: [PATCH] rpm/systemd-update-helper: use --no-warn when disabling units
ac3a84
ac3a84
Suppress the "empty [Install] section" warning (see #25437).
ac3a84
ac3a84
(cherry picked from commit 0acb1459a15f5b4d3a9bd2e7bf52661ca7bdebf0)
ac3a84
ac3a84
Related: #2141979
ac3a84
---
ac3a84
 src/rpm/systemd-update-helper.in | 8 ++++----
ac3a84
 1 file changed, 4 insertions(+), 4 deletions(-)
ac3a84
ac3a84
diff --git a/src/rpm/systemd-update-helper.in b/src/rpm/systemd-update-helper.in
ac3a84
index ab8cdc0ff9..b35d952fab 100755
ac3a84
--- a/src/rpm/systemd-update-helper.in
ac3a84
+++ b/src/rpm/systemd-update-helper.in
ac3a84
@@ -19,21 +19,21 @@ case "$command" in
ac3a84
 
ac3a84
     remove-system-units)
ac3a84
         if [ -d /run/systemd/system ]; then
ac3a84
-            systemctl --no-reload disable --now "$@"
ac3a84
+            systemctl --no-reload disable --now --no-warn "$@"
ac3a84
         else
ac3a84
-            systemctl --no-reload disable "$@"
ac3a84
+            systemctl --no-reload disable --no-warn "$@"
ac3a84
         fi
ac3a84
         ;;
ac3a84
 
ac3a84
     remove-user-units)
ac3a84
-        systemctl --global disable "$@"
ac3a84
+        systemctl --global disable --no-warn "$@"
ac3a84
 
ac3a84
         [ -d /run/systemd/system ] || exit 0
ac3a84
 
ac3a84
         users=$(systemctl list-units 'user@*' --legend=no | sed -n -r 's/.*user@([0-9]+).service.*/\1/p')
ac3a84
         for user in $users; do
ac3a84
             SYSTEMD_BUS_TIMEOUT={{UPDATE_HELPER_USER_TIMEOUT}} \
ac3a84
-                    systemctl --user -M "$user@" disable --now "$@" &
ac3a84
+                    systemctl --user -M "$user@" disable --now --no-warn "$@" &
ac3a84
         done
ac3a84
         wait
ac3a84
         ;;