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