summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaleb S. KEITHLEY <kkeithle@redhat.com>2017-10-02 10:44:59 -0400
committerjiffin tony Thottan <jthottan@redhat.com>2018-10-10 05:21:29 +0000
commit9f32a0adc51820948d8e1bd34e1805869bbf2ad2 (patch)
tree5a120cf0b46cbdc27656af87bc188f32ac492f67
parent76788178ba725442c95541e37e56d4a83da2bb78 (diff)
packaging: manual systemctl daemon reload required after install
Use the %systemd_{post,preun,postun_with_restart} macros provided Reported-by: Sam McLeod <rhbugs@auto.smcleod.net> Changes from the following patches from master branch are included: * https://review.gluster.org/#/c/18418 * https://review.gluster.org/#/c/18432 Change-Id: Ibb33a748fc4226864019765b59d1a154b7297bae BUG: 1497989 Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
-rw-r--r--glusterfs.spec.in90
1 files changed, 48 insertions, 42 deletions
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
index f68e38f..befb43a 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -111,28 +111,34 @@
%endif
%if ( 0%{?_with_systemd:1} )
-%global _init_enable() /bin/systemctl enable %1.service ;
-%global _init_disable() /bin/systemctl disable %1.service ;
-%global _init_restart() /bin/systemctl try-restart %1.service ;
-%global _init_start() /bin/systemctl start %1.service ;
-%global _init_stop() /bin/systemctl stop %1.service ;
-%global _init_install() install -D -p -m 0644 %1 %{buildroot}%{_unitdir}/%2.service ;
+%global service_start() /bin/systemctl --quiet start %1.service || : \
+%{nil}
+%global service_stop() /bin/systemctl --quiet stop %1.service || :\
+%{nil}
+%global service_install() install -D -p -m 0644 %1.service %{buildroot}%2 \
+%{nil}
# can't seem to make a generic macro that works
-%global _init_glusterd %{_unitdir}/glusterd.service
-%global _init_glusterfsd %{_unitdir}/glusterfsd.service
-%global _init_glustereventsd %{_unitdir}/glustereventsd.service
-%global _init_glusterfssharedstorage %{_unitdir}/glusterfssharedstorage.service
+%global glusterd_svcfile %{_unitdir}/glusterd.service
+%global glusterfsd_svcfile %{_unitdir}/glusterfsd.service
+%global glustereventsd_svcfile %{_unitdir}/glustereventsd.service
+%global glusterfssharedstorage_svcfile %{_unitdir}/glusterfssharedstorage.service
%else
-%global _init_enable() /sbin/chkconfig --add %1 ;
-%global _init_disable() /sbin/chkconfig --del %1 ;
-%global _init_restart() /sbin/service %1 condrestart &>/dev/null ;
-%global _init_start() /sbin/service %1 start &>/dev/null ;
-%global _init_stop() /sbin/service %1 stop &>/dev/null ;
-%global _init_install() install -D -p -m 0755 %1 %{buildroot}%{_sysconfdir}/init.d/%2 ;
+%global systemd_post() /sbin/chkconfig --add %1 >/dev/null 2>&1 || : \
+%{nil}
+%global systemd_preun() /sbin/chkconfig --del %1 >/dev/null 2>&1 || : \
+%{nil}
+%global systemd_postun_with_restart() /sbin/service %1 condrestart >/dev/null 2>&1 || : \
+%{nil}
+%global service_start() /sbin/service %1 start >/dev/null 2>&1 || : \
+%{nil}
+%global service_stop() /sbin/service %1 stop >/dev/null 2>&1 || : \
+%{nil}
+%global service_install() install -D -p -m 0755 %1.init %{buildroot}%2 \
+%{nil}
# can't seem to make a generic macro that works
-%global _init_glusterd %{_sysconfdir}/init.d/glusterd
-%global _init_glusterfsd %{_sysconfdir}/init.d/glusterfsd
-%global _init_glustereventsd %{_sysconfdir}/init.d/glustereventsd
+%global glusterd_svcfile %{_sysconfdir}/init.d/glusterd
+%global glusterfsd_svcfile %{_sysconfdir}/init.d/glusterfsd
+%global glustereventsd_svcfile %{_sysconfdir}/init.d/glustereventsd
%endif
%if ( 0%{_for_fedora_koji_builds} )
@@ -755,7 +761,7 @@ sed -i 's|option working-directory /etc/glusterd|option working-directory %{_sha
# Install glusterfsd .service or init.d file
%if ( 0%{_for_fedora_koji_builds} )
-%_init_install %{glusterfsd_service} glusterfsd
+%service_install glusterfsd %{glusterfsd_svcfile}
%endif
install -D -p -m 0644 extras/glusterfs-logrotate \
@@ -804,7 +810,7 @@ rm -rf %{buildroot}
/sbin/ldconfig
%if ( 0%{!?_without_syslog:1} )
%if ( 0%{?fedora} ) || ( 0%{?rhel} && 0%{?rhel} >= 6 )
-%_init_restart rsyslog
+%systemd_postun_with_restart rsyslog
%endif
%endif
exit 0
@@ -814,7 +820,7 @@ exit 0
%if ( 0%{!?_without_events:1} )
%post events
-%_init_restart glustereventsd
+%systemd_post glustereventsd
%endif
%if ( 0%{?rhel} == 5 )
@@ -826,7 +832,7 @@ exit 0
%if ( 0%{!?_without_georeplication:1} )
%post geo-replication
if [ $1 -ge 1 ]; then
- %_init_restart glusterd
+ %systemd_postun_with_restart glusterd
fi
exit 0
%endif
@@ -836,9 +842,9 @@ exit 0
%post server
# Legacy server
-%_init_enable glusterd
+%systemd_post glusterd
%if ( 0%{_for_fedora_koji_builds} )
-%_init_enable glusterfsd
+%systemd_post glusterfsd
%endif
# ".cmd_log_history" is renamed to "cmd_history.log" in GlusterFS-3.7 .
# While upgrading glusterfs-server package form GlusterFS version <= 3.6 to
@@ -896,7 +902,7 @@ if [ $? -eq 0 ]; then
# glusterd _was_ running, we killed it, it exited after *.upgrade=on,
# so start it again
- %_init_start glusterd
+ %service_start glusterd
else
glusterd --xlator-option *.upgrade=on -N
@@ -921,9 +927,9 @@ exit 0
%if ( 0%{!?_without_events:1} )
%preun events
if [ $1 -eq 0 ]; then
- if [ -f %_init_glustereventsd ]; then
- %_init_stop glustereventsd
- %_init_disable glustereventsd
+ if [ -f %glustereventsd_svcfile ]; then
+ %service_stop glustereventsd
+ %systemd_preun glustereventsd
fi
fi
exit 0
@@ -931,20 +937,20 @@ exit 0
%preun server
if [ $1 -eq 0 ]; then
- if [ -f %_init_glusterfsd ]; then
- %_init_stop glusterfsd
+ if [ -f %glusterfsd_svcfile ]; then
+ %service_stop glusterfsd
fi
- %_init_stop glusterd
- if [ -f %_init_glusterfsd ]; then
- %_init_disable glusterfsd
+ %service_stop glusterd
+ if [ -f %glusterfsd_svcfile ]; then
+ %systemd_preun glusterfsd
fi
- %_init_disable glusterd
+ %systemd_postun_with_restart glusterd
fi
if [ $1 -ge 1 ]; then
- if [ -f %_init_glusterfsd ]; then
- %_init_restart glusterfsd
+ if [ -f %glusterfsd_svcfile ]; then
+ %systemd_postun_with_restart glusterfsd
fi
- %_init_restart glusterd
+ %systemd_postun_with_restart glusterd
fi
exit 0
@@ -955,7 +961,7 @@ exit 0
/sbin/ldconfig
%if ( 0%{!?_without_syslog:1} )
%if ( 0%{?fedora} ) || ( 0%{?rhel} && 0%{?rhel} >= 6 )
-%_init_restart rsyslog
+%systemd_postun_with_restart rsyslog
%endif
%endif
@@ -1212,12 +1218,12 @@ exit 0
%endif
# init files
-%_init_glusterd
+%glusterd_svcfile
%if ( 0%{_for_fedora_koji_builds} )
-%_init_glusterfsd
+%glusterfsd_svcfile
%endif
%if ( 0%{?_with_systemd:1} )
-%_init_glusterfssharedstorage
+%glusterfssharedstorage_svcfile
%endif
# binaries