]>
Commit | Line | Data |
---|---|---|
75b07eca FG |
1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
2 | From: LOLi <loli10K@users.noreply.github.com> | |
3 | Date: Fri, 2 Feb 2018 22:50:42 +0100 | |
4 | Subject: [PATCH] Fix systemd_ RPM macros usage on Debian-based distributions | |
5 | MIME-Version: 1.0 | |
6 | Content-Type: text/plain; charset=UTF-8 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ||
9 | Debian-based distributions do not seem to provide RPM macros for | |
10 | dealing with systemd pre- and post- (un)install actions: this results | |
11 | in errors when installing or upgrading .deb packages because the | |
12 | resulting control scripts contain the following unresolved macros: | |
13 | ||
14 | * %systemd_post | |
15 | * %systemd_preun | |
16 | * %systemd_postun | |
17 | ||
18 | Fix this by providing default values for postinstall, preuninstall and | |
19 | postuninstall scripts when these macros are not defined. | |
20 | ||
21 | Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> | |
22 | Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov> | |
23 | Signed-off-by: loli10K <ezomori.nozomu@gmail.com> | |
24 | Closes #7074 | |
25 | Closes #7100 | |
26 | (cherry picked from commit 29b79dcfe90a67a919c2f42fbaa2e557ea484bd5) | |
27 | Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com> | |
28 | --- | |
29 | rpm/generic/zfs.spec.in | 21 ++++++++++++++++++++- | |
30 | 1 file changed, 20 insertions(+), 1 deletion(-) | |
31 | ||
32 | diff --git a/rpm/generic/zfs.spec.in b/rpm/generic/zfs.spec.in | |
33 | index 4a911b4c2..ce028794c 100644 | |
34 | --- a/rpm/generic/zfs.spec.in | |
35 | +++ b/rpm/generic/zfs.spec.in | |
36 | @@ -245,8 +245,15 @@ find %{?buildroot}%{_libdir} -name '*.la' -exec rm -f {} \; | |
37 | ||
38 | %post | |
39 | %if 0%{?_systemd} | |
40 | +%if 0%{?systemd_post:1} | |
41 | %systemd_post %{systemd_svcs} | |
42 | %else | |
43 | +if [ "$1" = "1" -o "$1" = "install" ] ; then | |
44 | + # Initial installation | |
45 | + systemctl preset %{systemd_svcs} >/dev/null || true | |
46 | +fi | |
47 | +%endif | |
48 | +%else | |
49 | if [ -x /sbin/chkconfig ]; then | |
50 | /sbin/chkconfig --add zfs-import | |
51 | /sbin/chkconfig --add zfs-mount | |
52 | @@ -258,9 +265,17 @@ exit 0 | |
53 | ||
54 | %preun | |
55 | %if 0%{?_systemd} | |
56 | +%if 0%{?systemd_preun:1} | |
57 | %systemd_preun %{systemd_svcs} | |
58 | %else | |
59 | -if [ "$1" = "0" ] && [ -x /sbin/chkconfig ]; then | |
60 | +if [ "$1" = "0" -o "$1" = "remove" ] ; then | |
61 | + # Package removal, not upgrade | |
62 | + systemctl --no-reload disable %{systemd_svcs} >/dev/null || true | |
63 | + systemctl stop %{systemd_svcs} >/dev/null || true | |
64 | +fi | |
65 | +%endif | |
66 | +%else | |
67 | +if [ "$1" = "0" -o "$1" = "remove" ] && [ -x /sbin/chkconfig ]; then | |
68 | /sbin/chkconfig --del zfs-import | |
69 | /sbin/chkconfig --del zfs-mount | |
70 | /sbin/chkconfig --del zfs-share | |
71 | @@ -271,7 +286,11 @@ exit 0 | |
72 | ||
73 | %postun | |
74 | %if 0%{?_systemd} | |
75 | +%if 0%{?systemd_postun:1} | |
76 | %systemd_postun %{systemd_svcs} | |
77 | +%else | |
78 | +systemctl --system daemon-reload >/dev/null || true | |
79 | +%endif | |
80 | %endif | |
81 | ||
82 | %files | |
83 | -- | |
84 | 2.14.2 | |
85 |