source: trunk/server/fedora/specs/openafs-systemd.spec.patch @ 2089

Last change on this file since 2089 was 2089, checked in by geofft, 13 years ago
openafs.spec: Don't attempt to restart OpenAFS on upgrade (Trac: #274) systemd is actually rather capable of leaving the OpenAFS client in an incredibly broken state, thanks to its willingness to track services and kill their processes. We should not attempt to restart it on upgrade, whether a normal upgrade or a migration from SysV initscripts. In the former case, it's fine (and correct) for the old AFS to keep running; in the latter case, the unit file is capable of correctly shutting down an initscript-launched client. The same is true for the OpenAFS server. This brings the packaging in line with the SysV-style initscript code in the specfile, which does not attempt to restart the service, as well as with e.g. Debian's packaging, which uses --no-restart-on-upgrade.
File size: 5.5 KB
RevLine 
[2089]1--- openafs.spec.orig   2011-12-11 03:16:10.725175932 -0500
2+++ openafs.spec        2011-12-11 04:22:10.313676135 -0500
[2011]3@@ -224,7 +224,7 @@
4 BuildRoot: %{_tmppath}/%{name}-%{version}-root
5 Packager: OpenAFS Gatekeepers <openafs-gatekeepers@openafs.org>
6 Group: Networking/Filesystems
7-BuildRequires: %{?kdepend:%{kdepend}, } pam-devel, ncurses-devel, flex, bison
8+BuildRequires: %{?kdepend:%{kdepend}, } pam-devel, ncurses-devel, flex, bison, systemd-units
9 %if 0%{?fedora}
10 BuildRequires: perl-devel perl-ExtUtils-Embed
11 %endif
[2089]12@@ -326,6 +326,12 @@
[2011]13 %package client
14 Provides: scripts-openafs-client
15 Requires: binutils, openafs = %{version}
16+%if 0%{?fedora} >= 15
17+Requires: systemd-units
18+Requires(post): systemd-units, systemd-sysv
19+Requires(preun): systemd-units
20+Requires(postun): systemd-units
21+%endif
22 
23 %if %{fedorakmod}
24 Requires: %{name}-kmod >= %{version}
[2089]25@@ -350,6 +356,12 @@
[2011]26 Requires: openafs = %{version}
27 Summary: OpenAFS Filesystem Server
28 Group: Networking/Filesystems
29+%if 0%{?fedora} >= 15
30+Requires: systemd-units
31+Requires(post): systemd-units, systemd-sysv
32+Requires(preun): systemd-units
33+Requires(postun): systemd-units
34+%endif
35 
36 %description server
37 The AFS distributed filesystem.  AFS is a distributed filesystem
[2089]38@@ -1005,7 +1017,12 @@
[2011]39 mkdir -p $RPM_BUILD_ROOT%{_sbindir}
40 mkdir -p $RPM_BUILD_ROOT%{_libdir}
41 mkdir -p $RPM_BUILD_ROOT/etc/sysconfig
42+%if 0%{?fedora} < 15
43 mkdir -p $RPM_BUILD_ROOT%{initdir}
44+%else
45+mkdir -p $RPM_BUILD_ROOT%{_unitdir}
46+mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/modules
47+%endif
48 mkdir -p $RPM_BUILD_ROOT/etc/openafs
49 mkdir -p $RPM_BUILD_ROOT%{pamdir}
50 mkdir -p $RPM_BUILD_ROOT%{_prefix}/afs/etc
[2089]51@@ -1035,8 +1052,14 @@
[2011]52 
53 # Copy root.client config files
54 install -m 755 src/packaging/RedHat/openafs.sysconfig $RPM_BUILD_ROOT/etc/sysconfig/openafs
55+%if 0%{?fedora} < 15
56 install -m 755 src/packaging/RedHat/openafs-client.init $RPM_BUILD_ROOT%{initdir}/openafs-client
57 install -m 755 src/packaging/RedHat/openafs-server.init $RPM_BUILD_ROOT%{initdir}/openafs-server
58+%else
59+install -m 755 src/packaging/RedHat/openafs-client.service $RPM_BUILD_ROOT%{_unitdir}/openafs-client.service
60+install -m 755 src/packaging/RedHat/openafs-client.modules $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/modules/openafs-client.modules
61+install -m 755 src/packaging/RedHat/openafs-server.service $RPM_BUILD_ROOT%{_unitdir}/openafs-server.service
62+%endif
63 
64 # Copy PAM modules
65 install -m 755 ${sysname}/dest/lib/pam* $RPM_BUILD_ROOT%{pamdir}
[2089]66@@ -1318,7 +1341,14 @@
[2011]67 fi
68 
69 %post client
70+%if 0%{?fedora} < 15
71 chkconfig --add openafs-client
72+%else
73+if [ $1 -eq 1 ] ; then
74+    # Initial installation
75+    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
76+fi
77+%endif
78 if [ ! -d /afs ]; then
79        mkdir /afs
80        chown root.root /afs
[2089]81@@ -1335,10 +1365,17 @@
[2011]82 
83 %post server
84 #on an upgrade, don't enable if we were disabled
85+%if 0%{?fedora} < 15
86 if [ $1 = 1 ] ; then
87   chkconfig --add openafs-server
88 fi
89 %{initdir}/openafs-server condrestart
90+%else
91+if [ $1 -eq 1 ] ; then
92+    # Initial installation
93+    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
94+fi
95+%endif
96 
97 %if %{build_authlibs}
98 %post authlibs
[2089]99@@ -1354,16 +1391,37 @@
[2011]100 fi
101 
102 %preun client
103+%if 0%{?fedora} < 15
104 if [ $1 = 0 ] ; then
105         %{initdir}/openafs-client stop
106         chkconfig --del openafs-client
107 fi
108+%else
109+if [ $1 -eq 0 ] ; then
110+       # Package removal, not upgrade
111+       /bin/systemctl --no-reload disable openafs-client.service > /dev/null 2>&1 || :
112+       /bin/systemctl stop openafs-client.service > /dev/null 2>&1 || :
113+fi
114+%endif
115 
116 %preun server
117+%if 0%{?fedora} < 15
118 if [ $1 = 0 ] ; then
119         %{initdir}/openafs-server stop
120         chkconfig --del openafs-server
121 fi
122+%else
123+if [ $1 -eq 0 ] ; then
124+       /bin/systemctl --no-reload disable openafs-server.service > /dev/null 2>&1 || :
125+       /bin/systemctl stop openafs-server.service > /dev/null 2>&1 || :
126+fi
127+%endif
128+
129+%postun client
130+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
131+
132+%postun server
133+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
134 
135 %if %{build_dkmspkg}
136 %post -n dkms-%{name}
[2089]137@@ -1421,6 +1479,24 @@
[2011]138 %endif
139 %endif
140 
141+%triggerun -- openafs-client < 1.6.0-1
142+# Save the current service runlevel info
143+# User must manually run systemd-sysv-convert --apply httpd
144+# to migrate them to systemd targets
145+/usr/bin/systemd-sysv-convert --save openafs-client >/dev/null 2>&1 ||:
146+
[2089]147+# Run this because the SysV package being removed won't do it
[2011]148+/sbin/chkconfig --del openafs-client >/dev/null 2>&1 || :
149+
150+%triggerun -- openafs-server < 1.6.0-1
151+# Save the current service runlevel info
152+# User must manually run systemd-sysv-convert --apply httpd
153+# to migrate them to systemd targets
154+/usr/bin/systemd-sysv-convert --save openafs-server >/dev/null 2>&1 ||:
155+
[2089]156+# Run this because the SysV package being removed won't do it
[2011]157+/sbin/chkconfig --del openafs-server >/dev/null 2>&1 || :
158+
159 ##############################################################################
160 ###
161 ### file lists
[2089]162@@ -1458,7 +1534,12 @@
[2011]163 %{pamdir}/pam_afs.krb.so
164 %{pamdir}/pam_afs.so.1
165 %{pamdir}/pam_afs.so
166+%if 0%{?fedora} < 15
167 %{initdir}/openafs-client
168+%else
169+%{_unitdir}/openafs-client.service
170+%{_sysconfdir}/sysconfig/modules/openafs-client.modules
171+%endif
172 %{_mandir}/man1/cmdebug.*
173 %{_mandir}/man1/copyauth.*
174 %{_mandir}/man1/up.*
[2089]175@@ -1506,7 +1587,11 @@
[2011]176 %{_sbindir}/vldb_check
177 %{_sbindir}/vldb_convert
178 %{_sbindir}/voldump
179+%if 0%{?fedora} < 15
180 %{initdir}/openafs-server
181+%else
182+%{_unitdir}/openafs-server.service
183+%endif
184 %{_mandir}/man5/AuthLog.*
185 %{_mandir}/man5/BackupLog.*
186 %{_mandir}/man5/BosConfig.*
Note: See TracBrowser for help on using the repository browser.