forked from jengelh/zfs
359 lines
11 KiB
RPMSpec
359 lines
11 KiB
RPMSpec
#
|
|
# spec file for package zfs
|
|
#
|
|
# Copyright (c) 2024 SUSE LLC
|
|
#
|
|
# 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/
|
|
#
|
|
# needssslcertforbuild
|
|
|
|
|
|
%global kernel_version %(rpm -q kernel-syms | sed 's/^kernel-syms-//; s/\\.[0-9]\\+\\.%_arch//;')
|
|
%global kernel_build %(rpm -q kernel-syms | sed 's/^kernel-syms-[0-9.]\\+-[0-9]\\+.//; s/.%_arch//;')
|
|
%if 0%{?suse_version} > 1600
|
|
%define kmp_longterm 1
|
|
%endif
|
|
|
|
Name: zfs
|
|
Version: 2.2.5
|
|
Release: 0
|
|
Summary: The ZFS file system and utilities
|
|
License: CDDL-1.0 AND GPL-2.0-or-later
|
|
Group: System/Filesystems
|
|
URL: https://zfsonlinux.org/
|
|
|
|
#Github-URL: https://github.com/zfsonlinux/zfs
|
|
Source: https://github.com/zfsonlinux/zfs/releases/download/%name-%version/%name-%version.tar.gz
|
|
Source1: https://github.com/zfsonlinux/zfs/releases/download/%name-%version/%name-%version.tar.gz.asc
|
|
Source2: %name.keyring
|
|
Source3: %name-preamble
|
|
Patch1: kmod.diff
|
|
BuildRequires: %kernel_module_package_buildreqs
|
|
%if 0%{?kmp_longterm}
|
|
BuildRequires: kernel-syms-longterm
|
|
%endif
|
|
BuildRequires: fdupes
|
|
BuildRequires: kernel-devel
|
|
BuildRequires: kernel-syms
|
|
BuildRequires: libattr-devel
|
|
BuildRequires: libelf-devel
|
|
BuildRequires: libtirpc-devel
|
|
BuildRequires: pesign-obs-integration
|
|
BuildRequires: pkg-config
|
|
BuildRequires: python
|
|
BuildRequires: python3-devel
|
|
BuildRequires: sudo
|
|
BuildRequires: systemd-rpm-macros
|
|
BuildRequires: pkgconfig(blkid)
|
|
BuildRequires: pkgconfig(libcrypto)
|
|
BuildRequires: pkgconfig(libselinux)
|
|
BuildRequires: pkgconfig(uuid)
|
|
BuildRequires: pkgconfig(zlib)
|
|
# Files collide, but zypper does not recognize that (bnc#673720)
|
|
Conflicts: zfs-fuse
|
|
Provides: openzfs = %version-%release
|
|
Requires: zfs-kmp = %version
|
|
|
|
%define services zfs-import-cache.service zfs-import-scan.service zfs-import.service zfs-import.target zfs-load-key.service zfs-mount.service zfs-share.service zfs-volume-wait.service zfs-volumes.target zfs-zed.service zfs.target zfs-scrub@.service
|
|
%kernel_module_package -n zfs -x xen -p %_sourcedir/%name-preamble -c %_sourcedir/_projectcert.crt
|
|
|
|
%description
|
|
ZFS is a combined file system and logical volume manager designed by
|
|
Sun Microsystems. The features of ZFS include protection against data
|
|
corruption, support for high storage capacities, integration of the
|
|
concepts of file system and volume management, snapshots and
|
|
copy-on-write clones, continuous integrity checking and automatic
|
|
repair, RAID-Z and native NFSv4 ACLs.
|
|
|
|
ZFS on Linux, which is also known as ZoL, includes fully functional
|
|
and stable SPA, DMU, ZVOL, and ZPL layers.
|
|
|
|
%package -n libnvpair3
|
|
Summary: A tools library for manipulating <name, value> pairs
|
|
License: CDDL-1.0
|
|
Group: System/Libraries
|
|
|
|
%description -n libnvpair3
|
|
ZFS is a 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 libuutil3
|
|
Summary: ZFS utility library
|
|
License: CDDL-1.0
|
|
Group: System/Libraries
|
|
|
|
%description -n libuutil3
|
|
ZFS is a 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 libzfs4
|
|
Summary: ZFS filesystem access library
|
|
License: CDDL-1.0
|
|
Group: System/Libraries
|
|
|
|
%description -n libzfs4
|
|
ZFS is a file system and volume manager which was
|
|
originally developed by Sun Microsystems.
|
|
|
|
%package -n libzfsbootenv1
|
|
Summary: ZFS boot environment library
|
|
License: CDDL-1.0
|
|
Group: System/Libraries
|
|
|
|
%description -n libzfsbootenv1
|
|
ZFS is a file system and volume manager which was
|
|
originally developed by Sun Microsystems.
|
|
|
|
%package -n libzfs_core3
|
|
Summary: ZFS filesystem access library
|
|
License: CDDL-1.0
|
|
Group: System/Libraries
|
|
|
|
%description -n libzfs_core3
|
|
libzfs_core is intended to replace libzfs, and has the following
|
|
characteristics:
|
|
Thread safety, committed interface (stable API), programmatic
|
|
error handling and clear atomicity.
|
|
|
|
%package -n libzpool5
|
|
Summary: Zpool interface
|
|
License: CDDL-1.0
|
|
Group: System/Libraries
|
|
|
|
%description -n libzpool5
|
|
ZFS is a 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 devel
|
|
Summary: Development files for the ZFS userspace utilities
|
|
License: CDDL-1.0
|
|
Group: Development/Libraries/C and C++
|
|
Requires: libnvpair3 = %version
|
|
Requires: libuutil3 = %version
|
|
Requires: libzfs4 = %version
|
|
Requires: libzfs_core3 = %version
|
|
Requires: libzfsbootenv1 = %version
|
|
Requires: libzpool5 = %version
|
|
|
|
%description devel
|
|
ZFS is a combined file system and logical volume manager designed by
|
|
Sun Microsystems. The features of ZFS include protection against data
|
|
corruption, support for high storage capacities, integration of the
|
|
concepts of filesystem and volume management, snapshots and
|
|
copy-on-write clones, continuous integrity checking and automatic
|
|
repair, RAID-Z and native NFSv4 ACLs.
|
|
|
|
This subpackage contains the development header files and libraries.
|
|
needed for compilation of third-party programs.
|
|
|
|
%package bash-completion
|
|
Summary: Bash completion for %{name}
|
|
Group: System/Shells
|
|
Supplements: (%{name} and bash-completion)
|
|
BuildArch: noarch
|
|
|
|
%description bash-completion
|
|
zfs command-line completion logic for bash.
|
|
|
|
%prep
|
|
%autosetup -p1
|
|
%if 0%{?suse_version} < 1550
|
|
%patch -P 1 -p1 -R
|
|
%endif
|
|
|
|
# fix shebangs: don't use env
|
|
sed -i 's|/usr/bin/env @PYTHON_SHEBANG@|/usr/bin/@PYTHON_SHEBANG@|' \
|
|
cmd/arcstat.in cmd/dbufstat.in tests/test-runner/bin/*.py.in
|
|
sed -i 's|/usr/bin/env bash|/bin/bash|' contrib/dracut/*/module-setup.sh.in \
|
|
scripts/zimport.sh scripts/zloop.sh
|
|
|
|
sed -i 's|/bin/sh$|/bin/bash|' cmd/zed/zed.d/all-debug.sh # this script uses bash features
|
|
sed -i 's|#!/bin/sh$||' cmd/zed/zed.d/zed-functions.sh scripts/common.sh.in # these scripts are not executed so they don't need a shebang
|
|
|
|
%build
|
|
%if 0%{?suse_version} > 1500
|
|
export CFLAGS="%optflags -I%_includedir/rpc"
|
|
sed -e "s|#include <tirpc/rpc/xdr\.h>|#include_next <rpc/xdr.h>|" \
|
|
-i lib/libspl/include/rpc/xdr.h
|
|
%endif
|
|
%if !%{defined make_build}
|
|
%define make_build make %{?_smp_mflags}
|
|
%endif
|
|
for flavor in %flavors_to_build; do
|
|
rm -Rf "../obj-$flavor"
|
|
cp -a . "../obj-$flavor"
|
|
pushd "../obj-$flavor/"
|
|
%configure --with-config=kernel --with-linux="/usr/src/linux" \
|
|
--with-linux-obj="/usr/src/linux-obj/%_target_cpu/$flavor" \
|
|
--sbindir="%_sbindir" ||
|
|
{ cat config.log; exit 1; }
|
|
%make_build
|
|
popd
|
|
done
|
|
%configure --with-config=user \
|
|
--disable-sysvinit \
|
|
--enable-systemd \
|
|
--disable-static
|
|
%make_build
|
|
|
|
%install
|
|
export BRP_PESIGN_FILES="*.ko"
|
|
b="%buildroot"
|
|
for flavor in %flavors_to_build; do
|
|
pushd "../obj-$flavor/"
|
|
%make_install
|
|
popd
|
|
done
|
|
%make_install bashcompletiondir="%_datadir/bash-completion/completions"
|
|
rm -f "$b/%_libdir"/*.la
|
|
rm -Rf "$b/usr/src"
|
|
# all dracut
|
|
rm -Rf "$b/%_datadir/initramfs-tools"
|
|
rm -Rf "$b/%_datadir/zfs/zfs-tests"
|
|
mkdir -p "$b/%_sbindir"
|
|
for s in %services; do
|
|
if echo "$s" | grep -q '@' ; then
|
|
continue
|
|
elif echo "$s" | grep -q 'target' ; then
|
|
continue
|
|
fi
|
|
ln -s service "$b/%_sbindir/rc${s%.service}"
|
|
done
|
|
# udev location different for SLES 15 and later
|
|
if [ -d "$b/lib/udev" ]; then
|
|
mv "$b/lib/udev" "$b/usr/lib/udev/"
|
|
fi
|
|
|
|
cat "$b/%_sysconfdir/sudoers.d/zfs" > zfs-smartctl-sudo.txt
|
|
cat <<EOF >> zfs-smartctl-sudo.txt
|
|
|
|
## Security notice
|
|
## ---------------
|
|
##
|
|
## Beware that the rule above, if enabled, is actually problematic. The wildcard
|
|
## mechanism in sudo is too lax and cannot be tightened well using sudoers
|
|
## syntax. The rule at hand allows any user to run arbitrary
|
|
## "smartctl -a /dev/hda[...]" command lines as root like
|
|
##
|
|
## sudo /usr/sbin/smartctl -a /dev/hda1/../../tmp/some_symlink --extra-switch
|
|
##
|
|
## So contrary to what the line looks like this allows any user to:
|
|
##
|
|
## - get smart information for any device (or even pointing it to regular files
|
|
## etc), by adding "../../" path components.
|
|
## - pass additional arguments to smartctl beyond the "-a" switch for obtaining
|
|
## information.
|
|
EOF
|
|
rm -v "$b/%_sysconfdir/sudoers.d/zfs"
|
|
|
|
%fdupes %buildroot/%_prefix
|
|
|
|
%pre
|
|
%service_add_pre %services
|
|
|
|
%post
|
|
%service_add_post %services
|
|
|
|
%preun
|
|
%service_del_preun %services
|
|
|
|
%postun
|
|
%service_del_postun %services
|
|
|
|
%post -n libnvpair3 -p /sbin/ldconfig
|
|
%postun -n libnvpair3 -p /sbin/ldconfig
|
|
%post -n libuutil3 -p /sbin/ldconfig
|
|
%postun -n libuutil3 -p /sbin/ldconfig
|
|
%post -n libzfs4 -p /sbin/ldconfig
|
|
%postun -n libzfs4 -p /sbin/ldconfig
|
|
%post -n libzfsbootenv1 -p /sbin/ldconfig
|
|
%postun -n libzfsbootenv1 -p /sbin/ldconfig
|
|
%post -n libzfs_core3 -p /sbin/ldconfig
|
|
%postun -n libzfs_core3 -p /sbin/ldconfig
|
|
%post -n libzpool5 -p /sbin/ldconfig
|
|
%postun -n libzpool5 -p /sbin/ldconfig
|
|
|
|
%files
|
|
%doc zfs-smartctl-sudo.txt
|
|
%config %_sysconfdir/default/zfs
|
|
%dir %_sysconfdir/zfs
|
|
%config %_sysconfdir/zfs/vdev*
|
|
%config %_sysconfdir/zfs/zfs-functions
|
|
%dir %_sysconfdir/zfs/zed.d
|
|
%config %_sysconfdir/zfs/zed.d/*.sh
|
|
%config(noreplace) %_sysconfdir/zfs/zed.d/zed.rc
|
|
%dir %_sysconfdir/zfs/zpool.d
|
|
%config %_sysconfdir/zfs/zpool.d/*
|
|
%_bindir/arcstat
|
|
%_bindir/arc_summary
|
|
%_bindir/dbufstat
|
|
%_bindir/raidz_test
|
|
%_bindir/z*
|
|
%_sbindir/fsck.zfs
|
|
%_sbindir/rc*
|
|
%_sbindir/z*
|
|
%_mandir/man?/*.*
|
|
%_datadir/zfs/
|
|
/sbin/mount.zfs
|
|
%_prefix/lib/dracut/
|
|
%_prefix/lib/udev/
|
|
%_libexecdir/zfs/
|
|
%_unitdir/zfs*
|
|
%_presetdir/50-zfs.preset
|
|
/usr/lib/systemd/system-generators/
|
|
/usr/lib/modules-load.d/
|
|
|
|
%files -n libnvpair3
|
|
%_libdir/libnvpair.so.3*
|
|
|
|
%files -n libuutil3
|
|
%_libdir/libuutil.so.3*
|
|
|
|
%files -n libzfs4
|
|
%_libdir/libzfs.so.4*
|
|
|
|
%files -n libzfsbootenv1
|
|
%_libdir/libzfsbootenv.so.1*
|
|
|
|
%files -n libzfs_core3
|
|
%_libdir/libzfs_core.so.3*
|
|
|
|
%files -n libzpool5
|
|
%_libdir/libzpool.so.5*
|
|
|
|
%files devel
|
|
%_includedir/libspl/
|
|
%_includedir/libzfs/
|
|
%_libdir/libnvpair.so
|
|
%_libdir/libuutil.so
|
|
%_libdir/libzfs.so
|
|
%_libdir/libzfsbootenv.so
|
|
%_libdir/libzfs_core.so
|
|
%_libdir/libzpool.so
|
|
%_libdir/pkgconfig/*.pc
|
|
|
|
%files bash-completion
|
|
%_datadir/bash-completion/completions/
|
|
|
|
%changelog
|