File drbd.spec of Package drbd.7555
#
# spec file for package drbd
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# needssslcertforbuild
%ifnarch %ix86 s390
%define with_km 1
%endif
%ifarch x86_64
%define buildrt 0
%endif
Name: drbd
Version: 8.4.4.7
Release: 0
Summary: Distributed Replicated Block Device
License: GPL-2.0+
Group: Productivity/Clustering/HA
Url: http://www.drbd.org/
Source: %{name}-%{version}.tar.bz2
Source1: preamble
Source2: Module.supported
# PATCH-MISSING-TAG -- See http://wiki.opensuse.org/openSUSE:Packaging_Patches_guidelines
Patch1: init-script-fixes.diff
Patch2: add_phy_to_block-drbd.diff
#bnc#878119-drbd with pacemaker fails to start
Patch3: fix-udev-for-drbd-fails-to-start.patch
Patch4: fence-after-pacemaker-down.patch
Provides: drbd-bash-completion = %{version}
Provides: drbd-pacemaker = %{version}
Provides: drbd-udev = %{version}
Provides: drbd-utils = %{version}
Obsoletes: drbd-bash-completion < %{version}
Obsoletes: drbd-pacemaker < %{version}
Obsoletes: drbd-udev < %{version}
Obsoletes: drbd-utils < %{version}
%ifarch %ix86 x86_64
Provides: drbd-xen = %{version}
Obsoletes: drbd-xen < %{version}
%endif
BuildRequires: bison
BuildRequires: flex
BuildRequires: udev
%if %{with km}
BuildRequires: kernel-source
BuildRequires: kernel-syms
BuildRequires: module-init-tools
%if 0%{?buildrt} == 1
BuildRequires: kernel-syms-rt
%endif
%endif
Provides: drbd-control
Provides: drbdsetup
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Requires(post): %insserv_prereq %fillup_prereq
Requires(preun): %insserv_prereq %fillup_prereq
Requires(postun): %insserv_prereq fileutils
%if %{with km}
%kernel_module_package -n drbd -p %_sourcedir/preamble
%endif
%description
Drbd is a distributed replicated block device. It mirrors a block
device over the network to another machine. Think of it as networked
raid 1. It is a building block for setting up clusters.
%package KMP
Summary: Distributed Replicated Block Device
Group: Productivity/Clustering/HA
%description KMP
Drbd is a distributed replicated block device. It mirrors a block
device over the network to another machine. Think of it as networked
raid 1. It is a building block for setting up clusters.
%prep
%setup -q
%patch1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%if %{with km}
mkdir source
cp -a drbd/. source/. || :
# cp source/Makefile-2.6 source/Makefile
# WIP cp -a %_sourcedir/Module.supported source/
mkdir obj
%endif
%build
PATH=/sbin:$PATH %configure \
--without-km \
--with-utils \
--with-udev \
--with-distro=suse \
--without-heartbeat \
--without-legacy_utils \
--with-pacemaker \
--with-xen \
--with-bashcompletion
make OPTFLAGS="%{optflags}" %{?_smp_mflags}
%if %{with km}
export CONFIG_BLK_DEV_DRBD=m
export EXTRA_CFLAGS='-DVERSION=\"%version\"'
for flavor in %flavors_to_build; do
rm -rf obj/$flavor
export KDIR="/usr/src/linux-obj/%_target_cpu/$flavor"
# (cd source ; bash ../scripts/adjust_drbd_config_h.sh)
cp -r source obj/$flavor
cp $RPM_SOURCE_DIR/Module.supported obj/$flavor
export DRBDSRC="$PWD/obj/$flavor"
make -C $KDIR modules \
M=$PWD/obj/$flavor
done
%endif
%install
%make_install
%if %{with km}
export CONFIG_BLK_DEV_DRBD=m
#
# Install kernel modules:
export INSTALL_MOD_PATH=$RPM_BUILD_ROOT
export INSTALL_MOD_DIR=updates
export BRP_PESIGN_FILES="*.ko /lib/firmware"
for flavor in %flavors_to_build; do
make -C /usr/src/linux-obj/%_target_cpu/$flavor modules_install \
M=$PWD/obj/$flavor
done
%endif
mkdir -p %{buildroot}%{_localstatedir}/lib/drbd
#
# and I only want to install a hint to the example conf
#
cat <<___ > %{buildroot}%{_sysconfdir}/drbd.conf
#
# please have a a look at the example configuration file in
# %{_docdir}/drbd/drbd.conf
#
___
#
%ifnarch %ix86 x86_64
rm -rf %{buildroot}%{_sysconfdir}/xen
%endif
mkdir -p %{buildroot}/usr/lib/udev/rules.d
mv %{buildroot}/etc/udev/rules.d/65-drbd.rules %{buildroot}/usr/lib/udev/rules.d
mkdir -p %{buildroot}/sbin
for F in drbdsetup drbdadm drbdmeta drbd-overview ; do
ln -s ../%{_sbindir}/$F %{buildroot}/sbin
done
ln -sf ../../%{_sysconfdir}/init.d/drbd %{buildroot}/%{_sbindir}/rcdrbd
%post
%{fillup_and_insserv}
%preun
%{stop_on_removal}
%postun
%{insserv_cleanup}
%files -n drbd
%defattr(-, root, root)
%config(noreplace) %{_sysconfdir}/drbd.conf
%config %{_sysconfdir}/bash_completion.d/drbdadm.sh
%config(noreplace) %{_sysconfdir}/drbd.d/global_common.conf
%doc %{_mandir}/man5/drbd.conf.5*
%doc %{_mandir}/man8/drbd.8*
%doc %{_mandir}/man8/drbdsetup.8*
%doc %{_mandir}/man8/drbdadm.8*
%doc %{_mandir}/man8/drbdmeta.8*
%doc COPYING
%doc README
%doc ChangeLog
%doc scripts/drbd.conf
%dir %{_sysconfdir}/drbd.d
%{_sbindir}/drbdadm
%{_sbindir}/drbdsetup
%{_sbindir}/drbdmeta
%{_sbindir}/drbd-overview
%{_sbindir}/rcdrbd
/sbin/drbdadm
/sbin/drbdsetup
/sbin/drbdmeta
/sbin/drbd-overview
%ifarch %ix86 x86_64
%dir %attr(700,root,root) %{_sysconfdir}/xen
%dir %{_sysconfdir}/xen/scripts
%{_sysconfdir}/xen/scripts/block-drbd
%endif
%{_prefix}/lib/ocf/resource.d/linbit/drbd
%dir /usr/lib/udev
%dir /usr/lib/udev/rules.d
/usr/lib/udev/rules.d/65-drbd.rules
%config %{_sysconfdir}/init.d/drbd
%defattr(-, root, root)
%{_localstatedir}/lib/drbd
%{_prefix}/lib/drbd
%dir %{_prefix}/lib/ocf
%dir %{_prefix}/lib/ocf/resource.d
%dir %{_prefix}/lib/ocf/resource.d/linbit
%changelog