summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-11-17 12:30:44 +0100
committerLennart Poettering <lennart@poettering.net>2015-11-17 12:30:44 +0100
commit233f353a2201e58d3861390be579f87097f05eb3 (patch)
treea673a1272068befc1f756fe9c3dd1eb1313282ed
parente492fa402c0479b7898a3cc646bcbd6ac5162311 (diff)
parent873e413323dfff4023604849c70944674ae5cd29 (diff)
Merge pull request #1909 from keszybz/filetriggers-v2
Move daemon-reload from package %post scripts to file triggers
-rw-r--r--Makefile.am5
-rw-r--r--src/core/.gitignore1
-rw-r--r--src/core/macros.systemd.in12
-rw-r--r--src/core/triggers.systemd.in26
4 files changed, 34 insertions, 10 deletions
diff --git a/Makefile.am b/Makefile.am
index 1a5857263b..5652a899a1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1399,7 +1399,8 @@ nodist_rpmmacros_DATA = \
EXTRA_DIST += \
src/core/systemd.pc.in \
- src/core/macros.systemd.in
+ src/core/macros.systemd.in \
+ src/core/triggers.systemd.in
# ------------------------------------------------------------------------------
@@ -5880,7 +5881,7 @@ sysctl.d/%: sysctl.d/%.in
%.conf: %.conf.in
$(SED_PROCESS)
-src/core/macros.%: src/core/macros.%.in
+src/core/%.systemd: src/core/%.systemd.in
$(SED_PROCESS)
src/%.policy.in: src/%.policy.in.in
diff --git a/src/core/.gitignore b/src/core/.gitignore
index f293bbdc93..465b4fcc20 100644
--- a/src/core/.gitignore
+++ b/src/core/.gitignore
@@ -1,2 +1,3 @@
/macros.systemd
+/triggers.systemd
/systemd.pc
diff --git a/src/core/macros.systemd.in b/src/core/macros.systemd.in
index bea6ef1da3..8a0e44b58c 100644
--- a/src/core/macros.systemd.in
+++ b/src/core/macros.systemd.in
@@ -1,4 +1,4 @@
-# -*- Mode: makefile; indent-tabs-mode: t -*- */
+# -*- Mode: rpm-spec; indent-tabs-mode: nil -*- */
#
# This file is part of systemd.
#
@@ -39,7 +39,7 @@ Requires(postun): systemd \
%systemd_post() \
if [ $1 -eq 1 ] ; then \
# Initial installation \
- systemctl preset %{?*} >/dev/null 2>&1 || : \
+ systemctl --no-reload preset %{?*} >/dev/null 2>&1 || : \
fi \
%{nil}
@@ -48,8 +48,7 @@ fi \
%systemd_preun() \
if [ $1 -eq 0 ] ; then \
# Package removal, not upgrade \
- systemctl --no-reload disable %{?*} > /dev/null 2>&1 || : \
- systemctl stop %{?*} > /dev/null 2>&1 || : \
+ systemctl --no-reload disable --now %{?*} > /dev/null 2>&1 || : \
fi \
%{nil}
@@ -60,14 +59,11 @@ if [ $1 -eq 0 ] ; then \
fi \
%{nil}
-%systemd_postun() \
-systemctl daemon-reload >/dev/null 2>&1 || : \
-%{nil}
+%systemd_postun() %{nil}
%systemd_user_postun() %{nil}
%systemd_postun_with_restart() \
-systemctl daemon-reload >/dev/null 2>&1 || : \
if [ $1 -ge 1 ] ; then \
# Package upgrade, not uninstall \
systemctl try-restart %{?*} >/dev/null 2>&1 || : \
diff --git a/src/core/triggers.systemd.in b/src/core/triggers.systemd.in
new file mode 100644
index 0000000000..141f42dbcf
--- /dev/null
+++ b/src/core/triggers.systemd.in
@@ -0,0 +1,26 @@
+# -*- Mode: rpm-spec; indent-tabs-mode: nil -*- */
+#
+# This file is part of systemd.
+#
+# Copyright 2015 Zbigniew Jędrzejewski-Szmek
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+#
+# systemd is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with systemd; If not, see <http://www.gnu.org/licenses/>.
+
+# The contents of this are an example to be copied into systemd.spec.
+
+%transfiletriggerin -- @systemunitdir@ /etc/systemd/system
+systemctl daemon-reload &>/dev/null || :
+
+%transfiletriggerun -- @systemunitdir@ /etc/systemd/system
+systemctl daemon-reload &>/dev/null || :