]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph.spec.in: systemd-ify radosgw
authorNathan Cutler <ncutler@suse.com>
Thu, 9 Jul 2015 13:14:48 +0000 (15:14 +0200)
committerNathan Cutler <ncutler@suse.com>
Tue, 27 Oct 2015 10:24:18 +0000 (11:24 +0100)
without introducing a second %preun radosgw

Signed-off-by: Owen Synge <osynge@suse.com>
Signed-off-by: Nathan Cutler <ncutler@suse.com>
(cherry picked from commit 6d7a07203da2fc268a9c51246694f693389b4426)

Conflicts:
ceph.spec.in
            omit old sysvinit stuff

ceph.spec.in

index af6062c5f4eb71c11ec471bab401c7d462d9962a..2b4d051787ca540dbd05013f56d69a52e878ef28 100644 (file)
@@ -628,6 +628,7 @@ rm -rf $RPM_BUILD_ROOT
 %endif
 
 %post
+/sbin/ldconfig
 %if 0%{?_with_systemd}
   systemd-tmpfiles --create %{_tmpfilesdir}/%{name}.conf
   %if 0%{?suse_version}
@@ -636,7 +637,6 @@ rm -rf $RPM_BUILD_ROOT
 %else
   /sbin/chkconfig --add ceph
 %endif
-/sbin/ldconfig
 
 %preun
 %if 0%{?_with_systemd}
@@ -836,37 +836,75 @@ fi
 #################################################################################
 %files radosgw
 %defattr(-,root,root,-)
-%{_initrddir}/ceph-radosgw
 %{_bindir}/radosgw
 %{_bindir}/radosgw-admin
 %{_mandir}/man8/radosgw.8*
 %{_mandir}/man8/radosgw-admin.8*
-%{_sbindir}/rcceph-radosgw
 %config(noreplace) %{_sysconfdir}/logrotate.d/radosgw
 %config %{_sysconfdir}/bash_completion.d/radosgw-admin
 %dir %{_localstatedir}/log/radosgw/
 %dir %{_localstatedir}/lib/ceph/radosgw
+%if 0%{?_with_systemd}
+  %{_tmpfilesdir}/%{name}-radosgw.conf
+  %dir %{_tmpfilesdir}/
+  %{_unitdir}/ceph-radosgw@.service
+  %dir /usr/lib/ceph-radosgw
+  /usr/lib/ceph-radosgw/ceph-radosgw-prestart.sh
+%else
+  %{_initrddir}/ceph-radosgw
+  %{_sbindir}/rcceph-radosgw
+%endif
+
 
 %post radosgw
 /sbin/ldconfig
-%if %{defined suse_version}
-%fillup_and_insserv -f -y ceph-radosgw
+%if 0%{?suse_version}
+  # TODO: find out what exactly this systemd-tmpfiles inovcation is for
+  systemd-tmpfiles --create %{_tmpfilesdir}/ceph-radosgw.conf
+  # explicit systemctl daemon-reload (that's the only relevant bit of
+  # service_add_post; the rest is all sysvinit --> systemd migration which
+  # isn't applicable in this context (see above comment).
+  /usr/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+%else
+  %if 0%{?suse_version}
+    %fillup_and_insserv -f -y ceph-radosgw
+  %endif
 %endif
 
 %preun radosgw
-%if %{defined suse_version}
-%stop_on_removal ceph-radosgw
+%if 0%{?_with_systemd}
+  SERVICE_LIST=$(systemctl | grep -E '^ceph-radosgw@'  | cut -d' ' -f1)
+  if [ -n "$SERVICE_LIST" ]; then
+    for SERVICE in $SERVICE_LIST; do
+      /usr/bin/systemctl --no-reload disable $SERVICE > /dev/null 2>&1 || :
+      /usr/bin/systemctl stop $SERVICE > /dev/null 2>&1 || :
+    done
+  fi
+%else
+  %if 0%{?suse_version}
+    %stop_on_removal ceph-radosgw
+  %endif
 %endif
 
 %postun radosgw
 /sbin/ldconfig
-%if %{defined suse_version}
-%restart_on_update ceph-radosgw
-%insserv_cleanup
+%if 0%{?_with_systemd}
+  SERVICE_LIST=$(systemctl | grep -E '^ceph-radosgw@'  | cut -d' ' -f1)
+  if [ -n "$SERVICE_LIST" ]; then
+    for SERVICE in $SERVICE_LIST; do
+      /usr/bin/systemctl --no-reload disable $SERVICE > /dev/null 2>&1 || :
+      /usr/bin/systemctl try-restart $SERVICE > /dev/null 2>&1 || :
+    done
+  fi
+%else
+  %if 0%{?suse_version}
+    %restart_on_update ceph-radosgw
+    %insserv_cleanup
+  %endif
 %endif
 # Package removal cleanup
-if [ "$1" -eq "0" ] ; then
-    rm -rf /var/log/radosgw
+if [ "$1" = "0" ] ; then
+  rm -rf /var/log/radosgw
 fi