Skip to content

Commit

Permalink
rpm: drop _with_systemd
Browse files Browse the repository at this point in the history
Ceph versions jewel and above only support systemd.

Signed-off-by: Nathan Cutler <ncutler@suse.com>
(cherry picked from commit 2ca6dd2)
  • Loading branch information
smithfarm committed May 4, 2016
1 parent 69d5f27 commit 1cc7605
Showing 1 changed file with 5 additions and 98 deletions.
103 changes: 5 additions & 98 deletions ceph.spec.in
Expand Up @@ -50,16 +50,7 @@ restorecon -R /var/log/radosgw > /dev/null 2>&1;
%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
Expand Down Expand Up @@ -133,12 +124,10 @@ BuildRequires: yasm
# 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
Expand All @@ -155,9 +144,7 @@ BuildRequires: openldap2-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
Expand Down Expand Up @@ -261,9 +248,7 @@ Requires: python-rados = %{epoch}:%{version}-%{release}
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
Expand Down Expand Up @@ -682,9 +667,7 @@ export RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS | sed -e 's/i386/i486/'`
%if 0%{?rhel} && ! 0%{?centos}
--enable-subman \
%endif
%if 0%{?_with_systemd}
--with-systemdsystemunitdir=%_unitdir \
%endif
--docdir=%{_docdir}/ceph \
--with-man-pages \
--mandir="%_mandir" \
Expand Down Expand Up @@ -737,17 +720,9 @@ install -m 0644 -D etc/sysconfig/ceph $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/ce
%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
Expand Down Expand Up @@ -776,9 +751,7 @@ mv $RPM_BUILD_ROOT/sbin/mount.fuse.ceph $RPM_BUILD_ROOT/usr/sbin/mount.fuse.ceph

#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
Expand Down Expand Up @@ -810,12 +783,8 @@ rm -rf $RPM_BUILD_ROOT
%{_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}
Expand Down Expand Up @@ -863,9 +832,6 @@ rm -rf $RPM_BUILD_ROOT
%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
Expand Down Expand Up @@ -921,9 +887,7 @@ DISABLE_RESTART_ON_UPDATE="yes"
%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*
Expand All @@ -945,11 +909,7 @@ DISABLE_RESTART_ON_UPDATE="yes"
%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
Expand Down Expand Up @@ -978,9 +938,7 @@ fi
exit 0

%post common
%if 0%{?_with_systemd}
%tmpfiles_create %{_tmpfilesdir}/ceph-common.conf
%endif

%postun common
# Package removal cleanup
Expand All @@ -993,12 +951,8 @@ fi
%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
Expand Down Expand Up @@ -1048,12 +1002,8 @@ fi
%{_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
Expand Down Expand Up @@ -1118,10 +1068,8 @@ fi
%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}
Expand Down Expand Up @@ -1180,13 +1128,8 @@ fi
%{_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}
Expand Down Expand Up @@ -1244,13 +1187,9 @@ fi
%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
Expand Down Expand Up @@ -1302,18 +1241,10 @@ fi
%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
Expand Down Expand Up @@ -1544,32 +1475,20 @@ if test "$OLD_POLVER" = "$NEW_POLVER"; then
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
%relabel_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
Expand All @@ -1588,32 +1507,20 @@ if [ $1 -eq 0 ]; then
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
%relabel_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
Expand Down

0 comments on commit 1cc7605

Please sign in to comment.