]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/core/macros.systemd.in
pkgconfig: define variables relative to ${prefix}/${rootprefix}/${sysconfdir}
[thirdparty/systemd.git] / src / core / macros.systemd.in
1 # -*- Mode: rpm-spec; indent-tabs-mode: nil -*- */
2 # SPDX-License-Identifier: LGPL-2.1+
3 #
4 # This file is part of systemd.
5
6 # RPM macros for packages installing systemd unit files
7
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@
26
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
30
31 %systemd_requires \
32 Requires(post): systemd \
33 Requires(preun): systemd \
34 Requires(postun): systemd \
35 %{nil}
36
37 %systemd_ordering \
38 OrderWithRequires(post): systemd \
39 OrderWithRequires(preun): systemd \
40 OrderWithRequires(postun): systemd \
41 %{nil}
42
43 %systemd_post() \
44 if [ $1 -eq 1 ] ; then \
45 # Initial installation \
46 systemctl --no-reload preset %{?*} &>/dev/null || : \
47 fi \
48 %{nil}
49
50 %systemd_user_post() %{expand:%systemd_post \\--global %%{?*}}
51
52 %systemd_preun() \
53 if [ $1 -eq 0 ] ; then \
54 # Package removal, not upgrade \
55 systemctl --no-reload disable --now %{?*} &>/dev/null || : \
56 fi \
57 %{nil}
58
59 %systemd_user_preun() \
60 if [ $1 -eq 0 ] ; then \
61 # Package removal, not upgrade \
62 systemctl --global disable %{?*} &>/dev/null || : \
63 fi \
64 %{nil}
65
66 %systemd_postun() %{nil}
67
68 %systemd_user_postun() %{nil}
69
70 %systemd_postun_with_restart() \
71 if [ $1 -ge 1 ] ; then \
72 # Package upgrade, not uninstall \
73 systemctl try-restart %{?*} &>/dev/null || : \
74 fi \
75 %{nil}
76
77 %systemd_user_postun_with_restart() %{nil}
78
79 %udev_hwdb_update() %{nil}
80
81 %udev_rules_update() %{nil}
82
83 %journal_catalog_update() %{nil}
84
85 # Deprecated. Use %tmpfiles_create_package instead
86 %tmpfiles_create() \
87 systemd-tmpfiles --create %{?*} &>/dev/null || : \
88 %{nil}
89
90 # Deprecated. Use %sysusers_create_package instead
91 %sysusers_create() \
92 systemd-sysusers %{?*} &>/dev/null || : \
93 %{nil}
94
95 %sysusers_create_inline() \
96 systemd-sysusers - <<SYSTEMD_INLINE_EOF &>/dev/null || : \
97 %{?*} \
98 SYSTEMD_INLINE_EOF \
99 %{nil}
100
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).
104 #
105 # Example:
106 # Source1: %{name}-sysusers.conf
107 # ...
108 # %install
109 # install -D %SOURCE1 %{buildroot}%{_sysusersdir}/%{name}.conf
110 # %pre
111 # %sysusers_create_package %{name} %SOURCE1
112 # %files
113 # %{_sysusersdir}/%{name}.conf
114 %sysusers_create_package() \
115 systemd-sysusers --replace=%_sysusersdir/%1.conf - <<SYSTEMD_INLINE_EOF &>/dev/null || : \
116 %(cat %2) \
117 SYSTEMD_INLINE_EOF \
118 %{nil}
119
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.
123 #
124 # Example:
125 # Source1: %{name}-tmpfiles.conf
126 # ...
127 # %install
128 # install -D %SOURCE1 %{buildroot}%{_tmpfilesdir}/%{name}.conf
129 # %pre
130 # %tmpfiles_create_package %{name} %SOURCE1
131 # %files
132 # %{_tmpfilesdir}/%{name}.conf
133 %tmpfiles_create_package() \
134 systemd-tmpfiles --replace=%_tmpfilesdir/%1.conf --create - <<SYSTEMD_INLINE_EOF &>/dev/null || : \
135 %(cat %2) \
136 SYSTEMD_INLINE_EOF \
137 %{nil}
138
139 %sysctl_apply() \
140 @rootlibexecdir@/systemd-sysctl %{?*} &>/dev/null || : \
141 %{nil}
142
143 %binfmt_apply() \
144 @rootlibexecdir@/systemd-binfmt %{?*} &>/dev/null || : \
145 %{nil}