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}
87 %udev_hwdb_update() %{nil}
89 %udev_rules_update() %{nil}
91 %journal_catalog_update() %{nil}
94 systemd-tmpfiles --create %{?*} >/dev/null 2>&1 || : \
97 # Deprecated. Use %sysusers_create_package instead
99 systemd-sysusers %{?*} >/dev/null 2>&1 || : \
102 %sysusers_create_inline() \
103 echo %{?*} | systemd-sysusers - >/dev/null 2>&1 || : \
106 # This should be used by package installation scripts which
107 # require users or groups to be present before the files installed
108 # by the package are present on disk (for example because some files
109 # are owned by those users or groups).
112 # Source1: %{name}.conf
115 # install -Dt %{buildroot}%{sysusersdir} %SOURCE1
117 # %sysusers_create_package %{name} %SOURCE1
119 # %{sysusersdir}/%{name}.conf
120 %sysusers_create_package() \
121 echo "%(cat %2)" | systemd-sysusers --replace=%_sysusersdir/%1.conf - >/dev/null 2>&1 || : \
125 @rootlibexecdir@/systemd-sysctl %{?*} >/dev/null 2>&1 || : \
129 @rootlibexecdir@/systemd-binfmt %{?*} >/dev/null 2>&1 || : \