From: Artur Frysiak Date: Sun, 4 Dec 2011 17:22:56 +0000 (+0000) Subject: - introduce %systemd_reload macro X-Git-Tag: auto/th/rpm-build-macros-1_626-1 X-Git-Url: http://git.pld-linux.org/?a=commitdiff_plain;h=refs%2Ftags%2Fauto%2Fth%2Frpm-build-macros-1_626-1;p=packages%2Frpm-pld-macros.git - introduce %systemd_reload macro - move try-restart to %systemd_post - drop %systemd_postun macro Changed files: rpm-build-macros.spec -> 1.306 rpm.macros -> 1.626 --- diff --git a/rpm-build-macros.spec b/rpm-build-macros.spec index 558219c..ae61b62 100644 --- a/rpm-build-macros.spec +++ b/rpm-build-macros.spec @@ -1,4 +1,4 @@ -%define rpm_macros_rev 1.625 +%define rpm_macros_rev 1.626 %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 d41f57b..5875e02 100644 --- a/rpm.macros +++ b/rpm.macros @@ -2045,56 +2045,45 @@ else: \ # Author: Bartlomiej Zimon # # Usage: -# %systemd_post -# %systemd_enable service_name.service -# %systemd_preun service_name.service -# %systemd_postun service_name.service +# %systemd_reload +# %systemd_post service_name1.service service_name2.service +# %systemd_preun service_name1.service service_name2.service # # Sample: # %post systemd -# %systemd_post +# %systemd_reload # or if service must be enabled by default: # %post systemd -# %systemd_post -# %systemd_enable %{name} +# %systemd_post %{name}.service # # %preun systemd -# %systemd_preun %{name} +# %systemd_preun %{name}.service # # %postun systemd -# %systemd_postun %{name} +# %systemd_reload # # Requirements: -# BuildRequires: rpmbuild(macros) >= 1.625 +# BuildRequires: rpmbuild(macros) >= 1.626 # Requires: systemd-units >= 37-0.10 -%systemd_enable() \ - export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog; \ - if [ $1 -eq 1 ]; then \ - /bin/systemctl --quiet enable %1 || : \ - fi +%systemd_reload /bin/systemd_booted && SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog /bin/systemctl --quiet daemon-reload || : %systemd_post() \ - export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog; \ - if [ $1 -eq 1 ] && /bin/systemd_booted; then \ - /bin/systemctl --quiet daemon-reload || : \ - fi + export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog \ + /bin/systemd_booted && /bin/systemctl --quiet daemon-reload || : \ + if [ $1 -eq 1 ]; then \ + /bin/systemctl --quiet enable %{*} || : \ + fi \ + if [ $1 -gt 1 ]; then \ + /bin/systemctl --quiet try-restart %{*} || : \ + fi \ %systemd_preun() \ - export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog; \ if [ $1 -eq 0 ]; then \ - /bin/systemctl --no-reload --quiet disable %1 || : \ + export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog; \ + /bin/systemctl --no-reaload --quiet disable %{*} || : \ if /bin/systemd_booted; then \ - /bin/systemctl --quiet stop %1 || : \ - fi \ - fi - -%systemd_postun() \ - 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 || : \ + /bin/systemctl --quiet stop %{*} || : \ fi \ fi