1 # -*- Mode: rpm-spec; indent-tabs-mode: nil -*- */
3 # This file is part of systemd.
5 # Copyright 2012 Lennart Poettering
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.
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.
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/>.
20 # RPM macros for packages installing systemd unit files
22 %_unitdir @systemunitdir@
23 %_userunitdir @userunitdir@
24 %_presetdir @systempresetdir@
25 %_udevhwdbdir @udevhwdbdir@
26 %_udevrulesdir @udevrulesdir@
27 %_journalcatalogdir @catalogdir@
28 %_tmpfilesdir @tmpfilesdir@
29 %_sysusersdir @sysusersdir@
30 %_sysctldir @sysctldir@
31 %_binfmtdir @binfmtdir@
34 Requires(post): systemd \
35 Requires(preun): systemd \
36 Requires(postun): systemd \
40 if [ $1 -eq 1 ] ; then \
41 # Initial installation \
42 systemctl --no-reload preset %{?*} >/dev/null 2>&1 || : \
46 %systemd_user_post() %systemd_post --user --global %{?*}
49 if [ $1 -eq 0 ] ; then \
50 # Package removal, not upgrade \
51 systemctl --no-reload disable --now %{?*} > /dev/null 2>&1 || : \
55 %systemd_user_preun() \
56 if [ $1 -eq 0 ] ; then \
57 # Package removal, not upgrade \
58 systemctl --no-reload --user --global disable %{?*} > /dev/null 2>&1 || : \
62 %systemd_postun() %{nil}
64 %systemd_user_postun() %{nil}
66 %systemd_postun_with_restart() \
67 if [ $1 -ge 1 ] ; then \
68 # Package upgrade, not uninstall \
69 systemctl try-restart %{?*} >/dev/null 2>&1 || : \
73 %systemd_user_postun_with_restart() %{nil}
76 udevadm hwdb --update >/dev/null 2>&1 || : \
79 %udev_rules_update() \
80 udevadm control --reload >/dev/null 2>&1 || : \
83 %journal_catalog_update() \
84 journalctl --update-catalog >/dev/null 2>&1 || : \
88 systemd-tmpfiles --create %{?*} >/dev/null 2>&1 || : \
92 systemd-sysusers %{?*} >/dev/null 2>&1 || : \
95 %sysusers_create_inline() \
96 echo %{?*} | systemd-sysusers - >/dev/null 2>&1 || : \
100 @rootlibexecdir@/systemd-sysctl %{?*} >/dev/null 2>&1 || : \
104 @rootlibexecdir@/systemd-binfmt %{?*} >/dev/null 2>&1 || : \