A new user interface for you! Read more...

File zfs.spec of Package zfs

#
# spec file for package zfs
#
# Copyright (c) 2019 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 https://bugs.opensuse.org/
#


%global _sbindir /sbin

%define _dracutdir %{_libexecdir}/dracut
%define _udevdir   %{_libexecdir}/udev

%bcond_with     debug

Name:           zfs
Version:        0.7.12
Release:        0
Summary:        Commands to control the kernel modules
License:        CDDL-1.0
Group:          System/Filesystems
URL:            http://zfsonlinux.org/
Source0:        https://github.com/zfsonlinux/zfs/releases/download/%{name}-%{version}/%{name}-%{version}.tar.gz
Source1:        %{name}-rpmlintrc
# EDV-Lotse     Begin
Source11:       70-zfs-grub-fix.rules
Patch11:        zfs-import-scan.patch             
# EDV-Lotse     End
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  dracut
BuildRequires:  libattr-devel
BuildRequires:  libblkid-devel
BuildRequires:  libtirpc-devel
BuildRequires:  libtool
BuildRequires:  libuuid-devel
BuildRequires:  pkgconfig
BuildRequires:  sudo
BuildRequires:  systemd
BuildRequires:  zlib-devel
Requires:       spl = %{version}
Requires:       sudo
Recommends:     %{name}-kmp = %{version}
Conflicts:      zfs-fuse
%{?systemd_requires}

%description
This package contains support utilities for the zfs file system.

%package -n libnvpair1
Summary:        A tools library for manipulating <name, value> pairs
Group:          System/Libraries

%description -n libnvpair1
ZFS is an advanced file system and volume manager which was
originally developed by Sun Microsystems.

The nvpair library provides routines packing an unpacking nv pairs
for transporting data across process boundaries, transporting between
kernel and userland, and possibly saving onto disk files.

%package -n libuutil1
Summary:        ZFS utility library
Group:          System/Libraries

%description -n libuutil1
ZFS is an advanced file system and volume manager which was
originally developed by Sun Microsystems.

The uutil library contains various utility and wrapper functions used
by the ZFS userland.

%package -n libzfs2
Summary:        ZFS filesystem access library
Group:          System/Libraries

%description -n libzfs2
ZFS is an advanced file system and volume manager which was
originally developed by Sun Microsystems.

%package -n libzfs2-devel
Summary:        Development headers
Group:          Development/Libraries/C and C++
Requires:       libnvpair1 = %{version}
Requires:       libuutil1 = %{version}
Requires:       libzfs2 = %{version}
Requires:       libzpool2 = %{version}
Provides:       libnvpair1-devel
Provides:       libuutil1-devel
Provides:       libzpool2-devel
Obsoletes:      %{name}-devel

%description -n libzfs2-devel
This package contains the header files needed for building additional
applications against the ZFS libraries.

%package -n libzpool2
Summary:        Zpool interface
Group:          System/Libraries

%description -n libzpool2
ZFS is an advanced file system and volume manager which was
originally developed by Sun Microsystems.

The zpool library contains
- Emulation of kernel services in userland
- Routines needed by more than one client of libzpool

%package test
Summary:        Test infrastructure
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}
Requires:       acl
Requires:       bc
Requires:       fio
Requires:       ksh
Requires:       lsscsi
Requires:       mdadm
Requires:       parted
Requires:       sysstat

%description test
This package contains test infrastructure and support scripts for
validating the file system.

%package dracut
Summary:        Dracut module
Group:          System/Base
Requires:       %{name} = %{version}
Requires:       dracut

%description dracut
This package contains a dracut module used to construct an initramfs
image which is ZFS aware.

%prep
%setup -q
%if 0%{?sle_version} >= 120300 && 0%{?is_opensuse}
%patch11 -p0
%endif

