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