1 # -*- Mode: rpm-spec; indent-tabs-mode: nil -*- */
2 # SPDX-License-Identifier: LGPL-2.1+
4 # This file is part of systemd.
6 # RPM macros for packages installing systemd unit files
8 %_unitdir @systemunitdir@
9 %_userunitdir @userunitdir@
10 %_presetdir @systempresetdir@
11 %_userpresetdir @userpresetdir@
12 %_udevhwdbdir @udevhwdbdir@
13 %_udevrulesdir @udevrulesdir@
14 %_journalcatalogdir @catalogdir@
15 %_binfmtdir @binfmtdir@
16 %_sysctldir @sysctldir@
17 %_sysusersdir @sysusersdir@
18 %_tmpfilesdir @tmpfilesdir@
19 %_environmentdir @environmentdir@
20 %_modulesloaddir @modulesloaddir@
21 %_modprobedir @modprobedir@
22 %_systemdgeneratordir @systemgeneratordir@
23 %_systemdusergeneratordir @usergeneratordir@
24 %_systemd_system_env_generator_dir @systemenvgeneratordir@
25 %_systemd_user_env_generator_dir @userenvgeneratordir@
27 # Because we had one release with a typo...
28 # This is temporary (Remove after systemd 240 is released)
29 %_environmnentdir %{warn:Use %%_environmentdir instead}%_environmentdir
32 Requires(post): systemd \
33 Requires(preun): systemd \
34 Requires(postun): systemd \
38 OrderWithRequires(post): systemd \
39 OrderWithRequires(preun): systemd \
40 OrderWithRequires(postun): systemd \
44 if [ $1 -eq 1 ] ; then \
45 # Initial installation \
46 systemctl --no-reload preset %{?*} >/dev/null 2>&1 || : \
50 %systemd_user_post() %{expand:%systemd_post \\--global %%{?*}}
53 if [ $1 -eq 0 ] ; then \
54 # Package removal, not upgrade \
55 systemctl --no-reload disable --now %{?*} >/dev/null 2>&1 || : \
59 %systemd_user_preun() \
60 if [ $1 -eq 0 ] ; then \
61 # Package removal, not upgrade \
62 systemctl --global disable %{?*} >/dev/null 2>&1 || : \
66 %systemd_postun() %{nil}
68 %systemd_user_postun() %{nil}
70 %systemd_postun_with_restart() \
71 if [ $1 -ge 1 ] ; then \
72 # Package upgrade, not uninstall \
73 systemctl try-restart %{?*} >/dev/null 2>&1 || : \
77 %systemd_user_postun_with_restart() %{nil}
79 %udev_hwdb_update() %{nil}
81 %udev_rules_update() %{nil}
83 %journal_catalog_update() %{nil}
85 # Deprecated. Use %tmpfiles_create_package instead
87 systemd-tmpfiles --create %{?*} >/dev/null 2>&1 || : \
90 # Deprecated. Use %sysusers_create_package instead
92 systemd-sysusers %{?*} >/dev/null 2>&1 || : \
95 %sysusers_create_inline() \
96 systemd-sysusers - <<SYSTEMD_INLINE_EOF >/dev/null 2>&1 || : \
101 # This should be used by package installation scripts which require users or
102 # groups to be present before the files installed by the package are present on
103 # disk (for example because some files are owned by those users or groups).
106 # Source1: %{name}-sysusers.conf
109 # install -D %SOURCE1 %{buildroot}%{_sysusersdir}/%{name}.conf
111 # %sysusers_create_package %{name} %SOURCE1
113 # %{_sysusersdir}/%{name}.conf
114 %sysusers_create_package() \
115 systemd-sysusers --replace=%_sysusersdir/%1.conf - <<SYSTEMD_INLINE_EOF >/dev/null 2>&1 || : \
120 # This may be used by package installation scripts to create files according to
121 # their tmpfiles configuration from a package installation script, even before
122 # the files of that package are installed on disk.
125 # Source1: %{name}-tmpfiles.conf
128 # install -D %SOURCE1 %{buildroot}%{_tmpfilesdir}/%{name}.conf
130 # %tmpfiles_create_package %{name} %SOURCE1
132 # %{_tmpfilesdir}/%{name}.conf
133 %tmpfiles_create_package() \
134 systemd-tmpfiles --replace=%_tmpfilesdir/%1.conf --create - <<SYSTEMD_INLINE_EOF >/dev/null 2>&1 || : \
140 @rootlibexecdir@/systemd-sysctl %{?*} >/dev/null 2>&1 || : \
144 @rootlibexecdir@/systemd-binfmt %{?*} >/dev/null 2>&1 || : \