%build
%if 0%{?suse_version} > 1500
export CFLAGS="%{optflags} -I/usr/include/rpc"
sed -e "s|#include <tirpc/rpc/xdr\.h>|#include_next <rpc/xdr.h>|" \
    -i lib/libspl/include/rpc/xdr.h
%endif
./autogen.sh
%configure \
	--with-config=user \
	--with-udevdir=%{_udevdir} \
	--with-udevruledir=%{_udevdir}/rules.d \
	--with-dracutdir=%{_dracutdir} \
	--disable-static \
%if %{with debug}
	--enable-debug \
%else
	--disable-debug \
%endif
	--enable-systemd \
	--with-systemdunitdir=%{_unitdir} \
	--with-systemdpresetdir=%{_presetdir} \
	--disable-sysvinit

make %{?_smp_mflags} V=1

%install
%make_install

find %{buildroot} -type f -name "*.la" -delete -print

ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-import-cache
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-import-scan
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-mount
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-share
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-zed

install -D -m 0644 contrib/bash_completion.d/%{name} %{buildroot}%{_sysconfdir}/bash_completion.d/%{name}
sed -e "s|PARTED:-/sbin/parted|PARTED:-%{_prefix}%{_sbindir}/parted|" -i %{buildroot}%{_datadir}/zfs/common.sh

install -D -m 0644 %{SOURCE11} %{buildroot}%{_sysconfdir}/udev/rules.d/70-zfs-grub-fix.rules

%pre
%service_add_pre %{name}.target
%service_add_pre %{name}-import-cache.service %{name}-import-scan.service
%service_add_pre %{name}-mount.service %{name}-share.service %{name}-zed.service

%post
%service_add_post %{name}.target
%service_add_post %{name}-import-cache.service %{name}-import-scan.service
%service_add_post %{name}-mount.service %{name}-share.service %{name}-zed.service

%preun
%service_del_preun %{name}.target
%service_del_preun %{name}-import-cache.service %{name}-import-scan.service
%service_del_preun %{name}-mount.service %{name}-share.service %{name}-zed.service

%postun
%service_del_postun %{name}.target
%service_del_postun %{name}-import-cache.service %{name}-import-scan.service
%service_del_postun %{name}-mount.service %{name}-share.service %{name}-zed.service

%post -n libnvpair1 -p /sbin/ldconfig

%postun -n libnvpair1 -p /sbin/ldconfig

%post -n libuutil1 -p /sbin/ldconfig

%postun -n libuutil1 -p /sbin/ldconfig

%post -n libzfs2 -p /sbin/ldconfig

%postun -n libzfs2 -p /sbin/ldconfig

%post -n libzpool2 -p /sbin/ldconfig

%postun -n libzpool2 -p /sbin/ldconfig

%files
%config %{_sysconfdir}/udev/rules.d/*
%{_bindir}/*
%{_sbindir}/*
%{_mandir}/man?/*
%{_libexecdir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}
%config %{_sysconfdir}/bash_completion.d/*
%{_udevdir}
%{_libexecdir}/modules-load.d/*
%{_unitdir}/*
%{_presetdir}/*
%attr(440, root, root) %config(noreplace) %{_sysconfdir}/sudoers.d/*

%files -n libnvpair1
%{_libdir}/libnvpair.so.1*

%files -n libuutil1
%{_libdir}/libuutil.so.1*

%files -n libzfs2
%{_libdir}/libzfs.so.2*
%{_libdir}/libzfs_core.so.1*

%files -n libzfs2-devel
%license COPYRIGHT OPENSOLARIS.LICENSE
%doc AUTHORS DISCLAIMER README.markdown
%{_datadir}/pkgconfig/libzfs*
%{_libdir}/*.so
%{_includedir}/*

%files -n libzpool2
%{_libdir}/libzpool.so.2*

%files test
%{_datadir}/%{name}

%files dracut
%doc contrib/dracut/README.dracut.markdown
%{_dracutdir}/modules.d/*
%exclude %{_datadir}/initramfs-tools

%changelog