]>
Commit | Line | Data |
---|---|---|
873e4133 | 1 | # -*- Mode: rpm-spec; indent-tabs-mode: nil -*- */ |
d9215cd8 | 2 | # SPDX-License-Identifier: LGPL-2.1+ |
590f18a2 LP |
3 | # |
4 | # This file is part of systemd. | |
5 | # | |
6 | # Copyright 2012 Lennart Poettering | |
590f18a2 LP |
7 | |
8 | # RPM macros for packages installing systemd unit files | |
9 | ||
10 | %_unitdir @systemunitdir@ | |
ed8086d1 | 11 | %_userunitdir @userunitdir@ |
a1d41e17 | 12 | %_presetdir @systempresetdir@ |
c715e7a9 | 13 | %_userpresetdir @userpresetdir@ |
1b0fcd74 LP |
14 | %_udevhwdbdir @udevhwdbdir@ |
15 | %_udevrulesdir @udevrulesdir@ | |
16 | %_journalcatalogdir @catalogdir@ | |
b532bdea | 17 | %_binfmtdir @binfmtdir@ |
424e80b4 ZJS |
18 | %_sysctldir @sysctldir@ |
19 | %_sysusersdir @sysusersdir@ | |
20 | %_tmpfilesdir @tmpfilesdir@ | |
21 | %_environmnentdir @environmentdir@ | |
22 | %_modulesloaddir @modulesloaddir@ | |
23 | %_modprobedir @modprobedir@ | |
1071fd08 ZJS |
24 | %_systemdgeneratordir @systemgeneratordir@ |
25 | %_systemdusergeneratordir @usergeneratordir@ | |
64691d20 ZJS |
26 | %_systemd_system_env_generator_dir @systemenvgeneratordir@ |
27 | %_systemd_user_env_generator_dir @userenvgeneratordir@ | |
590f18a2 LP |
28 | |
29 | %systemd_requires \ | |
30 | Requires(post): systemd \ | |
31 | Requires(preun): systemd \ | |
32 | Requires(postun): systemd \ | |
33 | %{nil} | |
34 | ||
2424b6bd HH |
35 | %systemd_ordering \ |
36 | OrderWithRequires(post): systemd \ | |
37 | OrderWithRequires(preun): systemd \ | |
38 | OrderWithRequires(postun): systemd \ | |
39 | %{nil} | |
40 | ||
590f18a2 LP |
41 | %systemd_post() \ |
42 | if [ $1 -eq 1 ] ; then \ | |
43 | # Initial installation \ | |
030caa65 | 44 | systemctl --no-reload preset %{?*} &>/dev/null || : \ |
590f18a2 LP |
45 | fi \ |
46 | %{nil} | |
47 | ||
28d36da6 | 48 | %systemd_user_post() %{expand:%systemd_post \\--global %%{?*}} |
7c67f0f7 | 49 | |
590f18a2 LP |
50 | %systemd_preun() \ |
51 | if [ $1 -eq 0 ] ; then \ | |
52 | # Package removal, not upgrade \ | |
030caa65 | 53 | systemctl --no-reload disable --now %{?*} &>/dev/null || : \ |
590f18a2 LP |
54 | fi \ |
55 | %{nil} | |
56 | ||
7c67f0f7 ZJS |
57 | %systemd_user_preun() \ |
58 | if [ $1 -eq 0 ] ; then \ | |
59 | # Package removal, not upgrade \ | |
030caa65 | 60 | systemctl --global disable %{?*} &>/dev/null || : \ |
7c67f0f7 ZJS |
61 | fi \ |
62 | %{nil} | |
63 | ||
873e4133 | 64 | %systemd_postun() %{nil} |
590f18a2 | 65 | |
7c67f0f7 ZJS |
66 | %systemd_user_postun() %{nil} |
67 | ||
590f18a2 | 68 | %systemd_postun_with_restart() \ |
590f18a2 LP |
69 | if [ $1 -ge 1 ] ; then \ |
70 | # Package upgrade, not uninstall \ | |
030caa65 | 71 | systemctl try-restart %{?*} &>/dev/null || : \ |
590f18a2 LP |
72 | fi \ |
73 | %{nil} | |
1b0fcd74 | 74 | |
7c67f0f7 ZJS |
75 | %systemd_user_postun_with_restart() %{nil} |
76 | ||
32a00a9c | 77 | %udev_hwdb_update() %{nil} |
1b0fcd74 | 78 | |
32a00a9c | 79 | %udev_rules_update() %{nil} |
1b0fcd74 | 80 | |
32a00a9c | 81 | %journal_catalog_update() %{nil} |
042e33ae | 82 | |
0f78fee8 | 83 | # Deprecated. Use %tmpfiles_create_package instead |
042e33ae | 84 | %tmpfiles_create() \ |
030caa65 | 85 | systemd-tmpfiles --create %{?*} &>/dev/null || : \ |
042e33ae | 86 | %{nil} |
b532bdea | 87 | |
07a7d4a0 | 88 | # Deprecated. Use %sysusers_create_package instead |
b532bdea | 89 | %sysusers_create() \ |
030caa65 | 90 | systemd-sysusers %{?*} &>/dev/null || : \ |
b532bdea LP |
91 | %{nil} |
92 | ||
0e77023e | 93 | %sysusers_create_inline() \ |
030caa65 | 94 | systemd-sysusers - <<SYSTEMD_INLINE_EOF &>/dev/null || : \ |
c2887d56 | 95 | %{?*} \ |
dd2490ae | 96 | SYSTEMD_INLINE_EOF \ |
0e77023e LP |
97 | %{nil} |
98 | ||
0f78fee8 ZJS |
99 | # This should be used by package installation scripts which require users or |
100 | # groups to be present before the files installed by the package are present on | |
101 | # disk (for example because some files are owned by those users or groups). | |
07a7d4a0 ZJS |
102 | # |
103 | # Example: | |
0f78fee8 | 104 | # Source1: %{name}-sysusers.conf |
07a7d4a0 ZJS |
105 | # ... |
106 | # %install | |
0f78fee8 | 107 | # install -D %SOURCE1 %{buildroot}%{_sysusersdir}/%{name}.conf |
07a7d4a0 ZJS |
108 | # %pre |
109 | # %sysusers_create_package %{name} %SOURCE1 | |
110 | # %files | |
0f78fee8 | 111 | # %{_sysusersdir}/%{name}.conf |
07a7d4a0 | 112 | %sysusers_create_package() \ |
030caa65 | 113 | systemd-sysusers --replace=%_sysusersdir/%1.conf - <<SYSTEMD_INLINE_EOF &>/dev/null || : \ |
dd2490ae ZJS |
114 | %(cat %2) \ |
115 | SYSTEMD_INLINE_EOF \ | |
07a7d4a0 ZJS |
116 | %{nil} |
117 | ||
0f78fee8 ZJS |
118 | # This may be used by package installation scripts to create files according to |
119 | # their tmpfiles configuration from a package installation script, even before | |
120 | # the files of that package are installed on disk. | |
121 | # | |
122 | # Example: | |
123 | # Source1: %{name}-tmpfiles.conf | |
124 | # ... | |
125 | # %install | |
126 | # install -D %SOURCE1 %{buildroot}%{_tmpfilesdir}/%{name}.conf | |
127 | # %pre | |
128 | # %tmpfiles_create_package %{name} %SOURCE1 | |
129 | # %files | |
130 | # %{_tmpfilesdir}/%{name}.conf | |
131 | %tmpfiles_create_package() \ | |
030caa65 | 132 | systemd-tmpfiles --replace=%_tmpfilesdir/%1.conf --create - <<SYSTEMD_INLINE_EOF &>/dev/null || : \ |
dd2490ae ZJS |
133 | %(cat %2) \ |
134 | SYSTEMD_INLINE_EOF \ | |
0f78fee8 ZJS |
135 | %{nil} |
136 | ||
b532bdea | 137 | %sysctl_apply() \ |
030caa65 | 138 | @rootlibexecdir@/systemd-sysctl %{?*} &>/dev/null || : \ |
b532bdea LP |
139 | %{nil} |
140 | ||
141 | %binfmt_apply() \ | |
030caa65 | 142 | @rootlibexecdir@/systemd-binfmt %{?*} &>/dev/null || : \ |
b532bdea | 143 | %{nil} |