1 # -*- Mode: rpm-spec; indent-tabs-mode: nil -*- */
2 # SPDX-License-Identifier: LGPL-2.1+
4 # This file is part of systemd.
6 # Copyright 2012 Lennart Poettering
8 # systemd is free software; you can redistribute it and/or modify it
9 # under the terms of the GNU Lesser General Public License as published by
10 # the Free Software Foundation; either version 2.1 of the License, or
11 # (at your option) any later version.
13 # systemd is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # Lesser General Public License for more details.
18 # You should have received a copy of the GNU Lesser General Public License
19 # along with systemd; If not, see <http://www.gnu.org/licenses/>.
21 # RPM macros for packages installing systemd unit files
23 %_unitdir @systemunitdir@
24 %_userunitdir @userunitdir@
25 %_presetdir @systempresetdir@
26 %_userpresetdir @userpresetdir@
27 %_udevhwdbdir @udevhwdbdir@
28 %_udevrulesdir @udevrulesdir@
29 %_journalcatalogdir @catalogdir@
30 %_tmpfilesdir @tmpfilesdir@
31 %_sysusersdir @sysusersdir@
32 %_sysctldir @sysctldir@
33 %_binfmtdir @binfmtdir@
34 %_systemdgeneratordir @systemgeneratordir@
35 %_systemdusergeneratordir @usergeneratordir@
36 %_systemd_system_env_generator_dir @systemenvgeneratordir@
37 %_systemd_user_env_generator_dir @userenvgeneratordir@
40 Requires(post): systemd \
41 Requires(preun): systemd \
42 Requires(postun): systemd \
46 OrderWithRequires(post): systemd \
47 OrderWithRequires(preun): systemd \
48 OrderWithRequires(postun): systemd \
52 if [ $1 -eq 1 ] ; then \
53 # Initial installation \
54 systemctl --no-reload preset %{?*} >/dev/null 2>&1 || : \
58 %systemd_user_post() %{expand:%systemd_post \\--user \\--global %%{?*}}
61 if [ $1 -eq 0 ] ; then \
62 # Package removal, not upgrade \
63 systemctl --no-reload disable --now %{?*} > /dev/null 2>&1 || : \
67 %systemd_user_preun() \
68 if [ $1 -eq 0 ] ; then \
69 # Package removal, not upgrade \
70 systemctl --no-reload --user --global disable %{?*} > /dev/null 2>&1 || : \
74 %systemd_postun() %{nil}
76 %systemd_user_postun() %{nil}
78 %systemd_postun_with_restart() \
79 if [ $1 -ge 1 ] ; then \
80 # Package upgrade, not uninstall \
81 systemctl try-restart %{?*} >/dev/null 2>&1 || : \
85 %systemd_user_postun_with_restart() %{nil}
88 systemd-hwdb update >/dev/null 2>&1 || : \
91 %udev_rules_update() \
92 udevadm control --reload >/dev/null 2>&1 || : \
95 %journal_catalog_update() \
96 journalctl --update-catalog >/dev/null 2>&1 || : \
100 systemd-tmpfiles --create %{?*} >/dev/null 2>&1 || : \
104 systemd-sysusers %{?*} >/dev/null 2>&1 || : \
107 %sysusers_create_inline() \
108 echo %{?*} | systemd-sysusers - >/dev/null 2>&1 || : \
112 @rootlibexecdir@/systemd-sysctl %{?*} >/dev/null 2>&1 || : \
116 @rootlibexecdir@/systemd-binfmt %{?*} >/dev/null 2>&1 || : \