From ffd36e6fa02d11adcc1a5b445ed6e6c440a8a8a2 Mon Sep 17 00:00:00 2001 From: Artur Frysiak Date: Sun, 4 Dec 2011 13:26:25 +0000 Subject: [PATCH] - use systemd_booted to check if system is booted using systemd - redirect message from systemctl to syslog Changed files: rpm-build-macros.spec -> 1.305 rpm.macros -> 1.625 --- rpm-build-macros.spec | 2 +- rpm.macros | 28 ++++++++++++++++++---------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/rpm-build-macros.spec b/rpm-build-macros.spec index 211aadd..558219c 100644 --- a/rpm-build-macros.spec +++ b/rpm-build-macros.spec @@ -1,4 +1,4 @@ -%define rpm_macros_rev 1.624 +%define rpm_macros_rev 1.625 %define find_lang_rev 1.35 Summary: PLD Linux RPM build macros Summary(pl.UTF-8): Makra do budowania pakietów RPM dla Linuksa PLD diff --git a/rpm.macros b/rpm.macros index 43b8a09..d41f57b 100644 --- a/rpm.macros +++ b/rpm.macros @@ -2065,29 +2065,37 @@ else: \ # %systemd_postun %{name} # # Requirements: -# BuildRequires: rpmbuild(macros) >= 1.622 -# Requires: rc-scripts >= ... +# BuildRequires: rpmbuild(macros) >= 1.625 +# Requires: systemd-units >= 37-0.10 %systemd_enable() \ + export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog; \ if [ $1 -eq 1 ]; then \ - /bin/systemctl enable %1 >/dev/null 2>&1 || : \ + /bin/systemctl --quiet enable %1 || : \ fi %systemd_post() \ - if [ $1 -eq 1 ]; then \ - /bin/systemctl daemon-reload >/dev/null 2>&1 || : \ + export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog; \ + if [ $1 -eq 1 ] && /bin/systemd_booted; then \ + /bin/systemctl --quiet daemon-reload || : \ fi %systemd_preun() \ + export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog; \ if [ $1 -eq 0 ]; then \ - /bin/systemctl --no-reload disable %1 > /dev/null 2>&1 || : \ - /bin/systemctl stop %1 > /dev/null 2>&1 || : \ + /bin/systemctl --no-reload --quiet disable %1 || : \ + if /bin/systemd_booted; then \ + /bin/systemctl --quiet stop %1 || : \ + fi \ fi %systemd_postun() \ - /bin/systemctl daemon-reload >/dev/null 2>&1 || : \ - if [ $1 -ge 1 ]; then \ - /bin/systemctl try-restart %1 >/dev/null 2>&1 || : \ + export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog; \ + if /bin/systemd_booted; then \ + /bin/systemctl --quiet daemon-reload || : \ + if [ $1 -ge 1 ]; then \ + /bin/systemctl --quiet try-restart %1 || : \ + fi \ fi %systemdunitdir /lib/systemd/system -- 2.44.0