zfsonlinux/zfs-patches/0015-Fix-systemd_-RPM-macros-usage-on-Debian-based-distri.patch
Fabian Grünbichler 75b07eca3e update ZFS to 0.7.7
by importing the upstream release as patches. replace user namespace
patch with version which has been applied usptream.
2018-04-03 14:25:21 +02:00

86 lines
2.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: LOLi <loli10K@users.noreply.github.com>
Date: Fri, 2 Feb 2018 22:50:42 +0100
Subject: [PATCH] Fix systemd_ RPM macros usage on Debian-based distributions
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Debian-based distributions do not seem to provide RPM macros for
dealing with systemd pre- and post- (un)install actions: this results
in errors when installing or upgrading .deb packages because the
resulting control scripts contain the following unresolved macros:
* %systemd_post
* %systemd_preun
* %systemd_postun
Fix this by providing default values for postinstall, preuninstall and
postuninstall scripts when these macros are not defined.
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Signed-off-by: loli10K <ezomori.nozomu@gmail.com>
Closes #7074
Closes #7100
(cherry picked from commit 29b79dcfe90a67a919c2f42fbaa2e557ea484bd5)
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
rpm/generic/zfs.spec.in | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/rpm/generic/zfs.spec.in b/rpm/generic/zfs.spec.in
index 4a911b4c2..ce028794c 100644
--- a/rpm/generic/zfs.spec.in
+++ b/rpm/generic/zfs.spec.in
@@ -245,8 +245,15 @@ find %{?buildroot}%{_libdir} -name '*.la' -exec rm -f {} \;
%post
%if 0%{?_systemd}
+%if 0%{?systemd_post:1}
%systemd_post %{systemd_svcs}
%else
+if [ "$1" = "1" -o "$1" = "install" ] ; then
+ # Initial installation
+ systemctl preset %{systemd_svcs} >/dev/null || true
+fi
+%endif
+%else
if [ -x /sbin/chkconfig ]; then
/sbin/chkconfig --add zfs-import
/sbin/chkconfig --add zfs-mount
@@ -258,9 +265,17 @@ exit 0
%preun
%if 0%{?_systemd}
+%if 0%{?systemd_preun:1}
%systemd_preun %{systemd_svcs}
%else
-if [ "$1" = "0" ] && [ -x /sbin/chkconfig ]; then
+if [ "$1" = "0" -o "$1" = "remove" ] ; then
+ # Package removal, not upgrade
+ systemctl --no-reload disable %{systemd_svcs} >/dev/null || true
+ systemctl stop %{systemd_svcs} >/dev/null || true
+fi
+%endif
+%else
+if [ "$1" = "0" -o "$1" = "remove" ] && [ -x /sbin/chkconfig ]; then
/sbin/chkconfig --del zfs-import
/sbin/chkconfig --del zfs-mount
/sbin/chkconfig --del zfs-share
@@ -271,7 +286,11 @@ exit 0
%postun
%if 0%{?_systemd}
+%if 0%{?systemd_postun:1}
%systemd_postun %{systemd_svcs}
+%else
+systemctl --system daemon-reload >/dev/null || true
+%endif
%endif
%files
--
2.14.2