diff options
author | Kaleb S. KEITHLEY <kkeithle@redhat.com> | 2017-10-02 10:44:59 -0400 |
---|---|---|
committer | Shyamsundar Ranganathan <srangana@redhat.com> | 2017-10-25 14:00:42 +0000 |
commit | 12404624ac94e0561170991f39bb3e8444022a97 (patch) | |
tree | cd8f8fd5765dd82a187f8b03045c7aa99c61be9c /glusterfs.spec.in | |
parent | e45b2a08222bd432e06c3b907bbeee4463e3d2a2 (diff) |
packaging: manual systemctl daemon reload required after install
Use the %systemd_{post,preun,postun_with_restart} macros provided
I tried both install and update from 3.10.x and did not receive
any warnings about needing daemon reload
Reported-by: Sam McLeod <rhbugs@auto.smcleod.net>
master https://review.gluster.org/18418
release-3.12 https://review.gluster.org/18422
Change-Id: Ibb33a748fc4226864019765b59d1a154b7297bae
BUG: 1497990
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Diffstat (limited to 'glusterfs.spec.in')
-rw-r--r-- | glusterfs.spec.in | 86 |
1 files changed, 46 insertions, 40 deletions
diff --git a/glusterfs.spec.in b/glusterfs.spec.in index 18009623e75..9675b70eafe 100644 --- a/glusterfs.spec.in +++ b/glusterfs.spec.in @@ -103,27 +103,33 @@ %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 glusterd_svcfile %{_unitdir}/glusterd.service +%global glusterfsd_svcfile %{_unitdir}/glusterfsd.service +%global glustereventsd_svcfile %{_unitdir}/glustereventsd.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} ) @@ -749,7 +755,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 \ @@ -805,7 +811,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 @@ -815,7 +821,7 @@ exit 0 %if ( 0%{!?_without_events:1} ) %post events -%_init_restart glustereventsd +%systemd_post glustereventsd %endif %if ( 0%{?rhel} == 5 ) @@ -833,7 +839,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 @@ -843,9 +849,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 @@ -903,7 +909,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 @@ -919,9 +925,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 @@ -929,20 +935,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 @@ -953,7 +959,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 @@ -1192,9 +1198,9 @@ exit 0 %endif # init files -%_init_glusterd +%glusterd_svcfile %if ( 0%{_for_fedora_koji_builds} ) -%_init_glusterfsd +%glusterfsd_svcfile %endif # binaries |