%endif
%{!?_udevrulesdir: %global _udevrulesdir /lib/udev/rules.d}
-
-# Use systemd files on RHEL 7 and above and in SUSE/openSUSE.
-# Note: We don't install unit files for the services yet. For now,
-# the _with_systemd variable only implies that we'll install
-# /etc/tmpfiles.d/ceph.conf in order to set up the socket directory in
-# /var/run/ceph.
-%if 0%{?fedora} || 0%{?rhel} >= 7 || 0%{?suse_version}
-%global _with_systemd 1
%{!?tmpfiles_create: %global tmpfiles_create systemd-tmpfiles --create}
-%endif
# unify libexec for all targets
%global _libexecdir %{_exec_prefix}/lib
# distro-conditional dependencies
#################################################################################
%if 0%{?suse_version}
-%if 0%{?_with_systemd}
BuildRequires: pkgconfig(systemd)
BuildRequires: systemd-rpm-macros
BuildRequires: systemd
%{?systemd_requires}
-%endif
PreReq: %fillup_prereq
BuildRequires: net-tools
BuildRequires: libbz2-devel
BuildRequires: python-Cython
%endif
%if 0%{?fedora} || 0%{?rhel}
-%if 0%{?_with_systemd}
Requires: systemd
-%endif
BuildRequires: btrfs-progs
BuildRequires: nss-devel
BuildRequires: keyutils-libs-devel
Requires: python-rbd = %{epoch}:%{version}-%{release}
Requires: python-cephfs = %{epoch}:%{version}-%{release}
Requires: python-requests
-%if 0%{?_with_systemd}
%{?systemd_requires}
-%endif
%if 0%{?suse_version}
Requires(pre): pwdutils
%endif
%if 0%{?rhel} && ! 0%{?centos}
--enable-subman \
%endif
-%if 0%{?_with_systemd}
--with-systemdsystemunitdir=%_unitdir \
-%endif
--docdir=%{_docdir}/ceph \
--with-man-pages \
--mandir="%_mandir" \
%if 0%{?suse_version}
install -m 0644 -D etc/sysconfig/ceph $RPM_BUILD_ROOT%{_localstatedir}/adm/fillup-templates/sysconfig.%{name}
%endif
-%if 0%{?_with_systemd}
- install -m 0644 -D systemd/ceph.tmpfiles.d $RPM_BUILD_ROOT%{_tmpfilesdir}/ceph-common.conf
- install -m 0755 -D systemd/ceph $RPM_BUILD_ROOT%{_sbindir}/rcceph
- install -m 0644 -D systemd/50-ceph.preset $RPM_BUILD_ROOT%{_libexecdir}/systemd/system-preset/50-ceph.preset
-%else
- install -D src/init-rbdmap $RPM_BUILD_ROOT%{_initrddir}/rbdmap
- install -D src/init-ceph $RPM_BUILD_ROOT%{_initrddir}/ceph
- install -D src/init-radosgw $RPM_BUILD_ROOT%{_initrddir}/ceph-radosgw
- ln -sf ../../etc/init.d/ceph %{buildroot}/%{_sbindir}/rcceph
- ln -sf ../../etc/init.d/ceph-radosgw %{buildroot}/%{_sbindir}/rcceph-radosgw
-%endif
+install -m 0644 -D systemd/ceph.tmpfiles.d $RPM_BUILD_ROOT%{_tmpfilesdir}/ceph-common.conf
+install -m 0755 -D systemd/ceph $RPM_BUILD_ROOT%{_sbindir}/rcceph
+install -m 0644 -D systemd/50-ceph.preset $RPM_BUILD_ROOT%{_libexecdir}/systemd/system-preset/50-ceph.preset
mkdir -p $RPM_BUILD_ROOT%{_sbindir}
install -m 0644 -D src/logrotate.conf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/ceph
chmod 0644 $RPM_BUILD_ROOT%{_docdir}/ceph/sample.ceph.conf
#set up placeholder directories
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/ceph
-%if ! 0%{?_with_systemd}
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/run/ceph
-%endif
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/ceph
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/ceph/tmp
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/ceph/mon
%{_bindir}/ceph-detect-init
%{_bindir}/ceph-client-debug
%{_bindir}/cephfs
-%if 0%{?_with_systemd}
%{_unitdir}/ceph-create-keys@.service
%{_libexecdir}/systemd/system-preset/50-ceph.preset
-%else
-%{_initrddir}/ceph
-%endif
%{_sbindir}/ceph-create-keys
%{_sbindir}/rcceph
%if 0%{?rhel} >= 7 || 0%{?fedora} || 0%{?suse_version}
%attr(750,ceph,ceph) %dir %{_localstatedir}/lib/ceph/bootstrap-osd
%attr(750,ceph,ceph) %dir %{_localstatedir}/lib/ceph/bootstrap-mds
%attr(750,ceph,ceph) %dir %{_localstatedir}/lib/ceph/bootstrap-rgw
-%if ! 0%{?_with_systemd}
-%attr(770,ceph,ceph) %dir %{_localstatedir}/run/ceph
-%endif
%post base
/sbin/ldconfig
%endif
%{_bindir}/ceph-post-file
%{_bindir}/ceph-brag
-%if 0%{?_with_systemd}
%{_tmpfilesdir}/ceph-common.conf
-%endif
%{_mandir}/man8/ceph-authtool.8*
%{_mandir}/man8/ceph-conf.8*
%{_mandir}/man8/ceph-dencoder.8*
%config %{_sysconfdir}/bash_completion.d/rados
%config %{_sysconfdir}/bash_completion.d/rbd
%config(noreplace) %{_sysconfdir}/ceph/rbdmap
-%if 0%{?_with_systemd}
%{_unitdir}/rbdmap.service
-%else
-%{_initrddir}/rbdmap
-%endif
%{python_sitelib}/ceph_argparse.py*
%{python_sitelib}/ceph_daemon.py*
%{_udevrulesdir}/50-rbd.rules
exit 0
%post common
-%if 0%{?_with_systemd}
%tmpfiles_create %{_tmpfilesdir}/ceph-common.conf
-%endif
%postun common
# Package removal cleanup
%files mds
%{_bindir}/ceph-mds
%{_mandir}/man8/ceph-mds.8*
-%if 0%{?_with_systemd}
%{_unitdir}/ceph-mds@.service
%{_unitdir}/ceph-mds.target
-%else
-%{_initrddir}/ceph
-%endif
%attr(750,ceph,ceph) %dir %{_localstatedir}/lib/ceph/mds
%post mds
%{_mandir}/man8/ceph-mon.8*
%{_mandir}/man8/ceph-rest-api.8*
%{python_sitelib}/ceph_rest_api.py*
-%if 0%{?_with_systemd}
%{_unitdir}/ceph-mon@.service
%{_unitdir}/ceph-mon.target
-%else
-%{_initrddir}/ceph
-%endif
%attr(750,ceph,ceph) %dir %{_localstatedir}/lib/ceph/mon
%post mon
%defattr(-,root,root,-)
%{_bindir}/rbd-mirror
%{_mandir}/man8/rbd-mirror.8*
-%if 0%{?_with_systemd}
%{_unitdir}/ceph-rbd-mirror@.service
%{_unitdir}/ceph-rbd-mirror.target
-%endif
%post -n rbd-mirror
%if 0%{?suse_version}
%{_mandir}/man8/radosgw-admin.8*
%config %{_sysconfdir}/bash_completion.d/radosgw-admin
%dir %{_localstatedir}/lib/ceph/radosgw
-%if 0%{?_with_systemd}
%{_unitdir}/ceph-radosgw@.service
%{_unitdir}/ceph-radosgw.target
-%else
-%{_initrddir}/ceph-radosgw
-%{_sbindir}/rcceph-radosgw
-%endif
%post radosgw
%if 0%{?suse_version}
%if 0%{?rhel} && ! 0%{?centos}
/etc/cron.hourly/subman
%endif
-%if 0%{?_with_systemd}
%{_unitdir}/ceph-osd@.service
%{_unitdir}/ceph-osd.target
%{_unitdir}/ceph-disk@.service
-%else
-%{_initrddir}/ceph
-%endif
%attr(750,ceph,ceph) %dir %{_localstatedir}/lib/ceph/osd
%post osd
%dir %{_prefix}/lib/ocf
%dir %{_prefix}/lib/ocf/resource.d
%dir %{_prefix}/lib/ocf/resource.d/ceph
-%if 0%{_with_systemd}
%exclude %{_prefix}/lib/ocf/resource.d/ceph/ceph
%exclude %{_prefix}/lib/ocf/resource.d/ceph/mds
%exclude %{_prefix}/lib/ocf/resource.d/ceph/mon
%exclude %{_prefix}/lib/ocf/resource.d/ceph/osd
-%endif
-%if ! 0%{_with_systemd}
-%{_prefix}/lib/ocf/resource.d/ceph/ceph
-%{_prefix}/lib/ocf/resource.d/ceph/mds
-%{_prefix}/lib/ocf/resource.d/ceph/mon
-%{_prefix}/lib/ocf/resource.d/ceph/osd
-%endif
%{_prefix}/lib/ocf/resource.d/ceph/rbd
%endif
fi
# Check whether the daemons are running
-%if 0%{?_with_systemd}
- /usr/bin/systemctl status ceph.target > /dev/null 2>&1
-%else
- /sbin/service ceph status >/dev/null 2>&1
-%endif
+/usr/bin/systemctl status ceph.target > /dev/null 2>&1
STATUS=$?
# Stop the daemons if they were running
if test $STATUS -eq 0; then
-%if 0%{?_with_systemd}
/usr/bin/systemctl stop ceph.target > /dev/null 2>&1
-%else
- /sbin/service ceph stop >/dev/null 2>&1
-%endif
fi
# Now, relabel the files
# Start the daemons iff they were running before
if test $STATUS -eq 0; then
-%if 0%{?_with_systemd}
/usr/bin/systemctl start ceph.target > /dev/null 2>&1 || :
-%else
- /sbin/service ceph start >/dev/null 2>&1 || :
-%endif
fi
exit 0
fi
# Check whether the daemons are running
- %if 0%{?_with_systemd}
- /usr/bin/systemctl status ceph.target > /dev/null 2>&1
- %else
- /sbin/service ceph status >/dev/null 2>&1
- %endif
+ /usr/bin/systemctl status ceph.target > /dev/null 2>&1
STATUS=$?
# Stop the daemons if they were running
if test $STATUS -eq 0; then
- %if 0%{?_with_systemd}
/usr/bin/systemctl stop ceph.target > /dev/null 2>&1
- %else
- /sbin/service ceph stop >/dev/null 2>&1
- %endif
fi
# Now, relabel the files
# Start the daemons if they were running before
if test $STATUS -eq 0; then
- %if 0%{?_with_systemd}
/usr/bin/systemctl start ceph.target > /dev/null 2>&1 || :
- %else
- /sbin/service ceph start >/dev/null 2>&1 || :
- %endif
fi
fi
exit 0