drbd/drbd.spec

169 lines
4.5 KiB
RPMSpec

#
# spec file for package drbd (Version 8.3.2)
#
# Copyright (c) 2009 SUSE LINUX Products 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/
#
Name: drbd
BuildRequires: bison flex glib-devel kernel-source kernel-syms module-init-tools
Summary: Distributed Replicated Block Device
Version: 8.3.2
Release: 2
Source: %{name}-%{version}.tar.bz2
License: GPL v2 or later
Group: Productivity/Clustering/HA
Provides: drbdsetup drbd-control
Url: http://www.drbd.org/
BuildRoot: %{_tmppath}/%{name}-%{version}-build
PreReq: %insserv_prereq %fillup_prereq fileutils
%suse_kernel_module_package kdump um
%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.
Authors:
--------
Philipp Reisner <philipp.reisner@linbit.com>
Lars Ellenberg <lars.ellenberg@linbit.com>
%package KMP
License: GPL v2 or later
Summary: Distributed Replicated Block Device
Group: System/Kernel
%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.
Authors:
--------
Philipp Reisner <philipp.reisner@linbit.com>
Lars Ellenberg <lars.ellenberg@linbit.com>
%prep
%setup -n %{name}-%{version}
mkdir source
cp -a drbd/. source/. || :
cp source/Makefile-2.6 source/Makefile
mkdir obj
%build
export RPM_BUILD_ROOT
export CONFIG_BLK_DEV_DRBD=m
export DIST=suselike
mkdir -p %{buildroot}
make clean
make PREFIX=%{buildroot}/ OPTFLAGS="$RPM_OPT_FLAGS" tools
export EXTRA_CFLAGS='-DVERSION=\"%version\"'
for flavor in %flavors_to_build; do
rm -rf obj/$flavor
cp -r source obj/$flavor
make -C /usr/src/linux-obj/%_target_cpu/$flavor modules \
M=$PWD/obj/$flavor
done
%install
export RPM_BUILD_ROOT
export CONFIG_BLK_DEV_DRBD=m
export DIST=suselike
make PREFIX=%{buildroot}/ install-tools
mkdir $RPM_BUILD_ROOT/etc/bash_completion.d
cp scripts/drbdadm.bash_completion $RPM_BUILD_ROOT/etc/bash_completion.d/drbdadm.sh
cp scripts/drbd.rules $RPM_BUILD_ROOT/etc/udev/rules.d/65-drbd.rules
# these files look like wrong installed documentation
rm $RPM_BUILD_ROOT/etc/udev/rules.d/65-drbd.rules.disabled
rm $RPM_BUILD_ROOT/usr/lib/ocf/resource.d/linbit/drbd
ln -sf ../etc/init.d/drbd $RPM_BUILD_ROOT/sbin/rcdrbd
mkdir -p $RPM_BUILD_ROOT/var/lib/drbd
#
# and I only want to install a hint to the example conf
#
cat <<___ > $RPM_BUILD_ROOT/etc/drbd.conf
#
# please have a a look at the example configuration file in
# %{_docdir}/drbd/drbd.conf
#
___
#
%ifnarch %ix86 x86_64
rm -rf $RPM_BUILD_ROOT/etc/xen
%endif
# Install kernel modules:
export INSTALL_MOD_PATH=$RPM_BUILD_ROOT
export INSTALL_MOD_DIR=updates
for flavor in %flavors_to_build; do
make -C /usr/src/linux-obj/%_target_cpu/$flavor modules_install \
M=$PWD/obj/$flavor
done
%clean
rm -rf "$RPM_BUILD_ROOT"
%post
%{fillup_and_insserv}
%preun
%{stop_on_removal}
%postun
%{insserv_cleanup}
%files -n drbd
%defattr(644, root, root)
%config(noreplace) /etc/drbd.conf
/etc/bash_completion.d/drbdadm.sh
%defattr(755, root, root)
/sbin/drbdadm
/sbin/drbdsetup
/sbin/rcdrbd
/sbin/drbdmeta
/usr/sbin/drbd-overview
%ifarch %ix86 x86_64
%dir /etc/xen
%dir /etc/xen/scripts
/etc/xen/scripts/block-drbd
%endif
/etc/ha.d/resource.d/drbddisk
/etc/ha.d/resource.d/drbdupper
%dir /etc/udev
%dir /etc/udev/rules.d
/etc/udev/rules.d/65-drbd.rules
%config /etc/init.d/drbd
%defattr(-, root, root)
/var/lib/drbd
/usr/lib/drbd
%dir /etc/ha.d
%dir /etc/ha.d/resource.d
%doc %{_mandir}/man5/drbd.conf.5*
%doc %{_mandir}/man8/drbd.8*
%doc %{_mandir}/man8/drbdsetup.8*
%doc %{_mandir}/man8/drbdadm.8*
%doc %{_mandir}/man8/drbddisk.8*
%doc %{_mandir}/man8/drbdmeta.8*
%doc COPYING
%doc README
%doc ChangeLog
%doc scripts/drbd.conf
%changelog