chiark / gitweb /
86e869307cd033d133409e1dafabc6c9c6c7d823
[elogind.git] / src / core / macros.systemd.in
1 #  -*- Mode: makefile; indent-tabs-mode: t -*- */
2 #
3 #  This file is part of systemd.
4 #
5 #  Copyright 2012 Lennart Poettering
6 #
7 #  systemd is free software; you can redistribute it and/or modify it
8 #  under the terms of the GNU Lesser General Public License as published by
9 #  the Free Software Foundation; either version 2.1 of the License, or
10 #  (at your option) any later version.
11 #
12 #  systemd is distributed in the hope that it will be useful, but
13 #  WITHOUT ANY WARRANTY; without even the implied warranty of
14 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 #  Lesser General Public License for more details.
16 #
17 #  You should have received a copy of the GNU Lesser General Public License
18 #  along with systemd; If not, see <http://www.gnu.org/licenses/>.
19
20 # RPM macros for packages installing systemd unit files
21
22 %_unitdir @systemunitdir@
23
24 %systemd_requires \
25 Requires(post): systemd \
26 Requires(preun): systemd \
27 Requires(postun): systemd \
28 %{nil}
29
30 %systemd_post() \
31 if [ $1 -eq 1 ] ; then \
32         # Initial installation \
33         @rootbindir@/systemctl preset %{?*} >/dev/null 2>&1 || : \
34 fi \
35 %{nil}
36
37 %systemd_preun() \
38 if [ $1 -eq 0 ] ; then \
39         # Package removal, not upgrade \
40         @rootbindir@/systemctl --no-reload disable %{?*} > /dev/null 2>&1 || : \
41         @rootbindir@/systemctl stop %{?*} > /dev/null 2>&1 || : \
42 fi \
43 %{nil}
44
45 %systemd_postun() \
46 @rootbindir@/systemctl daemon-reload >/dev/null 2>&1 || : \
47 %{nil}
48
49 %systemd_postun_with_restart() \
50 @rootbindir@/systemctl daemon-reload >/dev/null 2>&1 || : \
51 if [ $1 -ge 1 ] ; then \
52         # Package upgrade, not uninstall \
53         @rootbindir@/systemctl try-restart %{?*} >/dev/null 2>&1 || : \
54 fi \
55 %{nil}