File ocfs2-tools.spec of Package ocfs2-tools
%define realname ocfs2-tools
%define srcext tar.bz2
# turn off the generation of debuginfo rpm (RH9) ??
%global debug_package %{nil}
# Common info
Name: %{realname}
Version: 1.8.4
Release: 0%{?extraver:0.}1%{?rhel:.el%{rhel}}%{?fedora:.fc%{fedora}}
License: GPL-2.0
Group: System/Filesystems
URL: https://oss.oracle.com/projects/ocfs2-tools/
Summary: Tools and support files for creating and managing OCFS2 volumes
# Install-time parameters
%if 0%{?suse_version}
Requires: insserv
%else
Requires: redhat-lsb-core
%endif
# Build-time parameters
BuildRequires: autoconf automake libtool
BuildRequires: pkgconfig
BuildRequires: libaio-devel
BuildRequires: libcorosync-devel
%if 0%{?suse_version} >= 1130 || 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600 || 0%{?scientificlinux_version} >= 600
BuildRequires: pkgconfig(com_err)
%else
BuildRequires: libcom_err-devel
%endif
BuildRequires: libuuid-devel ncurses-devel readline-devel glib2-devel >= 2.2.3
%if 0%{?suse_version} && ! 0%{?sles_version}
BuildRequires: libdlm-devel
%endif
BuildRoot: %{_tmppath}/%{name}-root
Source0: %{realname}-%{version}%{?extraver}.%{srcext}
Source99: o2cb.sysconfig
%description
OCFS2 Tools is a collection of utility programs to create, manage, debug and
repair the OCFS2 filesystem. It includes utilities like mkfs.ocfs2(8),
fsck.ocfs2(8), tunefs.ocfs2(8), mount.ocfs2(8) and debugfs.ocfs2(8).
%package devel
Group: Development/Languages/C and C++
Summary: Development files for %{name}
Requires: %{name} = %{version}
Requires: libaio-devel
%description devel
Development files for %{name}
# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{version}%{?extraver}
%{__sed} -ri 's|Required-Stop:|& $null|; s|/sbin|%{_sbindir}|' vendor/common/o2cb.init.sh
%{__sed} -ri 's|Required-Stop:|& $null|; s|X-UnitedLinux-||' vendor/common/ocfs2.init
%if ! 0%{?sles_version}
%{__sed} -ri '/^NCURSES_LIBS=/ isaved_LDFLAGS="$LDFLAGS"\nLDFLAGS="-ltinfo $LDFLAGS"' configure.in
%endif
./autogen.sh
%build
%configure \
CFLAGS="%{optflags}" \
CXXFLAGS="%{optflags}" \
LDFLAGS="-Wl,--as-needed -Wl,--strip-all"
%{__make}
cd ocfs2cdsl
%{__make} ocfs2cdsl
%{__sed} 's/@VERSION@/%{version}/' ocfs2cdsl.8.in > ocfs2cdsl.8
cd ..
%install
%{__make} install DESTDIR=%{buildroot}
%{__mv} -f %{buildroot}/sbin/* %{buildroot}%{_sbindir}/
%{__install} -m755 ocfs2cdsl/ocfs2cdsl %{buildroot}/%{_sbindir}/ocfs2cdsl
%{__install} -m644 ocfs2cdsl/ocfs2cdsl.8 %{buildroot}/%{_mandir}/man8/ocfs2cdsl.8
%{__install} -d -m755 %{buildroot}%{_sysconfdir}/ocfs2/
%{__install} -D -m644 vendor/common/51-ocfs2.rules %{buildroot}%{_libexecdir}/udev/rules.d/51-ocfs2.rules
%{__install} -D -m755 vendor/common/o2cb.init %{buildroot}%{_initrddir}/o2cb
%{__install} -D -m755 vendor/common/ocfs2.init %{buildroot}%{_initrddir}/ocfs2
%if 0%{?suse_version}
%{__ln_s} -f %{_initrddir}/o2cb %{buildroot}%{_sbindir}/rco2cb
%{__ln_s} -f %{_initrddir}/ocfs2 %{buildroot}%{_sbindir}/rcocfs2
%{__install} -D -m644 %{S:99} %{buildroot}/var/adm/fillup-templates/sysconfig.o2cb
%else
%{__install} -D -m644 vendor/common/o2cb.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/o2cb
%endif
%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
%files
%defattr(-,root,root)
%doc COPYING CREDITS MAINTAINERS README README.O2CB
%doc documentation/ocfs2_faq.* documentation/users_guide.txt
%dir %{_sysconfdir}/ocfs2/
%if 0%{?suse_version}
/var/adm/fillup-templates/sysconfig.o2cb
%else
%config(noreplace) %{_sysconfdir}/sysconfig/o2cb
%endif
%{_initrddir}/o2cb
%{_initrddir}/ocfs2
%{_bindir}/o2info
%{_sbindir}/*
%dir %{_libexecdir}/udev/rules.d
%dir %{_libexecdir}/udev
%{_libexecdir}/udev/rules.d/51-ocfs2.rules
%doc %{_mandir}/man1/*
%doc %{_mandir}/man5/*
%doc %{_mandir}/man7/*
%doc %{_mandir}/man8/*
# Development stuff
%files devel
%defattr(-,root,root)
%{_libdir}/pkgconfig/*.pc
%{_includedir}/o2cb/
%{_includedir}/o2dlm/
%{_includedir}/ocfs2/
%{_includedir}/ocfs2-kernel/
%attr(0644,root,root) %{_libdir}/*.a
%if 0%{?suse_version}
%post
%{fillup_and_insserv o2cb}
%{fillup_and_insserv -f ocfs2}
%preun
%{stop_on_removal o2cb}
%{stop_on_removal ocfs2}
%postun
%{restart_on_update o2cb}
%{restart_on_update ocfs2}
%{insserv_cleanup}
%endif
%changelog