chiark / gitweb /
rpm: expose preset dir as rpm macro and in systemd.pc
[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 %_presetdir @systempresetdir@
24
25 %systemd_requires \
26 Requires(post): systemd \
27 Requires(preun): systemd \
28 Requires(postun): systemd \
29 %{nil}
30
31 %systemd_post() \
32 if [ $1 -eq 1 ] ; then \
33         # Initial installation \
34         @rootbindir@/systemctl preset %{?*} >/dev/null 2>&1 || : \
35 fi \
36 %{nil}
37
38 %systemd_preun() \
39 if [ $1 -eq 0 ] ; then \
40         # Package removal, not upgrade \
41         @rootbindir@/systemctl --no-reload disable %{?*} > /dev/null 2>&1 || : \
42         @rootbindir@/systemctl stop %{?*} > /dev/null 2>&1 || : \
43 fi \
44 %{nil}
45
46 %systemd_postun() \
47 @rootbindir@/systemctl daemon-reload >/dev/null 2>&1 || : \
48 %{nil}
49
50 %systemd_postun_with_restart() \
51 @rootbindir@/systemctl daemon-reload >/dev/null 2>&1 || : \
52 if [ $1 -ge 1 ] ; then \
53         # Package upgrade, not uninstall \
54         @rootbindir@/systemctl try-restart %{?*} >/dev/null 2>&1 || : \
55 fi \
56 %{nil}