diff --git a/contrib/debian/changelog b/contrib/debian/changelog new file mode 100644 index 000000000..6273d6038 --- /dev/null +++ b/contrib/debian/changelog @@ -0,0 +1,7 @@ +openzfs-linux (2.1.99-1) unstable; urgency=low + + * Integrate minimally modified Debian packaging from ZFS on Linux + (source: https://salsa.debian.org/zfsonlinux-team/zfs) + * This packaging is a fork of Debian zfs-linux 2.1.6-2 release. + + -- Umer Saleem Fri, 11 Oct 2022 15:00:00 -0400 diff --git a/contrib/debian/clean b/contrib/debian/clean new file mode 100644 index 000000000..3100d693a --- /dev/null +++ b/contrib/debian/clean @@ -0,0 +1,11 @@ +bin/ +cmd/zed/zed.d/history_event-zfs-list-cacher.sh +contrib/pyzfs/build/ +contrib/pyzfs/libzfs_core/__pycache__/ +contrib/pyzfs/libzfs_core/bindings/__pycache__/ +contrib/pyzfs/pyzfs.egg-info/ +debian/openzfs-libnvpair3.install +debian/openzfs-libuutil3.install +debian/openzfs-libzfs4.install +debian/openzfs-libzfs-dev.install +debian/openzfs-libzpool5.install diff --git a/contrib/debian/control b/contrib/debian/control new file mode 100644 index 000000000..a0db4985e --- /dev/null +++ b/contrib/debian/control @@ -0,0 +1,328 @@ +Source: openzfs-linux +Section: contrib/kernel +Priority: optional +Maintainer: ZFS on Linux specific mailing list +Build-Depends: abigail-tools, + debhelper-compat (= 12), + dh-python, + dkms (>> 2.1.1.2-5), + libaio-dev, + libblkid-dev, + libcurl4-openssl-dev, + libelf-dev, + libpam0g-dev, + libssl-dev | libssl1.0-dev, + libtool, + libudev-dev, + lsb-release, + po-debconf, + python3-all-dev, + python3-cffi, + python3-setuptools, + python3-sphinx, + uuid-dev, + zlib1g-dev +Standards-Version: 4.5.1 +Homepage: https://openzfs.org/ +Vcs-Git: https://github.com/openzfs/zfs.git +Vcs-Browser: https://github.com/openzfs/zfs +Rules-Requires-Root: no +XS-Autobuild: yes + +Package: openzfs-libnvpair3 +Section: contrib/libs +Architecture: linux-any +Depends: ${misc:Depends}, ${shlibs:Depends} +Breaks: libnvpair1, libnvpair3 +Replaces: libnvpair1, libnvpair3, libnvpair3linux +Conflicts: libnvpair3linux +Description: Solaris name-value library for Linux + This library provides routines for packing and unpacking nv pairs for + transporting data across process boundaries, transporting between + kernel and userland, and possibly saving onto disk files. + +Package: openzfs-libpam-zfs +Section: contrib/admin +Architecture: linux-any +Depends: libpam-runtime, ${misc:Depends}, ${shlibs:Depends} +Replaces: libpam-zfs +Conflicts: libpam-zfs +Description: PAM module for managing encryption keys for ZFS + OpenZFS is a storage platform that encompasses the functionality of + traditional filesystems and volume managers. It supports data checksums, + compression, encryption, snapshots, and more. + . + This provides a Pluggable Authentication Module (PAM) that automatically + unlocks encrypted ZFS datasets upon login. + +Package: openzfs-libuutil3 +Section: contrib/libs +Architecture: linux-any +Depends: ${misc:Depends}, ${shlibs:Depends} +Breaks: libuutil1, libuutil3 +Replaces: libuutil1, libuutil3, libuutil3linux +Conflicts: libuutil3linux +Description: Solaris userland utility library for Linux + This library provides a variety of glue functions for ZFS on Linux: + * libspl: The Solaris Porting Layer userland library, which provides APIs + that make it possible to run Solaris user code in a Linux environment + with relatively minimal modification. + * libavl: The Adelson-Velskii Landis balanced binary tree manipulation + library. + * libefi: The Extensible Firmware Interface library for GUID disk + partitioning. + * libshare: NFS, SMB, and iSCSI service integration for ZFS. + +Package: openzfs-libzfs-dev +Section: contrib/libdevel +Architecture: linux-any +Depends: libssl-dev | libssl1.0-dev, + openzfs-libnvpair3 (= ${binary:Version}), + openzfs-libuutil3 (= ${binary:Version}), + openzfs-libzfs4 (= ${binary:Version}), + openzfs-libzfsbootenv1 (= ${binary:Version}), + openzfs-libzpool5 (= ${binary:Version}), + ${misc:Depends} +Replaces: libzfslinux-dev +Conflicts: libzfslinux-dev +Provides: libnvpair-dev, libuutil-dev +Description: OpenZFS filesystem development files for Linux + Header files and static libraries for compiling software against + libraries of OpenZFS filesystem. + . + This package includes the development files of libnvpair3, libuutil3, + libzpool5 and libzfs4. + +Package: openzfs-libzfs4 +Section: contrib/libs +Architecture: linux-any +Depends: ${misc:Depends}, ${shlibs:Depends} +# The libcurl4 is loaded through dlopen("libcurl.so.4"). +# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=988521 +Recommends: libcurl4 +Breaks: libzfs2, libzfs4 +Replaces: libzfs2, libzfs4, libzfs4linux +Conflicts: libzfs4linux +Description: OpenZFS filesystem library for Linux - general support + OpenZFS is a storage platform that encompasses the functionality of + traditional filesystems and volume managers. It supports data checksums, + compression, encryption, snapshots, and more. + . + The OpenZFS library provides support for managing OpenZFS filesystems. + +Package: openzfs-libzfsbootenv1 +Section: contrib/libs +Architecture: linux-any +Depends: ${misc:Depends}, ${shlibs:Depends} +Breaks: libzfs2, libzfs4 +Replaces: libzfs2, libzfs4, libzfsbootenv1linux +Conflicts: libzfsbootenv1linux +Description: OpenZFS filesystem library for Linux - label info support + OpenZFS is a storage platform that encompasses the functionality of + traditional filesystems and volume managers. It supports data checksums, + compression, encryption, snapshots, and more. + . + The zfsbootenv library provides support for modifying ZFS label information. + +Package: openzfs-libzpool5 +Section: contrib/libs +Architecture: linux-any +Depends: ${misc:Depends}, ${shlibs:Depends} +Breaks: libzpool2, libzpool5 +Replaces: libzpool2, libzpool5, libzpool5linux +Conflicts: libzpool5linux +Description: OpenZFS pool library for Linux + OpenZFS is a storage platform that encompasses the functionality of + traditional filesystems and volume managers. It supports data checksums, + compression, encryption, snapshots, and more. + . + This zpool library provides support for managing zpools. + +Package: openzfs-python3-pyzfs +Section: contrib/python +Architecture: linux-any +Depends: python3-cffi, + openzfs-zfsutils (= ${binary:Version}), + ${misc:Depends}, + ${python3:Depends} +Replaces: python3-pyzfs +Conflicts: python3-pyzfs +Description: wrapper for libzfs_core C library + libzfs_core is intended to be a stable interface for programmatic + administration of ZFS. This wrapper provides one-to-one wrappers for + libzfs_core API functions, but the signatures and types are more natural to + Python. + . + nvlists are wrapped as dictionaries or lists depending on their usage. + Some parameters have default values depending on typical use for + increased convenience. Enumerations and bit flags become strings and lists + of strings in Python. Errors are reported as exceptions rather than integer + errno-style error codes. The wrapper takes care to provide one-to-many + mapping of the error codes to the exceptions by interpreting a context + in which the error code is produced. + +Package: openzfs-pyzfs-doc +Section: contrib/doc +Architecture: all +Depends: ${misc:Depends}, ${sphinxdoc:Depends} +Recommends: openzfs-python3-pyzfs +Replaces: pyzfs-doc +Conflicts: pyzfs-doc +Description: wrapper for libzfs_core C library (documentation) + libzfs_core is intended to be a stable interface for programmatic + administration of ZFS. This wrapper provides one-to-one wrappers for + libzfs_core API functions, but the signatures and types are more natural to + Python. + . + nvlists are wrapped as dictionaries or lists depending on their usage. + Some parameters have default values depending on typical use for + increased convenience. Enumerations and bit flags become strings and lists + of strings in Python. Errors are reported as exceptions rather than integer + errno-style error codes. The wrapper takes care to provide one-to-many + mapping of the error codes to the exceptions by interpreting a context + in which the error code is produced. + . + This package contains the documentation. + +Package: openzfs-zfs-dkms +Architecture: all +Depends: dkms (>> 2.1.1.2-5), + file, + libc6-dev | libc-dev, + lsb-release, + python3-distutils | libpython3-stdlib (<< 3.6.4), + ${misc:Depends}, + ${perl:Depends} +Recommends: openzfs-zfs-zed, openzfs-zfsutils (>= ${source:Version}), ${linux:Recommends} +# suggests debhelper because e.g. `dkms mkdeb -m zfs -v 0.8.2` needs dh_testdir (#909183) +Suggests: debhelper +Breaks: spl-dkms (<< 0.8.0~rc1) +Replaces: spl-dkms, zfs-dkms +Conflicts: zfs-dkms +Provides: openzfs-zfs-modules +Description: OpenZFS filesystem kernel modules for Linux + OpenZFS is a storage platform that encompasses the functionality of + traditional filesystems and volume managers. It supports data checksums, + compression, encryption, snapshots, and more. + . + This DKMS package includes the SPA, DMU, ZVOL, and ZPL components of + OpenZFS. + +Package: openzfs-zfs-initramfs +Architecture: all +Depends: busybox-initramfs | busybox-static | busybox, + initramfs-tools, + openzfs-zfs-modules | openzfs-zfs-dkms, + openzfs-zfsutils (>= ${source:Version}), + ${misc:Depends} +Breaks: zfsutils-linux (<= 0.7.11-2) +Replaces: zfsutils-linux (<= 0.7.11-2), zfs-initramfs +Conflicts: zfs-initramfs +Description: OpenZFS root filesystem capabilities for Linux - initramfs + OpenZFS is a storage platform that encompasses the functionality of + traditional filesystems and volume managers. It supports data checksums, + compression, encryption, snapshots, and more. + . + This package adds OpenZFS to the system initramfs with a hook + for the initramfs-tools infrastructure. + +Package: openzfs-zfs-dracut +Architecture: all +Depends: dracut, + openzfs-zfs-modules | openzfs-zfs-dkms, + openzfs-zfsutils (>= ${source:Version}), + ${misc:Depends} +Conflicts: zfs-dracut +Replaces: zfs-dracut +Description: OpenZFS root filesystem capabilities for Linux - dracut + OpenZFS is a storage platform that encompasses the functionality of + traditional filesystems and volume managers. It supports data checksums, + compression, encryption, snapshots, and more. + . + This package adds OpenZFS to the system initramfs with a hook + for the dracut infrastructure. + +Package: openzfs-zfsutils +Section: contrib/admin +Architecture: linux-any +Pre-Depends: ${misc:Pre-Depends} +Depends: openzfs-libnvpair3 (= ${binary:Version}), + openzfs-libuutil3 (= ${binary:Version}), + openzfs-libzfs4 (= ${binary:Version}), + openzfs-libzpool5 (= ${binary:Version}), + python3, + ${misc:Depends}, + ${shlibs:Depends} +Recommends: lsb-base, openzfs-zfs-modules | openzfs-zfs-dkms, openzfs-zfs-zed +Breaks: openrc, + spl (<< 0.7.9-2), + spl-dkms (<< 0.8.0~rc1), + openzfs-zfs-dkms (<< ${source:Version}), + openzfs-zfs-dkms (>> ${source:Version}...) +Replaces: spl (<< 0.7.9-2), spl-dkms, zfsutils-linux +Conflicts: zfs, zfs-fuse, zfsutils-linux +Suggests: nfs-kernel-server, + samba-common-bin (>= 3.0.23), + openzfs-zfs-initramfs | openzfs-zfs-dracut +Provides: openzfsutils +Description: command-line tools to manage OpenZFS filesystems + OpenZFS is a storage platform that encompasses the functionality of + traditional filesystems and volume managers. It supports data checksums, + compression, encryption, snapshots, and more. + . + This package provides the zfs and zpool commands to create and administer + OpenZFS filesystems. + +Package: openzfs-zfs-zed +Section: contrib/admin +Architecture: linux-any +Pre-Depends: ${misc:Pre-Depends} +Depends: openzfs-zfs-modules | openzfs-zfs-dkms, + openzfs-zfsutils (>= ${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends} +Conflicts: zfs, zfs-zed +Replaces: zfs-zed +Description: OpenZFS Event Daemon + OpenZFS is a storage platform that encompasses the functionality of + traditional filesystems and volume managers. It supports data checksums, + compression, encryption, snapshots, and more. + . + ZED (ZFS Event Daemon) monitors events generated by the ZFS kernel + module. When a zevent (ZFS Event) is posted, ZED will run any ZEDLETs + (ZFS Event Daemon Linkage for Executable Tasks) that have been enabled + for the corresponding zevent class. + . + This package provides the OpenZFS Event Daemon (zed). + +Package: openzfs-zfs-test +Section: contrib/admin +Architecture: linux-any +Depends: acl, + attr, + bc, + fio, + ksh, + lsscsi, + mdadm, + parted, + python3, + openzfs-python3-pyzfs, + sudo, + sysstat, + openzfs-zfs-modules | openzfs-zfs-dkms, + openzfs-zfsutils (>=${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends} +Recommends: nfs-kernel-server +Breaks: zfsutils-linux (<= 0.7.9-2) +Replaces: zfsutils-linux (<= 0.7.9-2), zfs-test +Conflicts: zutils, zfs-test +Description: OpenZFS test infrastructure and support scripts + OpenZFS is a storage platform that encompasses the functionality of + traditional filesystems and volume managers. It supports data checksums, + compression, encryption, snapshots, and more. + . + This package provides the OpenZFS test infrastructure for destructively + testing and validating a system using OpenZFS. It is entirely optional + and should only be installed and used in test environments. diff --git a/contrib/debian/control.modules.in b/contrib/debian/control.modules.in new file mode 100644 index 000000000..70a165266 --- /dev/null +++ b/contrib/debian/control.modules.in @@ -0,0 +1,33 @@ +Source: openzfs-linux +Section: contrib/kernel +Priority: optional +Maintainer: ZFS on Linux specific mailing list +Build-Depends: debhelper-compat (= 10), + dkms (>> 2.1.1.2-5), + libtool, + linux-headers-_KVERS_ +Standards-Version: 4.3.0 +Homepage: http://www.openzfs.org/ +Vcs-Git: https://github.com/openzfs/zfs.git +Vcs-Browser: https://github.com/openzfs/zfs + +Package: openzfs-zfs-modules-_KVERS_ +Architecture: _ARCH_ +Provides: openzfs-zfs-modules +Depends: linux-image-_KVERS_ +Recommends: openzfsutils +Replaces: zfs-modules-_KVERS_ +Conflicts: zfs-modules-_KVERS_ +Description: OpenZFS filesystem kernel modules for Linux (kernel _KVERS_) + An advanced integrated volume manager and filesystem that is designed for + performance and data integrity. Snapshots, clones, checksums, deduplication, + compression, and RAID redundancy are built-in features. + . + This package contains the compiled kernel module for _KVERS_ + . + Includes the SPA, DMU, ZVOL, and ZPL components of OpenZFS. + . + If you have compiled your own kernel, you will most likely need to build + your own zfs-modules. The zfs-source package has been + provided for use with the Debian kernel-package utility to produce a + version of zfs-module for your kernel. diff --git a/contrib/debian/copyright b/contrib/debian/copyright new file mode 100644 index 000000000..65c7d209d --- /dev/null +++ b/contrib/debian/copyright @@ -0,0 +1,19 @@ +This Debian packaging is a derived work of Debian's zfs-linux package [1]. +The original copy of the Debian-styled copyright file can be found at [2]. +The detailed contributor information can be found in [2][3]. + +Files: contrib/debian/* +Copyright: + 2013-2016, Aron Xu + 2016, Petter Reinholdtsen + 2013, Carlos Alberto Lopez Perez + 2013, Turbo Fredriksson + 2012-2013, Richard Laager + 2011-2013, Darik Horn + 2018-2019, Mo Zhou + 2018-2020, Mo Zhou +License: GPL-2+ + +[1] https://tracker.debian.org/pkg/zfs-linux +[2] https://salsa.debian.org/zfsonlinux-team/zfs/-/blob/master/debian/copyright +[3] https://salsa.debian.org/zfsonlinux-team/zfs/-/blob/master/debian/changelog diff --git a/contrib/debian/not-installed b/contrib/debian/not-installed new file mode 100644 index 000000000..ad14776f3 --- /dev/null +++ b/contrib/debian/not-installed @@ -0,0 +1,13 @@ +usr/bin/arc_summary.py +usr/share/zfs/enum-extract.pl +usr/share/zfs/zfs-helpers.sh +etc/default/zfs +etc/init.d +etc/sudoers.d +etc/zfs/vdev_id.conf.alias.example +etc/zfs/vdev_id.conf.multipath.example +etc/zfs/vdev_id.conf.sas_direct.example +etc/zfs/vdev_id.conf.sas_switch.example +etc/zfs/vdev_id.conf.scsi.example +etc/zfs/zfs-functions +lib/systemd/system/zfs-import.service diff --git a/contrib/debian/openzfs-libnvpair3.docs b/contrib/debian/openzfs-libnvpair3.docs new file mode 100644 index 000000000..4302f1b2a --- /dev/null +++ b/contrib/debian/openzfs-libnvpair3.docs @@ -0,0 +1,2 @@ +COPYRIGHT +LICENSE diff --git a/contrib/debian/openzfs-libnvpair3.install.in b/contrib/debian/openzfs-libnvpair3.install.in new file mode 100644 index 000000000..ed7b541e3 --- /dev/null +++ b/contrib/debian/openzfs-libnvpair3.install.in @@ -0,0 +1 @@ +lib/@DEB_HOST_MULTIARCH@/libnvpair.so.* diff --git a/contrib/debian/openzfs-libpam-zfs.install b/contrib/debian/openzfs-libpam-zfs.install new file mode 100644 index 000000000..c33123f69 --- /dev/null +++ b/contrib/debian/openzfs-libpam-zfs.install @@ -0,0 +1,2 @@ +lib/*/security/pam_zfs_key.so +usr/share/pam-configs/zfs_key diff --git a/contrib/debian/openzfs-libpam-zfs.postinst b/contrib/debian/openzfs-libpam-zfs.postinst new file mode 100644 index 000000000..2db86744e --- /dev/null +++ b/contrib/debian/openzfs-libpam-zfs.postinst @@ -0,0 +1,6 @@ +#!/bin/sh +set -e + +pam-auth-update --package + +#DEBHELPER# diff --git a/contrib/debian/openzfs-libpam-zfs.prerm b/contrib/debian/openzfs-libpam-zfs.prerm new file mode 100644 index 000000000..21e827001 --- /dev/null +++ b/contrib/debian/openzfs-libpam-zfs.prerm @@ -0,0 +1,8 @@ +#!/bin/sh +set -e + +if [ "$1" = remove ] ; then + pam-auth-update --package --remove zfs_key +fi + +#DEBHELPER# diff --git a/contrib/debian/openzfs-libuutil3.docs b/contrib/debian/openzfs-libuutil3.docs new file mode 100644 index 000000000..4302f1b2a --- /dev/null +++ b/contrib/debian/openzfs-libuutil3.docs @@ -0,0 +1,2 @@ +COPYRIGHT +LICENSE diff --git a/contrib/debian/openzfs-libuutil3.install.in b/contrib/debian/openzfs-libuutil3.install.in new file mode 100644 index 000000000..a197d030d --- /dev/null +++ b/contrib/debian/openzfs-libuutil3.install.in @@ -0,0 +1 @@ +lib/@DEB_HOST_MULTIARCH@/libuutil.so.* diff --git a/contrib/debian/openzfs-libzfs-dev.docs b/contrib/debian/openzfs-libzfs-dev.docs new file mode 100644 index 000000000..4302f1b2a --- /dev/null +++ b/contrib/debian/openzfs-libzfs-dev.docs @@ -0,0 +1,2 @@ +COPYRIGHT +LICENSE diff --git a/contrib/debian/openzfs-libzfs-dev.install.in b/contrib/debian/openzfs-libzfs-dev.install.in new file mode 100644 index 000000000..eaa8c3925 --- /dev/null +++ b/contrib/debian/openzfs-libzfs-dev.install.in @@ -0,0 +1,3 @@ +lib/@DEB_HOST_MULTIARCH@/*.a usr/lib/@DEB_HOST_MULTIARCH@ +usr/include +usr/lib/@DEB_HOST_MULTIARCH@ diff --git a/contrib/debian/openzfs-libzfs4.docs b/contrib/debian/openzfs-libzfs4.docs new file mode 100644 index 000000000..4302f1b2a --- /dev/null +++ b/contrib/debian/openzfs-libzfs4.docs @@ -0,0 +1,2 @@ +COPYRIGHT +LICENSE diff --git a/contrib/debian/openzfs-libzfs4.install.in b/contrib/debian/openzfs-libzfs4.install.in new file mode 100644 index 000000000..6765aaee5 --- /dev/null +++ b/contrib/debian/openzfs-libzfs4.install.in @@ -0,0 +1,2 @@ +lib/@DEB_HOST_MULTIARCH@/libzfs.so.* +lib/@DEB_HOST_MULTIARCH@/libzfs_core.so.* diff --git a/contrib/debian/openzfs-libzfsbootenv1.docs b/contrib/debian/openzfs-libzfsbootenv1.docs new file mode 100644 index 000000000..4302f1b2a --- /dev/null +++ b/contrib/debian/openzfs-libzfsbootenv1.docs @@ -0,0 +1,2 @@ +COPYRIGHT +LICENSE diff --git a/contrib/debian/openzfs-libzfsbootenv1.install.in b/contrib/debian/openzfs-libzfsbootenv1.install.in new file mode 100644 index 000000000..492167424 --- /dev/null +++ b/contrib/debian/openzfs-libzfsbootenv1.install.in @@ -0,0 +1 @@ +lib/@DEB_HOST_MULTIARCH@/libzfsbootenv.so.* diff --git a/contrib/debian/openzfs-libzpool5.docs b/contrib/debian/openzfs-libzpool5.docs new file mode 100644 index 000000000..4302f1b2a --- /dev/null +++ b/contrib/debian/openzfs-libzpool5.docs @@ -0,0 +1,2 @@ +COPYRIGHT +LICENSE diff --git a/contrib/debian/openzfs-libzpool5.install.in b/contrib/debian/openzfs-libzpool5.install.in new file mode 100644 index 000000000..b9e872df9 --- /dev/null +++ b/contrib/debian/openzfs-libzpool5.install.in @@ -0,0 +1 @@ +lib/@DEB_HOST_MULTIARCH@/libzpool.so.* diff --git a/contrib/debian/openzfs-python3-pyzfs.install b/contrib/debian/openzfs-python3-pyzfs.install new file mode 100644 index 000000000..4606faae2 --- /dev/null +++ b/contrib/debian/openzfs-python3-pyzfs.install @@ -0,0 +1 @@ +usr/lib/python3* diff --git a/contrib/debian/openzfs-zfs-dkms.config b/contrib/debian/openzfs-zfs-dkms.config new file mode 100644 index 000000000..ad7e160a2 --- /dev/null +++ b/contrib/debian/openzfs-zfs-dkms.config @@ -0,0 +1,31 @@ +#!/bin/sh + +set -e + +# Source debconf library +. /usr/share/debconf/confmodule + +db_input critical zfs-dkms/note-incompatible-licenses || true +db_go + +kernelbits=unknown +if [ -r /proc/kallsyms ]; then + addrlen=$(head -1 /proc/kallsyms|awk '{print $1}'|wc -c) + if [ $addrlen = 17 ]; then + kernelbits=64 + elif [ $addrlen = 9 ]; then + kernelbits=32 + fi +fi + +if [ $kernelbits != 64 ]; then + if [ $kernelbits = 32 ]; then + db_input critical zfs-dkms/stop-build-for-32bit-kernel || true + db_go || true + else + db_input critical zfs-dkms/stop-build-for-unknown-kernel || true + db_go || true + fi +fi + +#DEBHELPER# diff --git a/contrib/debian/openzfs-zfs-dkms.dkms b/contrib/debian/openzfs-zfs-dkms.dkms new file mode 100644 index 000000000..3ac8677b7 --- /dev/null +++ b/contrib/debian/openzfs-zfs-dkms.dkms @@ -0,0 +1 @@ +scripts/zfs-dkms.dkms diff --git a/contrib/debian/openzfs-zfs-dkms.docs b/contrib/debian/openzfs-zfs-dkms.docs new file mode 100644 index 000000000..4302f1b2a --- /dev/null +++ b/contrib/debian/openzfs-zfs-dkms.docs @@ -0,0 +1,2 @@ +COPYRIGHT +LICENSE diff --git a/contrib/debian/openzfs-zfs-dkms.install b/contrib/debian/openzfs-zfs-dkms.install new file mode 100644 index 000000000..b601f22c4 --- /dev/null +++ b/contrib/debian/openzfs-zfs-dkms.install @@ -0,0 +1 @@ +usr/src diff --git a/contrib/debian/openzfs-zfs-dkms.postinst b/contrib/debian/openzfs-zfs-dkms.postinst new file mode 100644 index 000000000..0ecb9674d --- /dev/null +++ b/contrib/debian/openzfs-zfs-dkms.postinst @@ -0,0 +1,51 @@ +#!/bin/sh +set -e + +# Source debconf library (see dh_installdebconf(1) and #106070 #626312) +. /usr/share/debconf/confmodule + +kernelbits=unknown +if [ -r /proc/kallsyms ]; then + addrlen=$(head -1 /proc/kallsyms| grep -o '^ *[^ ]*' |wc -c) + if [ $addrlen = 17 ]; then + kernelbits=64 + elif [ $addrlen = 9 ]; then + kernelbits=32 + fi +fi + +if [ $kernelbits != 64 ]; then + if [ $kernelbits = 32 ]; then + db_get zfs-dkms/stop-build-for-32bit-kernel + if [ "$RET" = "true" ]; then + echo "Ok, aborting, since ZFS is not designed for 32-bit kernels." 1>&2 + # Exit 0: Tell dpkg that we finished OK but stop here. + # (don't build the module) + exit 0 + else + echo "WARNING: Building ZFS module on a 32-bit kernel." 1>&2 + fi + else + db_get zfs-dkms/stop-build-for-unknown-kernel + if [ "$RET" = "true" ]; then + echo "Ok, aborting, since ZFS is not designed for 32-bit kernels." 1>&2 + # Exit 0: (same that above) + exit 0 + else + echo "WARNING: Building ZFS module on an unknown kernel." 1>&2 + fi + fi +fi + +# Here the module gets built (automatically handled by dh_dkms) + +#DEBHELPER# + + +case $1 in + (configure) + if [ -x /usr/share/update-notifier/notify-reboot-required ]; then + /usr/share/update-notifier/notify-reboot-required + fi + ;; +esac diff --git a/contrib/debian/openzfs-zfs-dkms.prerm b/contrib/debian/openzfs-zfs-dkms.prerm new file mode 100644 index 000000000..fea2aee8b --- /dev/null +++ b/contrib/debian/openzfs-zfs-dkms.prerm @@ -0,0 +1,8 @@ +#!/bin/sh +set -e + +#DEBHELPER# + +if [ "$1" = "remove" ]; then + rm -f /etc/zfs/zpool.cache +fi diff --git a/contrib/debian/openzfs-zfs-dkms.templates b/contrib/debian/openzfs-zfs-dkms.templates new file mode 100644 index 000000000..3db643464 --- /dev/null +++ b/contrib/debian/openzfs-zfs-dkms.templates @@ -0,0 +1,40 @@ +Template: zfs-dkms/stop-build-for-32bit-kernel +Type: boolean +Default: true +_Description: Abort building OpenZFS on a 32-bit kernel? + You are attempting to build OpenZFS against a 32-bit running kernel. + . + Although possible, building in a 32-bit environment is unsupported and + likely to cause instability leading to possible data corruption. You + are strongly advised to use a 64-bit kernel; if you do decide to + proceed with using OpenZFS on this kernel then keep in mind that it is at + your own risk. + +Template: zfs-dkms/stop-build-for-unknown-kernel +Type: boolean +Default: true +_Description: Abort building OpenZFS on an unknown kernel? + You are attempting to build OpenZFS against a running kernel that could not + be identified as 32-bit or 64-bit. If you are not completely sure that + the running kernel is a 64-bit one, you should probably stop the build. + . + Although possible, building in a 32-bit environment is unsupported and + likely to cause instability leading to possible data corruption. You + are strongly advised to use a 64-bit kernel; if you do decide to + proceed with using OpenZFS on this kernel then keep in mind that it is at + your own risk. + +Template: zfs-dkms/note-incompatible-licenses +Type: note +_Description: Licenses of OpenZFS and Linux are incompatible + OpenZFS is licensed under the Common Development and Distribution License (CDDL), + and the Linux kernel is licensed under the GNU General Public License Version 2 + (GPL-2). While both are free open source licenses they are restrictive + licenses. The combination of them causes problems because it prevents using + pieces of code exclusively available under one license with pieces of code + exclusively available under the other in the same binary. + . + You are going to build OpenZFS using DKMS in such a way that they are not going to + be built into one monolithic binary. Please be aware that distributing both of + the binaries in the same media (disk images, virtual appliances, etc) may + lead to infringing. diff --git a/contrib/debian/openzfs-zfs-dkms.triggers b/contrib/debian/openzfs-zfs-dkms.triggers new file mode 100644 index 000000000..865f50a5d --- /dev/null +++ b/contrib/debian/openzfs-zfs-dkms.triggers @@ -0,0 +1 @@ +activate-await update-initramfs diff --git a/contrib/debian/openzfs-zfs-dracut.install b/contrib/debian/openzfs-zfs-dracut.install new file mode 100644 index 000000000..8c2bf1b5c --- /dev/null +++ b/contrib/debian/openzfs-zfs-dracut.install @@ -0,0 +1,2 @@ +usr/lib/dracut +usr/share/man/man7/dracut.zfs.7 diff --git a/contrib/debian/openzfs-zfs-initramfs.install b/contrib/debian/openzfs-zfs-initramfs.install new file mode 100644 index 000000000..222620947 --- /dev/null +++ b/contrib/debian/openzfs-zfs-initramfs.install @@ -0,0 +1,2 @@ +../tree/zfs-initramfs/* / +usr/share/initramfs-tools/* diff --git a/contrib/debian/openzfs-zfs-modules-_KVERS_-di.install.in b/contrib/debian/openzfs-zfs-modules-_KVERS_-di.install.in new file mode 100644 index 000000000..fc1828ee9 --- /dev/null +++ b/contrib/debian/openzfs-zfs-modules-_KVERS_-di.install.in @@ -0,0 +1,2 @@ +module/spl.ko lib/modules/_KVERS_/extra/zcommon/ +module/zfs.ko lib/modules/_KVERS_/extra/zcommon/ diff --git a/contrib/debian/openzfs-zfs-modules-_KVERS_.install.in b/contrib/debian/openzfs-zfs-modules-_KVERS_.install.in new file mode 100644 index 000000000..fc1828ee9 --- /dev/null +++ b/contrib/debian/openzfs-zfs-modules-_KVERS_.install.in @@ -0,0 +1,2 @@ +module/spl.ko lib/modules/_KVERS_/extra/zcommon/ +module/zfs.ko lib/modules/_KVERS_/extra/zcommon/ diff --git a/contrib/debian/openzfs-zfs-modules-_KVERS_.postinst.in b/contrib/debian/openzfs-zfs-modules-_KVERS_.postinst.in new file mode 100644 index 000000000..4eb231450 --- /dev/null +++ b/contrib/debian/openzfs-zfs-modules-_KVERS_.postinst.in @@ -0,0 +1,16 @@ +#!/bin/sh +set -e + +# Run depmod first +depmod -a _KVERS_ + +#DEBHELPER# + + +case $1 in + (configure) + if [ -x /usr/share/update-notifier/notify-reboot-required ]; then + /usr/share/update-notifier/notify-reboot-required + fi + ;; +esac diff --git a/contrib/debian/openzfs-zfs-modules-_KVERS_.postrm.in b/contrib/debian/openzfs-zfs-modules-_KVERS_.postrm.in new file mode 100644 index 000000000..2a2fc4b5c --- /dev/null +++ b/contrib/debian/openzfs-zfs-modules-_KVERS_.postrm.in @@ -0,0 +1,7 @@ +#!/bin/sh +set -e + +# Run depmod after module uninstallation. +depmod + +#DEBHELPER# diff --git a/contrib/debian/openzfs-zfs-test.install b/contrib/debian/openzfs-zfs-test.install new file mode 100644 index 000000000..cafcfdc0e --- /dev/null +++ b/contrib/debian/openzfs-zfs-test.install @@ -0,0 +1,15 @@ +sbin/zinject +sbin/ztest +usr/bin/raidz_test +usr/share/man/man1/raidz_test.1 +usr/share/man/man1/test-runner.1 +usr/share/man/man1/ztest.1 +usr/share/man/man8/zinject.8 +usr/share/zfs/common.sh +usr/share/zfs/runfiles/ +usr/share/zfs/test-runner +usr/share/zfs/zfs-tests.sh +usr/share/zfs/zfs-tests/ +usr/share/zfs/zfs.sh +usr/share/zfs/zimport.sh +usr/share/zfs/zloop.sh diff --git a/contrib/debian/openzfs-zfs-zed.install b/contrib/debian/openzfs-zfs-zed.install new file mode 100644 index 000000000..a348ba828 --- /dev/null +++ b/contrib/debian/openzfs-zfs-zed.install @@ -0,0 +1,5 @@ +etc/zfs/zed.d/* +lib/systemd/system/zfs-zed.service +usr/lib/zfs-linux/zed.d/* +usr/sbin/zed +usr/share/man/man8/zed.8 diff --git a/contrib/debian/openzfs-zfs-zed.postinst b/contrib/debian/openzfs-zfs-zed.postinst new file mode 100644 index 000000000..a615eec95 --- /dev/null +++ b/contrib/debian/openzfs-zfs-zed.postinst @@ -0,0 +1,20 @@ +#!/bin/sh +set -e + +zedd="/usr/lib/zfs-linux/zed.d" +etcd="/etc/zfs/zed.d" + +# enable all default zedlets that are not overridden +while read -r file ; do + etcfile="${etcd}/${file}" + [ -e "${etcfile}" ] && continue + ln -sfT "${zedd}/${file}" "${etcfile}" +done < "${zedd}/DEFAULT-ENABLED" + +# remove the overrides created in prerm +find "${etcd}" -maxdepth 1 -lname '/dev/null' -delete +# remove any dangling symlinks to old zedlets +find "${etcd}" -maxdepth 1 -lname "${zedd}/*" -xtype l -delete + +#DEBHELPER# + diff --git a/contrib/debian/openzfs-zfs-zed.postrm b/contrib/debian/openzfs-zfs-zed.postrm new file mode 100644 index 000000000..e9aed3f4c --- /dev/null +++ b/contrib/debian/openzfs-zfs-zed.postrm @@ -0,0 +1,17 @@ +#!/bin/sh +set -e + +zedd="/usr/lib/zfs-linux/zed.d" +etcd="/etc/zfs/zed.d" + +if [ "$1" = "purge" ] && [ -d "$etcd" ] ; then + # remove the overrides created in prerm + find "${etcd}" -maxdepth 1 -lname '/dev/null' -delete + # remove any dangling symlinks to old zedlets + find "${etcd}" -maxdepth 1 -lname "${zedd}/*" -xtype l -delete + # clean up any empty directories + ( rmdir "$etcd" && rmdir "/etc/zfs" ) || true +fi + +#DEBHELPER# + diff --git a/contrib/debian/openzfs-zfs-zed.prerm b/contrib/debian/openzfs-zfs-zed.prerm new file mode 100644 index 000000000..b8340df53 --- /dev/null +++ b/contrib/debian/openzfs-zfs-zed.prerm @@ -0,0 +1,16 @@ +#!/bin/sh +set -e + +zedd="/usr/lib/zfs-linux/zed.d" +etcd="/etc/zfs/zed.d" + +if [ "$1" != "failed-upgrade" ] && [ -d "${etcd}" ] && [ -d "${zedd}" ] ; then + while read -r file ; do + etcfile="${etcd}/${file}" + ( [ -L "${etcfile}" ] || [ -e "${etcfile}" ] ) && continue + ln -sT /dev/null "${etcfile}" + done < "${zedd}/DEFAULT-ENABLED" +fi + +#DEBHELPER# + diff --git a/contrib/debian/openzfs-zfs-zed.zfs-zed.init b/contrib/debian/openzfs-zfs-zed.zfs-zed.init new file mode 120000 index 000000000..3f41f6813 --- /dev/null +++ b/contrib/debian/openzfs-zfs-zed.zfs-zed.init @@ -0,0 +1 @@ +../etc/init.d/zfs-zed \ No newline at end of file diff --git a/contrib/debian/openzfs-zfsutils.docs b/contrib/debian/openzfs-zfsutils.docs new file mode 100644 index 000000000..4302f1b2a --- /dev/null +++ b/contrib/debian/openzfs-zfsutils.docs @@ -0,0 +1,2 @@ +COPYRIGHT +LICENSE diff --git a/contrib/debian/openzfs-zfsutils.examples b/contrib/debian/openzfs-zfsutils.examples new file mode 100644 index 000000000..9f10d3fc0 --- /dev/null +++ b/contrib/debian/openzfs-zfsutils.examples @@ -0,0 +1,5 @@ +etc/zfs/vdev_id.conf.alias.example +etc/zfs/vdev_id.conf.multipath.example +etc/zfs/vdev_id.conf.sas_direct.example +etc/zfs/vdev_id.conf.sas_switch.example +etc/zfs/vdev_id.conf.scsi.example diff --git a/contrib/debian/openzfs-zfsutils.install b/contrib/debian/openzfs-zfsutils.install new file mode 100644 index 000000000..e10a50e01 --- /dev/null +++ b/contrib/debian/openzfs-zfsutils.install @@ -0,0 +1,135 @@ +etc/default/zfs +etc/zfs/zfs-functions +etc/zfs/zpool.d/ +etc/bash_completion.d/zfs +lib/systemd/system-generators/ +lib/systemd/system-preset/ +lib/systemd/system/zfs-import-cache.service +lib/systemd/system/zfs-import-scan.service +lib/systemd/system/zfs-import.target +lib/systemd/system/zfs-load-key.service +lib/systemd/system/zfs-mount.service +lib/systemd/system/zfs-scrub-monthly@.timer +lib/systemd/system/zfs-scrub-weekly@.timer +lib/systemd/system/zfs-scrub@.service +lib/systemd/system/zfs-trim-monthly@.timer +lib/systemd/system/zfs-trim-weekly@.timer +lib/systemd/system/zfs-trim@.service +lib/systemd/system/zfs-share.service +lib/systemd/system/zfs-volume-wait.service +lib/systemd/system/zfs-volumes.target +lib/systemd/system/zfs.target +lib/udev/ +sbin/fsck.zfs +sbin/mount.zfs +sbin/zdb +sbin/zfs +sbin/zfs_ids_to_path +sbin/zgenhostid +sbin/zhack +sbin/zpool +sbin/zstream +sbin/zstreamdump +usr/bin/zvol_wait +usr/lib/modules-load.d/ lib/ +usr/lib/zfs-linux/zpool.d/ +usr/lib/zfs-linux/zpool_influxdb +usr/sbin/arc_summary +usr/sbin/arcstat +usr/sbin/dbufstat +usr/sbin/zilstat +usr/share/zfs/compatibility.d/ +usr/share/bash-completion/completions +usr/share/man/man1/arcstat.1 +usr/share/man/man1/zhack.1 +usr/share/man/man1/zvol_wait.1 +usr/share/man/man5/ +usr/share/man/man8/fsck.zfs.8 +usr/share/man/man8/mount.zfs.8 +usr/share/man/man8/vdev_id.8 +usr/share/man/man8/zdb.8 +usr/share/man/man8/zfs-allow.8 +usr/share/man/man8/zfs-bookmark.8 +usr/share/man/man8/zfs-change-key.8 +usr/share/man/man8/zfs-clone.8 +usr/share/man/man8/zfs-create.8 +usr/share/man/man8/zfs-destroy.8 +usr/share/man/man8/zfs-diff.8 +usr/share/man/man8/zfs-get.8 +usr/share/man/man8/zfs-groupspace.8 +usr/share/man/man8/zfs-hold.8 +usr/share/man/man8/zfs-inherit.8 +usr/share/man/man8/zfs-jail.8 +usr/share/man/man8/zfs-list.8 +usr/share/man/man8/zfs-load-key.8 +usr/share/man/man8/zfs-mount-generator.8 +usr/share/man/man8/zfs-mount.8 +usr/share/man/man8/zfs-program.8 +usr/share/man/man8/zfs-project.8 +usr/share/man/man8/zfs-projectspace.8 +usr/share/man/man8/zfs-promote.8 +usr/share/man/man8/zfs-receive.8 +usr/share/man/man8/zfs-recv.8 +usr/share/man/man8/zfs-redact.8 +usr/share/man/man8/zfs-release.8 +usr/share/man/man8/zfs-rename.8 +usr/share/man/man8/zfs-rollback.8 +usr/share/man/man8/zfs-send.8 +usr/share/man/man8/zfs-set.8 +usr/share/man/man8/zfs-share.8 +usr/share/man/man8/zfs-snapshot.8 +usr/share/man/man8/zfs-unallow.8 +usr/share/man/man8/zfs-unjail.8 +usr/share/man/man8/zfs-unload-key.8 +usr/share/man/man8/zfs-unmount.8 +usr/share/man/man8/zfs-unzone.8 +usr/share/man/man8/zfs-upgrade.8 +usr/share/man/man8/zfs-userspace.8 +usr/share/man/man8/zfs-wait.8 +usr/share/man/man8/zfs-zone.8 +usr/share/man/man8/zfs.8 +usr/share/man/man8/zfs_ids_to_path.8 +usr/share/man/man7/zfsconcepts.7 +usr/share/man/man7/zfsprops.7 +usr/share/man/man8/zgenhostid.8 +usr/share/man/man8/zpool-add.8 +usr/share/man/man8/zpool-attach.8 +usr/share/man/man8/zpool-checkpoint.8 +usr/share/man/man8/zpool-clear.8 +usr/share/man/man8/zpool-create.8 +usr/share/man/man8/zpool-destroy.8 +usr/share/man/man8/zpool-detach.8 +usr/share/man/man8/zpool-events.8 +usr/share/man/man8/zpool-export.8 +usr/share/man/man8/zpool-get.8 +usr/share/man/man8/zpool-history.8 +usr/share/man/man8/zpool-import.8 +usr/share/man/man8/zpool-initialize.8 +usr/share/man/man8/zpool-iostat.8 +usr/share/man/man8/zpool-labelclear.8 +usr/share/man/man8/zpool-list.8 +usr/share/man/man8/zpool-offline.8 +usr/share/man/man8/zpool-online.8 +usr/share/man/man8/zpool-reguid.8 +usr/share/man/man8/zpool-remove.8 +usr/share/man/man8/zpool-reopen.8 +usr/share/man/man8/zpool-replace.8 +usr/share/man/man8/zpool-resilver.8 +usr/share/man/man8/zpool-scrub.8 +usr/share/man/man8/zpool-set.8 +usr/share/man/man8/zpool-split.8 +usr/share/man/man8/zpool-status.8 +usr/share/man/man8/zpool-sync.8 +usr/share/man/man8/zpool-trim.8 +usr/share/man/man8/zpool-upgrade.8 +usr/share/man/man8/zpool-wait.8 +usr/share/man/man8/zpool.8 +usr/share/man/man7/zpoolconcepts.7 +usr/share/man/man7/zpoolprops.7 +usr/share/man/man8/zstream.8 +usr/share/man/man8/zstreamdump.8 +usr/share/man/man4/spl.4 +usr/share/man/man4/zfs.4 +usr/share/man/man7/zpool-features.7 +usr/share/man/man7/dracut.zfs.7 +usr/share/man/man8/zpool_influxdb.8 diff --git a/contrib/debian/openzfs-zfsutils.postinst b/contrib/debian/openzfs-zfsutils.postinst new file mode 100644 index 000000000..b13a78654 --- /dev/null +++ b/contrib/debian/openzfs-zfsutils.postinst @@ -0,0 +1,28 @@ +#!/bin/sh +set -e + +# The hostname and hostid of the last system to access a ZFS pool are stored in +# the ZFS pool itself. A pool is foreign if, during `zpool import`, the +# current hostname and hostid are different than the stored values thereof. +# +# The only way of having a stable hostid is to define it in /etc/hostid. +# This postinst helper will check if we already have the hostid stabilized by +# checking the existence of the file /etc/hostid to be 4 bytes at least. +# If this file don't already exists on our system or has less than 4 bytes, then +# a new (random) value is generated with zgenhostid (8) and stored in +# /etc/hostid + +if [ ! -f /etc/hostid ] || [ "$(stat -c %s /etc/hostid)" -lt 4 ] ; then + zgenhostid +fi + +# When processed to here but zfs kernel module is not loaded, the subsequent +# services would fail to start. In this case the installation process just +# fails at the postinst stage. The user could do +# $ sudo modprobe zfs; sudo dpkg --configure -a +# to complete the installation. +# +modprobe -v zfs || true # modprobe zfs does nothing if zfs.ko was already loaded. + +#DEBHELPER# + diff --git a/contrib/debian/openzfs-zfsutils.zfs-import.init b/contrib/debian/openzfs-zfsutils.zfs-import.init new file mode 120000 index 000000000..bfc368fd3 --- /dev/null +++ b/contrib/debian/openzfs-zfsutils.zfs-import.init @@ -0,0 +1 @@ +../etc/init.d/zfs-import \ No newline at end of file diff --git a/contrib/debian/openzfs-zfsutils.zfs-load-key.init b/contrib/debian/openzfs-zfsutils.zfs-load-key.init new file mode 120000 index 000000000..3f3e97f81 --- /dev/null +++ b/contrib/debian/openzfs-zfsutils.zfs-load-key.init @@ -0,0 +1 @@ +../etc/init.d/zfs-load-key \ No newline at end of file diff --git a/contrib/debian/openzfs-zfsutils.zfs-mount.init b/contrib/debian/openzfs-zfsutils.zfs-mount.init new file mode 120000 index 000000000..62a544332 --- /dev/null +++ b/contrib/debian/openzfs-zfsutils.zfs-mount.init @@ -0,0 +1 @@ +../etc/init.d/zfs-mount \ No newline at end of file diff --git a/contrib/debian/openzfs-zfsutils.zfs-share.init b/contrib/debian/openzfs-zfsutils.zfs-share.init new file mode 120000 index 000000000..3f069f9ba --- /dev/null +++ b/contrib/debian/openzfs-zfsutils.zfs-share.init @@ -0,0 +1 @@ +../etc/init.d/zfs-share \ No newline at end of file diff --git a/contrib/debian/rules b/contrib/debian/rules new file mode 100755 index 000000000..5f4889445 --- /dev/null +++ b/contrib/debian/rules @@ -0,0 +1,223 @@ +#!/usr/bin/make -f + +include /usr/share/dpkg/default.mk + +LSB_DISTRIBUTOR := $(shell lsb_release -is) +NAME := $(shell awk '$$1 == "Name:" { print $$2; }' META) +LINUX_MIN := $(shell awk '/Linux-Minimum:/{print $$2}' META) +LINUX_NEXT := $(shell awk -F'[ .]' '/Linux-Maximum:/{print $$2 "." $$3+1}' META) + +DKMSFILES := module include config zfs.release.in autogen.sh META AUTHORS \ + COPYRIGHT LICENSE README.md + +ifndef KVERS +KVERS=$(shell uname -r) +endif + +non_epoch_version=$(shell echo $(KVERS) | perl -pe 's/^\d+://') +PACKAGE=openzfs-zfs +pmodules = $(PACKAGE)-modules-$(non_epoch_version) + +export DEB_BUILD_MAINT_OPTIONS = hardening=+all + +NUM_CPUS = $(shell nproc 2>/dev/null) +PARALLEL = $(subst parallel=,,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) +NJOBS = -j$(or $(PARALLEL),$(NUM_CPUS),1) + +%: + dh $@ --with autoreconf,dkms,python3,sphinxdoc + +override_dh_autoreconf: + @# Embed the downstream version in the module. + @sed -e 's/^Version:.*/Version: $(DEB_VERSION_UPSTREAM)/' -i.orig META + + dh_autoreconf + +override_dh_auto_configure: + @# Build the userland, but don't build the kernel modules. + dh_auto_configure -- \ + --bindir=/usr/bin \ + --sbindir=/sbin \ + --libdir=/lib/"$(DEB_HOST_MULTIARCH)" \ + --with-udevdir=/lib/udev \ + --with-zfsexecdir=/usr/lib/zfs-linux \ + --enable-systemd \ + --enable-pyzfs \ + --with-python=python3 \ + --with-pammoduledir='/lib/$(DEB_HOST_MULTIARCH)/security' \ + --with-pkgconfigdir='/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig' \ + --with-systemdunitdir=/lib/systemd/system \ + --with-systemdpresetdir=/lib/systemd/system-preset \ + --with-systemdgeneratordir=/lib/systemd/system-generators \ + --with-config=user + + for i in $(wildcard $(CURDIR)/debian/*.install.in) ; do \ + basename "$$i" | grep _KVERS_ && continue ; \ + sed 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' "$$i" > "$${i%%.in}" ; \ + done + +override_dh_gencontrol: + dh_gencontrol -- -Vlinux:Recommends="linux-libc-dev (<< $(LINUX_NEXT)~), linux-libc-dev (>= $(LINUX_MIN)~)," + +override_dh_auto_build: + @# Get a bare copy of the source code for DKMS. + @# This creates the $(CURDIR)/$(NAME)-$(DEB_VERSION_UPSTREAM)/ tree, which does not + @# contain the userland sources. NB: Remove-userland-dist-rules.patch + $(MAKE) distdir + + dh_auto_build + +override_dh_auto_install: + @# Install the utilities. + $(MAKE) install DESTDIR='$(CURDIR)/debian/tmp' + + # Use upstream's bash completion + install -D -t '$(CURDIR)/debian/tmp/usr/share/bash-completion/completions/' \ + '$(CURDIR)/contrib/bash_completion.d/zfs' + + # Move from bin_dir to /usr/sbin + # Remove suffix (.py) as per policy 10.4 - Scripts + # https://www.debian.org/doc/debian-policy/ch-files.html#s-scripts + mkdir -p '$(CURDIR)/debian/tmp/usr/sbin/' + mv '$(CURDIR)/debian/tmp/usr/bin/arc_summary' '$(CURDIR)/debian/tmp/usr/sbin/arc_summary' + mv '$(CURDIR)/debian/tmp/usr/bin/arcstat' '$(CURDIR)/debian/tmp/usr/sbin/arcstat' + mv '$(CURDIR)/debian/tmp/usr/bin/dbufstat' '$(CURDIR)/debian/tmp/usr/sbin/dbufstat' + mv '$(CURDIR)/debian/tmp/usr/bin/zilstat' '$(CURDIR)/debian/tmp/usr/sbin/zilstat' + + @# Zed has dependencies outside of the system root. + mv '$(CURDIR)/debian/tmp/sbin/zed' '$(CURDIR)/debian/tmp/usr/sbin/zed' + + @# Install the DKMS source. + @# We only want the files needed to build the modules + install -D -t '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/scripts' \ + '$(CURDIR)/scripts/enum-extract.pl' \ + '$(CURDIR)/scripts/dkms.postbuild' + $(foreach file,$(DKMSFILES),mv '$(CURDIR)/$(NAME)-$(DEB_VERSION_UPSTREAM)/$(file)' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)' || exit 1;) + + @# Only ever build Linux modules + echo 'SUBDIRS = linux' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/include/os/Makefile.am' + + @# Hellish awk line: + @# * Deletes from configure.ac the parts not needed for building the kernel module + @# * It deletes from inside AC_CONFIG_FILES([]) everything except: + @# - Makefile$ + @# - include/(Makefile|sys|os/(Makefile|linux)) + @# - module/ + @# - zfs.release$ + @# * Takes care of spaces and tabs + @# * Remove reference to ZFS_AC_PACKAGE + awk '/^AC_CONFIG_FILES\(\[/,/^\]\)/ {\ + if ($$0 !~ /^(AC_CONFIG_FILES\(\[([ \t]+)?$$|\]\)([ \t]+)?$$|([ \t]+)?(include\/(Makefile|sys|os\/(Makefile|linux))|module\/|Makefile([ \t]+)?$$|zfs\.release([ \t]+)?$$))/) \ + {next} } {print}' \ + '$(CURDIR)/$(NAME)-$(DEB_VERSION_UPSTREAM)/configure.ac' | sed '/ZFS_AC_PACKAGE/d' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/configure.ac' + @# Set "SUBDIRS = module include" for CONFIG_KERNEL and remove SUBDIRS for all other configs. + @# Do not regenerate zfs_gitrev.h during dkms build + sed '1,/CONFIG_KERNEL/s/SUBDIRS.*=.*//g;s/SUBDIRS.*=.*/SUBDIRS = module include/g;/make_gitrev.sh/d' \ + '$(CURDIR)/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am' + @# Sanity test + grep -q 'SUBDIRS = module include' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am' + sed -i '/rpm.Makefile/d' $(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am + sed -i '/cmd.Makefile/d' $(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am + sed -i '/contrib.Makefile/d' $(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am + sed -i '/etc.Makefile/d' $(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am + sed -i '/lib.Makefile/d' $(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am + sed -i '/man.Makefile/d' $(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am + sed -i '/scripts.Makefile/d' $(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am + sed -i '/tests.Makefile/d' $(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am + sed -i '/udev.Makefile/d' $(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am + @# Run autogen on the stripped source tree + cd '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)'; ./autogen.sh + rm -fr '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/autom4te.cache' + + for i in `ls $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/*.so`; do \ + ln -s '/lib/$(DEB_HOST_MULTIARCH)/'`readlink $${i}` '$(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/'`basename $${i}`; \ + rm $${i}; \ + done + + chmod a-x '$(CURDIR)/debian/tmp/etc/zfs/zfs-functions' + chmod a-x '$(CURDIR)/debian/tmp/etc/default/zfs' + chmod a-x '$(CURDIR)/debian/tmp/usr/share/bash-completion/completions/zfs' + +override_dh_python3: + dh_python3 -p openzfs-python3-pyzfs + +override_dh_dkms: + '$(CURDIR)/scripts/dkms.mkconf' -n $(NAME) -v $(DEB_VERSION_UPSTREAM) -f '$(CURDIR)/scripts/zfs-dkms.dkms' + dh_dkms + rm -f '$(CURDIR)/scripts/zfs-dkms.dkms' + +override_dh_makeshlibs: + dh_makeshlibs -a -V + +override_dh_strip: + dh_strip + +override_dh_auto_clean: + rm -rf zfs-$(DEB_VERSION_UPSTREAM) + dh_auto_clean + @if test -e META.orig; then mv META.orig META; fi + +override_dh_install: + find debian/tmp/lib -name '*.la' -delete + dh_install + +override_dh_missing: + dh_missing --fail-missing + +override_dh_installinit: + dh_installinit -r --no-restart-after-upgrade --name zfs-import + dh_installinit -r --no-restart-after-upgrade --name zfs-mount + dh_installinit -r --no-restart-after-upgrade --name zfs-load-key + dh_installinit -R --name zfs-share + dh_installinit -R --name zfs-zed + +override_dh_installsystemd: + mkdir -p debian/openzfs-zfsutils/lib/systemd/system + ln -sr /dev/null debian/openzfs-zfsutils/lib/systemd/system/zfs-import.service + dh_installsystemd --no-stop-on-upgrade -X zfs-zed.service + dh_installsystemd --name zfs-zed + +override_dh_installdocs: + dh_installdocs -A +ifeq (,$(findstring nodoc, $(DEB_BUILD_OPTIONS))) + http_proxy='127.0.0.1:9' sphinx-build -N -bhtml "$(CURDIR)/contrib/pyzfs/docs/source/" debian/openzfs-pyzfs-doc/usr/share/doc/openzfs-pyzfs-doc/html/ +endif + +# ------------ + +override_dh_prep-deb-files: + for templ in $(wildcard $(CURDIR)/debian/*_KVERS_*.in); do \ + sed -e 's/##KVERS##/$(KVERS)/g ; s/#KVERS#/$(KVERS)/g ; s/_KVERS_/$(KVERS)/g ; s/##KDREV##/$(KDREV)/g ; s/#KDREV#/$(KDREV)/g ; s/_KDREV_/$(KDREV)/g ; s/_ARCH_/$(DEB_HOST_ARCH)/' \ + < $$templ > `echo $$templ | sed -e 's/_KVERS_/$(KVERS)/g ; s/_ARCH_/$(DEB_HOST_ARCH)/g ; s/\.in$$//'` ; \ + done + sed -e 's/##KVERS##/$(KVERS)/g ; s/#KVERS#/$(KVERS)/g ; s/_KVERS_/$(KVERS)/g ; s/##KDREV##/$(KDREV)/g ; s/#KDREV#/$(KDREV)/g ; s/_KDREV_/$(KDREV)/g ; s/_ARCH_/$(DEB_HOST_ARCH)/g' \ + < debian/control.modules.in > debian/control + +override_dh_configure_modules: override_dh_configure_modules_stamp +override_dh_configure_modules_stamp: + ./configure \ + --with-config=kernel \ + --with-linux=$(KSRC) \ + --with-linux-obj=$(KOBJ) + touch override_dh_configure_modules_stamp + +override_dh_binary-modules: override_dh_prep-deb-files override_dh_configure_modules + dh_testdir + dh_testroot + dh_prep + + $(MAKE) $(NJOBS) -C $(CURDIR)/module modules + + dh_install -p${pmodules} + dh_installdocs -p${pmodules} + dh_installchangelogs -p${pmodules} + dh_compress -p${pmodules} + dh_strip -p${pmodules} + dh_fixperms -p${pmodules} + dh_installdeb -p${pmodules} + dh_gencontrol -p${pmodules} + dh_md5sums -p${pmodules} + dh_builddeb -p${pmodules} + +debian-copyright: + cme update dpkg-copyright -file debian/copyright.cme diff --git a/contrib/debian/source/format b/contrib/debian/source/format new file mode 100644 index 000000000..163aaf8d8 --- /dev/null +++ b/contrib/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/contrib/debian/tree/zfs-initramfs/usr/share/initramfs-tools/conf.d/zfs b/contrib/debian/tree/zfs-initramfs/usr/share/initramfs-tools/conf.d/zfs new file mode 100644 index 000000000..5103cc450 --- /dev/null +++ b/contrib/debian/tree/zfs-initramfs/usr/share/initramfs-tools/conf.d/zfs @@ -0,0 +1,8 @@ +for x in $(cat /proc/cmdline) +do + case $x in + root=ZFS=*) + BOOT=zfs + ;; + esac +done diff --git a/contrib/debian/tree/zfs-initramfs/usr/share/initramfs-tools/hooks/zdev b/contrib/debian/tree/zfs-initramfs/usr/share/initramfs-tools/hooks/zdev new file mode 100755 index 000000000..0cf21a421 --- /dev/null +++ b/contrib/debian/tree/zfs-initramfs/usr/share/initramfs-tools/hooks/zdev @@ -0,0 +1,67 @@ +#!/bin/sh +# +# Add udev rules for ZoL to the initrd. +# + +PREREQ="udev" +PREREQ_UDEV_RULES="60-zvol.rules 69-vdev.rules" +COPY_EXEC_LIST="/lib/udev/zvol_id /lib/udev/vdev_id" + +# Generic result code. +RC=0 + +case $1 in +prereqs) + echo "$PREREQ" + exit 0 + ;; +esac + +for ii in $COPY_EXEC_LIST +do + if [ ! -x "$ii" ] + then + echo "Error: $ii is not executable." + RC=2 + fi +done + +if [ "$RC" -ne 0 ] +then + exit "$RC" +fi + +. /usr/share/initramfs-tools/hook-functions + +mkdir -p "$DESTDIR/lib/udev/rules.d/" +for ii in $PREREQ_UDEV_RULES +do + if [ -e "/etc/udev/rules.d/$ii" ] + then + cp -p "/etc/udev/rules.d/$ii" "$DESTDIR/lib/udev/rules.d/" + elif [ -e "/lib/udev/rules.d/$ii" ] + then + cp -p "/lib/udev/rules.d/$ii" "$DESTDIR/lib/udev/rules.d/" + else + echo "Error: Missing udev rule: $ii" + echo " This file must be in the /etc/udev/rules.d or /lib/udev/rules.d directory." + exit 1 + fi +done + +for ii in $COPY_EXEC_LIST +do + copy_exec "$ii" +done + +if [ -f '/etc/default/zfs' -a -r '/etc/default/zfs' ] +then + mkdir -p "$DESTDIR/etc/default" + cp -a '/etc/default/zfs' "$DESTDIR/etc/default/" +fi + +if [ -d '/etc/zfs' -a -r '/etc/zfs' ] +then + mkdir -p "$DESTDIR/etc" + cp -a '/etc/zfs' "$DESTDIR/etc/" +fi diff --git a/scripts/debian-packaging.sh b/scripts/debian-packaging.sh new file mode 100755 index 000000000..9cd042fa4 --- /dev/null +++ b/scripts/debian-packaging.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# +# This script can be used to invoke OpenZFS build from native Debian +# packaging. +# + +print_help () +{ + echo "Usage: $(basename $0) [OPTIONS]" + echo + echo "Options:" + echo " -b, --build Build OpenZFS from Debian Packaging" + echo " -c, --clean Clean the workspace" +} + +if [ "$#" -ne 1 ]; then + print_help + exit 1 +fi + +case $1 in + -b|--build) + cp -r contrib/debian debian + debuild -i -us -uc -b && fakeroot debian/rules override_dh_binary-modules + ;; + -c|--clean) + fakeroot debian/rules override_dh_auto_clean + rm -rf debian + ;; + *) + print_help + ;; +esac + +exit 0