rpm/systemd-update-helper: use --no-warn when disabling units

Suppress the "empty [Install] section" warning (see #25437).
This commit is contained in:
Mike Yuan 2022-12-03 20:27:47 +08:00
parent 108d35ac7d
commit 0acb1459a1
No known key found for this signature in database
GPG key ID: 5A6360D78C6092C3

View file

@ -19,21 +19,21 @@ case "$command" in
remove-system-units)
if [ -d /run/systemd/system ]; then
systemctl --no-reload disable --now "$@"
systemctl --no-reload disable --now --no-warn "$@"
else
systemctl --no-reload disable "$@"
systemctl --no-reload disable --no-warn "$@"
fi
;;
remove-user-units)
systemctl --global disable "$@"
systemctl --global disable --no-warn "$@"
[ -d /run/systemd/system ] || exit 0
users=$(systemctl list-units 'user@*' --legend=no | sed -n -r 's/.*user@([0-9]+).service.*/\1/p')
for user in $users; do
SYSTEMD_BUS_TIMEOUT={{UPDATE_HELPER_USER_TIMEOUT}} \
systemctl --user -M "$user@" disable --now "$@" &
systemctl --user -M "$user@" disable --now --no-warn "$@" &
done
wait
;;