summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Severance2020-04-06 21:46:22 -0400
committerChris Severance2020-04-06 21:46:22 -0400
commit430e5d55cf6f235c886db4d403e068d5fb41ba5b (patch)
tree9b1ae6337bfc1a283dd22241aaee81b154b12173
parente2990f95a91cc9e977e35af570ca0042a04ab767 (diff)
downloadaur-430e5d55cf6f235c886db4d403e068d5fb41ba5b.tar.gz
autu: Update to 0.8.0.r710.g4a21ec056-1
-rw-r--r--.SRCINFO46
-rw-r--r--.gitignore5
-rw-r--r--0001-only-build-the-module-in-dkms.conf.patch49
-rw-r--r--PKGBUILD421
-rw-r--r--linux-5.5-compat-blkg_tryget.patch136
-rw-r--r--zfs.initcpio.hook119
-rw-r--r--zfs.initcpio.install102
-rw-r--r--zfs.install12
8 files changed, 671 insertions, 219 deletions
diff --git a/.SRCINFO b/.SRCINFO
index f1719e1e0377..1681af036343 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,25 +1,42 @@
+# Generated by mksrcinfo v8
+# Tue Apr 7 01:46:22 UTC 2020
pkgbase = zfs-linux-git
- pkgver = 2020.03.31.r5836.g0929c4de3_5.5.13.arch2.1
+ pkgver = 0.8.0.r710.g4a21ec056
pkgrel = 1
url = https://zfsonlinux.org/
arch = x86_64
license = CDDL
- makedepends = linux-headers=5.5.13.arch2-1
+ makedepends = perl
+ makedepends = python
makedepends = git
+ makedepends = linux-headers
depends = kmod
- depends = zfs-utils-git=2020.03.31.r5836.g0929c4de3
- depends = linux=5.5.13.arch2-1
- source = git+https://github.com/zfsonlinux/zfs.git#commit=0929c4de398606f8305057ca540cf577e6771c30
- source = linux-5.5-compat-blkg_tryget.patch
+ depends = linux
+ options = !strip
+ source = git://github.com/zfsonlinux/zfs.git
+ source = 0001-only-build-the-module-in-dkms.conf.patch
+ source = zfs.initcpio.install
+ source = zfs.initcpio.hook
+ md5sums = SKIP
+ md5sums = f66790ba3c14c8ebf276ea06f9376e32
+ md5sums = eca615c602740315333aedd417d83541
+ md5sums = 937d6b89e32f438fa488eee63fa8a966
sha256sums = SKIP
- sha256sums = daae58460243c45c2c7505b1d88dcb299ea7d92bcf3f41d2d30bc213000bb1da
+ sha256sums = 780e590383fb00389c5e02ac15709b7a476d9e07d3c4935ed9eb67c951a88409
+ sha256sums = da1cdc045d144d2109ec7b5d97c53a69823759d8ecff410e47c3a66b69e6518d
+ sha256sums = f95ad1a5421ccbb8b01f448373f46cfd1f718361a82c2687a597325cf9827e3e
pkgname = zfs-linux-git
pkgdesc = Kernel modules for the Zettabyte File System.
install = zfs.install
- groups = archzfs-linux-git
- provides = zfs
- provides = spl
+ depends = kmod
+ depends = linux
+ depends = zfs-utils>=0.8.0
+ depends = dkms
+ provides = zfs=0.8.0
+ provides = zfs-linux=0.8.0
+ provides = spl=0.8.0
+ provides = zfs-utils=0.8.0
conflicts = zfs-dkms
conflicts = zfs-dkms-git
conflicts = zfs-dkms-rc
@@ -28,12 +45,17 @@ pkgname = zfs-linux-git
conflicts = zfs-linux
conflicts = spl-linux-git
conflicts = spl-linux
+ conflicts = zfs-linux
+ conflicts = zfs-utils
+ conflicts = zfs-linux-headers
replaces = spl-linux-git
pkgname = zfs-linux-git-headers
pkgdesc = Kernel headers for the Zettabyte File System.
- provides = zfs-headers
- provides = spl-headers
+ depends = zfs-utils=0.8.0
+ provides = zfs-headers=0.8.0
+ provides = zfs-linux-headers=0.8.0
+ provides = spl-headers=0.8.0
conflicts = zfs-headers
conflicts = zfs-dkms
conflicts = zfs-dkms-git
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index b18b49395bde..000000000000
--- a/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-*.tar.xz
-*.tar.gz
-*.sig
-*.log
-zfs/
diff --git a/0001-only-build-the-module-in-dkms.conf.patch b/0001-only-build-the-module-in-dkms.conf.patch
new file mode 100644
index 000000000000..0e162b5db1fa
--- /dev/null
+++ b/0001-only-build-the-module-in-dkms.conf.patch
@@ -0,0 +1,49 @@
+From b4a2c0b184c9c9599421b15a430fb88deb5dbd17 Mon Sep 17 00:00:00 2001
+From: Eli Schwartz <eschwartz@archlinux.org>
+Date: Sun, 28 Oct 2018 15:01:58 -0400
+Subject: [PATCH] only build the module in dkms.conf
+
+---
+ scripts/dkms.mkconf | 19 ++-----------------
+ 1 file changed, 2 insertions(+), 17 deletions(-)
+
+diff --git a/scripts/dkms.mkconf b/scripts/dkms.mkconf
+index 88c289383..5a859a0e0 100755
+--- a/scripts/dkms.mkconf
++++ b/scripts/dkms.mkconf
+@@ -25,22 +25,7 @@ PACKAGE_CONFIG="${pkgcfg}"
+ PRE_BUILD="configure
+ --prefix=/usr
+ --with-config=kernel
+- --with-linux=\$(
+- case \`lsb_release -is\` in
+- (Debian|Devuan)
+- if [[ -e \${kernel_source_dir/%build/source} ]]
+- then
+- echo \${kernel_source_dir/%build/source}
+- else
+- # A kpkg exception for Proxmox 2.0
+- echo \${kernel_source_dir}
+- fi
+- ;;
+- (*)
+- echo \${kernel_source_dir}
+- ;;
+- esac
+- )
++ --with-linux=\${kernel_source_dir}
+ --with-linux-obj=\${kernel_source_dir}
+ --with-spl=\${source_tree}/spl-\${PACKAGE_VERSION}
+ --with-spl-obj=\${dkms_tree}/spl/\${PACKAGE_VERSION}/\${kernelver}/\${arch}
+@@ -78,7 +63,7 @@ POST_BUILD="scripts/dkms.postbuild
+ BUILD_DEPENDS[0]="spl"
+ AUTOINSTALL="yes"
+ REMAKE_INITRD="no"
+-MAKE[0]="make"
++MAKE[0]="make -C module/"
+ STRIP[0]="\$(
+ [[ -r \${PACKAGE_CONFIG} ]] \\
+ && source \${PACKAGE_CONFIG} \\
+--
+2.19.1
+
diff --git a/PKGBUILD b/PKGBUILD
index 16c1112c7e6f..c530ab898e52 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,72 +1,373 @@
-# Maintainer: Jan Houben <jan@nexttrex.de>
+# Maintainer: Chris Severance aur.severach aATt spamgourmet dott com
+# Contributor: Eli Schwartz <eschwartz@archlinux.org>
+# Contributor: Iacopo Isimbaldi <isiachi@rhye.it>
+# Contributor: Jan Houben <jan@nexttrex.de>
# Contributor: Jesus Alvarez <jeezusjr at gmail dot com>
-#
-# This PKGBUILD was generated by the archzfs build scripts located at
-#
-# http://github.com/archzfs/archzfs
-#
-# ! WARNING !
-#
-# The archzfs packages are kernel modules, so these PKGBUILDS will only work with the kernel package they target. In this
-# case, the archzfs-linux packages will only work with the default linux package! To have a single PKGBUILD target many
-# kernels would make for a cluttered PKGBUILD!
-#
-# If you have a custom kernel, you will need to change things in the PKGBUILDS. If you would like to have AUR or archzfs repo
-# packages for your favorite kernel package built using the archzfs build tools, submit a request in the Issue tracker on the
-# archzfs github page.
-#
-pkgbase="zfs-linux-git"
-pkgname=("zfs-linux-git" "zfs-linux-git-headers")
-_commit='0929c4de398606f8305057ca540cf577e6771c30'
-_zfsver="2020.03.31.r5836.g0929c4de3"
-_kernelver="5.5.13.arch2-1"
-_extramodules="${_kernelver/.arch/-arch}"
-
-pkgver="${_zfsver}_$(echo ${_kernelver} | sed s/-/./g)"
+
+# todo: why is -git in the middle of linux-git-headers?
+
+_opt_DKMS=0
+
+_opt_UTIL=2 # default 2
+# 0 - zfs-utils is a separate package
+# 1 - zfs-utils is a package split here
+# 2 - zfs-utils is integrated into zfs-linux
+
+_opt_git=''
+_opt_git='-git'
+
+# Additional option: see _commit below
+# Commit branches with newer version numbers have both newer and older code than master.
+
+set -u
+pkgbase="zfs-linux${_opt_git}"
+pkgname=("${pkgbase}")
+if [ "${_opt_DKMS}" -eq 0 ]; then
+ pkgname+=("${pkgbase}-headers")
+fi
+if [ "${_opt_UTIL}" -eq 1 ]; then
+ pkgname+=("zfs-utils${_opt_git}")
+fi
+pkgver=0.8.0.r710.g4a21ec056
pkgrel=1
-makedepends=("linux-headers=${_kernelver}" "git")
-arch=("x86_64")
-url="https://zfsonlinux.org/"
-source=("git+https://github.com/zfsonlinux/zfs.git#commit=${_commit}"
- "linux-5.5-compat-blkg_tryget.patch")
-sha256sums=("SKIP"
- "daae58460243c45c2c7505b1d88dcb299ea7d92bcf3f41d2d30bc213000bb1da")
-license=("CDDL")
-depends=("kmod" "zfs-utils-git=${_zfsver}" "linux=${_kernelver}")
+_pkgver="${pkgver%%.r*}"
+#_commit="#branch=zfs-${_pkgver%.*}-release"
+arch=('x86_64')
+url='https://zfsonlinux.org/'
+license=('CDDL')
+depends=('kmod' 'linux')
+makedepends=('perl' 'python')
+if [ ! -z "${_opt_git}" ]; then
+ makedepends+=('git' 'linux-headers')
+ _srcdir='zfs'
+else
+ _srcdir="zfs-${_pkgver}"
+fi
+options=('!strip')
+source=(
+ "https://github.com/zfsonlinux/zfs/releases/download/zfs-${_pkgver}/zfs-${_pkgver}.tar.gz"
+ '0001-only-build-the-module-in-dkms.conf.patch'
+)
+if [ "$(vercmp "${_pkgver}" '0.8.3')" -eq 0 ]; then
+ source+=('linux-5.5-compat-blkg_tryget.patch')
+fi
+source+=(
+ 'zfs.initcpio.install'
+ 'zfs.initcpio.hook'
+)
+md5sums=('SKIP'
+ 'f66790ba3c14c8ebf276ea06f9376e32'
+ 'eca615c602740315333aedd417d83541'
+ '937d6b89e32f438fa488eee63fa8a966')
+sha256sums=('SKIP'
+ '780e590383fb00389c5e02ac15709b7a476d9e07d3c4935ed9eb67c951a88409'
+ 'da1cdc045d144d2109ec7b5d97c53a69823759d8ecff410e47c3a66b69e6518d'
+ 'f95ad1a5421ccbb8b01f448373f46cfd1f718361a82c2687a597325cf9827e3e')
+b2sums=('SKIP'
+ '1fdae935043d979b9241f07f8baa25a9a0367c24c31c84a59dfe8d6b468a523d8f49b68da3c7fd3194db6638f9d7bef046fc5e2669ce25d73c65009c16bf6c50'
+ '570e995bba07ea0fb424dff191180b8017b6469501964dc0b70fd51e338a4dad260f87cc313489866cbfd1583e4aac2522cf7309c067cc5314eb83c37fe14ff3'
+ '491a7f20b0c6b4ce4fcedab617b2d7a4f2a01f1bc8f1ae57efde2fb22c2ab09a1107a8f4877b95c27576fe4216d01f181936787f51ce532bb13c5806badf7519')
+
+_extramodules="$(uname -r)"
+
+# Find valid installed kernel to build for next boot after upgrading kernel
+_fn_calc_extramodules() {
+ local _ev="${_extramodules%%-*}"
+ local _fmax=''
+ local _f _fv
+ for _f in /usr/lib/modules/${_ev%.*}.*/build/Makefile; do
+ _f="${_f#/usr/lib/modules/}"
+ _f="${_f%/build/Makefile}"
+ _fv="${_f%%-*}"
+ if [ -z "${_fmax}" ] || [ "$(pkgver "${_ev}" "${_fmax}")" -ge 0 ]; then
+ _fmax="${_f}"
+ fi
+ done
+ if [ ! -z "${_fmax}" ] && [ "${_extramodules}" != "${_fmax}" ]; then
+ set +u; msg "Found upgraded kernel ${_fmax}"; set -u
+ _extramodules="${_fmax}"
+ fi
+}
+
+if [ ! -z "${_opt_git}" ]; then
+ source[0]="git://github.com/zfsonlinux/zfs.git${_commit:-}"
+ md5sums[0]='SKIP'
+ sha256sums[0]='SKIP'
+ b2sums[0]='SKIP'
+pkgver() {
+ set -u
+ cd "${_srcdir}"
+ git describe --long | sed -e 's/^zfs-//' -e 's/\([^-]*-g\)/r\1/' -e 's/-/./g'
+ set +u
+}
+elif [ "${_pkgver}" != "${pkgver}" ]; then
+pkgver() {
+ set -u
+ echo "${_pkgver}"
+ set +u
+}
+fi
+
+if [ ! -z "${HOME:-}" ]; then # block mksrcinfo
+ _fn_calc_extramodules
+ _fn_calc_extramodules() { true; }
+ if [ "${_opt_DKMS}" -eq 0 ]; then
+ pkgver+=".k${_extramodules%%-*}"
+ fi
+fi
+
+prepare() {
+ set -u
+ cd "${_srcdir}"
+
+ local _f
+ for _f in "${source[@]}"; do
+ _f="${_f%%::*}"
+ _f="${_f##*/}"
+ case "${_f}" in
+ *.patch)
+ set +u; msg2 "Patch ${_f}"; set +u
+ patch -Nup1 -i "${srcdir}/${_f}"
+ ;;
+ esac
+ done
+
+ # DKMS install customized all the way back to autoconf
+ local _dkmsdir="${srcdir}/dkms.Arch"
+ # makepkg -i on git packages reruns prepare()
+ if [ ! -z "${_opt_git}" ]; then
+ rm -rf "${_dkmsdir}"
+ fi
+ if [ "${_opt_DKMS}" -ne 0 ] && [ ! -d "${_dkmsdir}" ]; then
+ install -d "${_dkmsdir}"
+ cp -rp . "${_dkmsdir}"
+ pushd "${_dkmsdir}" > /dev/null
+ rm -f 'configure'
+ # remove unneeded sections from module build
+ sed -re "/AC_CONFIG_FILES/,/]\)/{
+/AC_CONFIG_FILES/n
+/]\)/n
+/^\s*(module\/.*)?(${pkgname%-dkms}.release|Makefile)/!d
+}" -i 'configure.ac'
+ popd > /dev/null
+ fi
+ set +u
+}
build() {
- cd "${srcdir}/zfs"
+ set -u
+ cd "${_srcdir}"
+ if [ -z "${MAKEFLAGS:=}" ] || [ "${MAKEFLAGS//-j/}" = "${MAKEFLAGS}" ]; then
+ local _nproc="$(nproc)"; _nproc=$((_nproc>8?8:_nproc))
+ MAKEFLAGS+=" -j ${_nproc}"
+ fi
+ if [ ! -s 'configure' ]; then
./autogen.sh
- ./configure --prefix=/usr --sysconfdir=/etc --sbindir=/usr/bin --libdir=/usr/lib \
- --datadir=/usr/share --includedir=/usr/include --with-udevdir=/lib/udev \
- --libexecdir=/usr/lib/zfs-${_zfsver} --with-config=kernel \
- --with-linux=/usr/lib/modules/${_extramodules}/build \
- --with-linux-obj=/usr/lib/modules/${_extramodules}/build
- make
+ fi
+ if [ "${_opt_DKMS}" -ne 0 ]; then
+ local _dkmsdir="${srcdir}/dkms.Arch"
+ pushd "${_dkmsdir}" > /dev/null
+ if [ ! -s 'configure' ]; then
+ ./autogen.sh
+ ./scripts/dkms.mkconf -n 'zfs' -v "${_pkgver}" -f 'dkms.conf'
+ if [ ! -z "${_opt_git}" ]; then
+ # update metadata
+ ./scripts/make_gitrev.sh
+ local _meta_release="${pkgver#*.r}"
+ sed -e "s/Release:[[:print:]]*/Release: ${_meta_release/./_}/" -i 'META'
+ fi
+ fi
+ popd > /dev/null
+ fi
+ if [ ! -s 'Makefile' ]; then
+ _fn_calc_extramodules
+ local _cf=(
+ --prefix='/usr'
+ --sysconfdir='/etc'
+ --sbindir='/usr/bin'
+ --libdir='/usr/lib'
+ --datadir='/usr/share'
+ --includedir='/usr/include'
+ --with-udevdir='/usr/lib/udev'
+ --libexecdir='/usr/lib/zfs'
+ # kernel module build
+ --with-config='kernel'
+ --with-linux="/usr/lib/modules/${_extramodules}/build"
+ --with-linux-obj="/usr/lib/modules/${_extramodules}/build"
+ )
+ if [ "${_opt_UTIL}" -ge 1 ]; then
+ _cf+=(
+ # utils build
+ --with-config='user'
+ --enable-pyzfs='no'
+ --with-mounthelperdir='/usr/bin'
+ # all build
+ --with-config='all'
+ )
+ if [ "$(vercmp "${pkgver}" '0.8.0')" -le 0 ] && [ -z "${_opt_git}" ]; then
+ # pyzfs is not built, but build system tries to check for python anyway
+ # fixed in master
+ ln -s '/bin/true' 'python3-fake'
+ _cf+=(
+ --with-python="${PWD}/python3-fake"
+ )
+ fi
+ fi
+ nice \
+ ./configure "${_cf[@]}"
+ fi
+ nice make -s
+
+ # make install is very slow. Much faster to do this once and copy
+ rm -rf "${srcdir}/inst"
+ install -d "${srcdir}/inst"
+ make -s -j1 DESTDIR="${srcdir}/inst" install
+ set +u
}
package_zfs-linux-git() {
- pkgdesc="Kernel modules for the Zettabyte File System."
- install=zfs.install
- provides=("zfs" "spl")
- groups=("archzfs-linux-git")
- conflicts=("zfs-dkms" "zfs-dkms-git" "zfs-dkms-rc" "spl-dkms" "spl-dkms-git" 'zfs-linux' 'spl-linux-git' 'spl-linux')
- replaces=("spl-linux-git")
- cd "${srcdir}/zfs"
- make DESTDIR="${pkgdir}" install
- cp -r "${pkgdir}"/{lib,usr}
- rm -r "${pkgdir}"/lib
- # Remove src dir
- rm -r "${pkgdir}"/usr/src
+ set -u
+ pkgdesc='Kernel modules for the Zettabyte File System.'
+ install='zfs.install'
+ provides=("zfs=${_pkgver}" "zfs-linux=${_pkgver}" "spl=${_pkgver}")
+ #groups=('archzfs-linux-git')
+ conflicts=('zfs-dkms' 'zfs-dkms-git' 'zfs-dkms-rc' 'spl-dkms' 'spl-dkms-git' 'zfs-linux' 'spl-linux-git' 'spl-linux')
+ replaces=('spl-linux-git')
+ #if [ "${_opt_UTIL}" -le 1 ]; then
+ depends+=("zfs-utils>=${_pkgver}")
+ #fi
+
+ cd "${_srcdir}"
+ cp -rp "${srcdir}/inst"/* "${pkgdir}"
+
+ _fix_modules
+ if [ "${_opt_UTIL}" -eq 2 ]; then
+ provides+=("zfs-utils=${_pkgver}")
+ conflicts+=('zfs-linux' 'zfs-utils')
+ _fix_utils
+ else
+ _del_utils
+ fi
+ _del_headers
+
+ if [ "${_opt_DKMS}" -eq 0 ]; then
+ # linux not maintained by severach are broken without provides
+ if [ "$(vercmp "${_extramodules%%-*}" '4.19')" -lt 0 ]; then
+ # I don't want Linux version info showing on AUR web. After a few months 'linux<0.0.0' makes it look like an out of date package.
+ _fn_calc_extramodules
+ local _kernelversionsmall="${_extramodules}"
+ _kernelversionsmall="${_kernelversionsmall%%-*}"
+ _kernelversionsmall="${_kernelversionsmall%.0}" # trim 4.0.0 -> 4.0, 4.1.0 -> 4.1
+ # prevent the mksrcinfo bash emulator from getting these vars!
+ #eval 'conf''licts+=("linux>${_kernelversionsmall}" "linux<${_kernelversionsmall}")'
+ eval 'dep''ends+=("linux=${_kernelversionsmall}")'
+ fi
+ else
+ depends+=('dkms')
+ conflicts+=('zfs-linux-headers')
+ #depends+=('lsb-release') # patched away
+ _del_modules
+ pushd "${srcdir}/dkms.Arch" > /dev/null
+ local _dkmsdir="${pkgdir}/usr/src/zfs-${_pkgver}"
+ install -d "${_dkmsdir}"/{config,scripts}
+ cp -a configure dkms.conf Makefile.in META zfs_config.h.in zfs.release.in include/ module/ "${_dkmsdir}"/
+ cp config/config.* config/missing config/*sh "${_dkmsdir}"/config/
+ cp scripts/enum-extract.pl scripts/dkms.postbuild "${_dkmsdir}"/scripts/
+ popd > /dev/null
+ fi
+ set +u
+}
+_z="$(declare -f package_zfs-linux-git)"; eval "${_z//-git/}"
+
+_fix_modules() {
+ pushd "${pkgdir}" > /dev/null
+ install -d 'usr/lib'
+ mv lib/* 'usr/lib/'
+ rmdir 'lib'
+ popd > /dev/null
+}
+
+_del_utils() {
+ pushd "${pkgdir}" > /dev/null
+ if [ -d 'usr/share' ]; then
+ mv 'usr/lib/modules' .
+ mv 'usr/src' .
+ rm -r 'etc' 'usr'
+ install -d 'usr/lib'
+ mv 'src' 'usr/'
+ mv 'modules' 'usr/lib/'
+ fi
+ popd > /dev/null
+}
+
+_del_headers() {
+ pushd "${pkgdir}" > /dev/null
+ rm -r 'usr/src'
+ popd > /dev/null
+}
+
+_del_modules() {
+ pushd "${pkgdir}" > /dev/null
+ rm -r 'usr/lib/modules'
+ rmdir --ignore-fail-on-non-empty -p 'usr/lib'
+ popd > /dev/null
+}
+
+package_zfs-utils-git() {
+ set -u
+ pkgdesc='Userspace utilities for the Zettabyte File System.'
+ optdepends=(
+ 'python: for arcstat/arc_summary/dbufstat'
+ )
+ provides=("${pkgname%-git}=${pkgver%%.r*}")
+ conflicts=("${pkgname%-git}")
+ cd "${_srcdir}"
+
+ cp -rp "${srcdir}/inst"/* "${pkgdir}"
+
+ _fix_utils
+ _fix_modules
+ _del_modules
+ _del_headers
+ set +u
+}
+_z="$(declare -f package_zfs-utils-git)"; eval "${_z//-git/}"
+
+_fix_utils() {
+ install -D -m644 contrib/bash_completion.d/zfs "${pkgdir}"/usr/share/bash-completion/completions/zfs
+ # Remove uneeded files
+ rm -r "${pkgdir}"/etc/init.d
+ rm -r "${pkgdir}"/etc/sudoers.d #???
+ # We're experimenting with dracut in [extra], so start installing this.
+ #rm -r "${pkgdir}"/usr/lib/dracut
+ rm -r "${pkgdir}"/usr/lib/modules-load.d
+ rm -r "${pkgdir}"/usr/share/initramfs-tools
+ rm -r "${pkgdir}"/usr/share/zfs
+
+ install -D -m644 "${srcdir}"/zfs.initcpio.hook "${pkgdir}"/usr/lib/initcpio/hooks/zfs
+ install -D -m644 "${srcdir}"/zfs.initcpio.install "${pkgdir}"/usr/lib/initcpio/install/zfs
}
package_zfs-linux-git-headers() {
- pkgdesc="Kernel headers for the Zettabyte File System."
- provides=("zfs-headers" "spl-headers")
- conflicts=("zfs-headers" "zfs-dkms" "zfs-dkms-git" "zfs-dkms-rc" "spl-dkms" "spl-dkms-git" "spl-headers")
- cd "${srcdir}/zfs"
- make DESTDIR="${pkgdir}" install
- rm -r "${pkgdir}/lib"
- # Remove reference to ${srcdir}
- sed -i "s+${srcdir}++" ${pkgdir}/usr/src/zfs-*/${_extramodules}/Module.symvers
+ set -u
+ pkgdesc='Kernel headers for the Zettabyte File System.'
+ depends=("zfs-utils=${_pkgver}")
+ provides=("zfs-headers=${_pkgver}" "zfs-linux-headers=${_pkgver}" "spl-headers=${_pkgver}")
+ conflicts=('zfs-headers' 'zfs-dkms' 'zfs-dkms-git' 'zfs-dkms-rc' 'spl-dkms' 'spl-dkms-git' 'spl-headers')
+
+ cd "${_srcdir}"
+ cp -rp "${srcdir}/inst"/* "${pkgdir}/"
+
+ _fix_modules
+ _del_utils
+ _del_modules
+
+ # Remove reference to ${srcdir}
+ _fn_calc_extramodules
+ sed -e "s+${srcdir}++" -i "${pkgdir}"/usr/src/zfs-*/${_extramodules}/Module.symvers
+ set +u
}
+_z="$(declare -f package_zfs-linux-git-headers)"; eval "${_z//-git/}"
+unset _z
+
+set +u
diff --git a/linux-5.5-compat-blkg_tryget.patch b/linux-5.5-compat-blkg_tryget.patch
deleted file mode 100644
index f636e87f805a..000000000000
--- a/linux-5.5-compat-blkg_tryget.patch
+++ /dev/null
@@ -1,136 +0,0 @@
-From 2fcab8795c7c493845bfa277d44bc443802000b8 Mon Sep 17 00:00:00 2001
-From: Brian Behlendorf <behlendorf1@llnl.gov>
-Date: Fri, 28 Feb 2020 08:58:39 -0800
-Subject: [PATCH] Linux 5.5 compat: blkg_tryget()
-
-Commit https://github.com/torvalds/linux/commit/9e8d42a0f accidentally
-converted the static inline function blkg_tryget() to GPL-only for
-kernels built with CONFIG_PREEMPT_RCU=y and CONFIG_BLK_CGROUP=y.
-
-Resolve the build issue by providing our own equivalent functionality
-when needed which uses rcu_read_lock_sched() internally as before.
-
-Reviewed-by: Tony Hutter <hutter2@llnl.gov>
-Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
-Closes #9745
-Closes #10072
----
- config/kernel-blkg-tryget.m4 | 37 ++++++++++++++++++++++++++++++++++++
- config/kernel.m4 | 2 ++
- module/zfs/vdev_disk.c | 32 ++++++++++++++++++++++++++++++-
- 3 files changed, 70 insertions(+), 1 deletion(-)
- create mode 100644 config/kernel-blkg-tryget.m4
-
-diff --git a/config/kernel-blkg-tryget.m4 b/config/kernel-blkg-tryget.m4
-new file mode 100644
-index 00000000000..fb831ca3b3e
---- /dev/null
-+++ b/config/kernel-blkg-tryget.m4
-@@ -0,0 +1,37 @@
-+dnl #
-+dnl # Linux 5.5 API,
-+dnl #
-+dnl # The Linux 5.5 kernel updated percpu_ref_tryget() which is inlined by
-+dnl # blkg_tryget() to use rcu_read_lock() instead of rcu_read_lock_sched().
-+dnl # As a side effect the function was converted to GPL-only.
-+dnl #
-+AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKG_TRYGET], [
-+ ZFS_LINUX_TEST_SRC([blkg_tryget], [
-+ #include <linux/blk-cgroup.h>
-+ #include <linux/bio.h>
-+ #include <linux/fs.h>
-+ ],[
-+ struct blkcg_gq blkg __attribute__ ((unused));
-+ bool rc __attribute__ ((unused));
-+ rc = blkg_tryget(&blkg);
-+ ], [], [$ZFS_META_LICENSE])
-+])
-+
-+AC_DEFUN([ZFS_AC_KERNEL_BLKG_TRYGET], [
-+ AC_MSG_CHECKING([whether blkg_tryget() is available])
-+ ZFS_LINUX_TEST_RESULT([blkg_tryget], [
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_BLKG_TRYGET, 1, [blkg_tryget() is available])
-+
-+ AC_MSG_CHECKING([whether blkg_tryget() is GPL-only])
-+ ZFS_LINUX_TEST_RESULT([blkg_tryget_license], [
-+ AC_MSG_RESULT(no)
-+ ],[
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_BLKG_TRYGET_GPL_ONLY, 1,
-+ [blkg_tryget() GPL-only])
-+ ])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
-+])
-diff --git a/config/kernel.m4 b/config/kernel.m4
-index dce619729d4..bea6f9b1bbf 100644
---- a/config/kernel.m4
-+++ b/config/kernel.m4
-@@ -70,6 +70,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
- ZFS_AC_KERNEL_SRC_BIO_BI_STATUS
- ZFS_AC_KERNEL_SRC_BIO_RW_BARRIER
- ZFS_AC_KERNEL_SRC_BIO_RW_DISCARD
-+ ZFS_AC_KERNEL_SRC_BLKG_TRYGET
- ZFS_AC_KERNEL_SRC_BLK_QUEUE_BDI
- ZFS_AC_KERNEL_SRC_BLK_QUEUE_DISCARD
- ZFS_AC_KERNEL_SRC_BLK_QUEUE_SECURE_ERASE
-@@ -186,6 +187,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
- ZFS_AC_KERNEL_BIO_BI_STATUS
- ZFS_AC_KERNEL_BIO_RW_BARRIER
- ZFS_AC_KERNEL_BIO_RW_DISCARD
-+ ZFS_AC_KERNEL_BLKG_TRYGET
- ZFS_AC_KERNEL_BLK_QUEUE_BDI
- ZFS_AC_KERNEL_BLK_QUEUE_DISCARD
- ZFS_AC_KERNEL_BLK_QUEUE_SECURE_ERASE
-diff --git a/module/zfs/vdev_disk.c b/module/zfs/vdev_disk.c
-index 661f0f1b727..8544bb8ffb6 100644
---- a/module/zfs/vdev_disk.c
-+++ b/module/zfs/vdev_disk.c
-@@ -473,6 +473,36 @@ vdev_submit_bio_impl(struct bio *bio)
-
- #ifdef HAVE_BIO_SET_DEV
- #if defined(CONFIG_BLK_CGROUP) && defined(HAVE_BIO_SET_DEV_GPL_ONLY)
-+/*
-+ * The Linux 5.5 kernel updated percpu_ref_tryget() which is inlined by
-+ * blkg_tryget() to use rcu_read_lock() instead of rcu_read_lock_sched().
-+ * As a side effect the function was converted to GPL-only. Define our
-+ * own version when needed which uses rcu_read_lock_sched().
-+ */
-+#if defined(HAVE_BLKG_TRYGET_GPL_ONLY)
-+static inline bool
-+vdev_blkg_tryget(struct blkcg_gq *blkg)
-+{
-+ struct percpu_ref *ref = &blkg->refcnt;
-+ unsigned long __percpu *count;
-+ bool rc;
-+
-+ rcu_read_lock_sched();
-+
-+ if (__ref_is_percpu(ref, &count)) {
-+ this_cpu_inc(*count);
-+ rc = true;
-+ } else {
-+ rc = atomic_long_inc_not_zero(&ref->count);
-+ }
-+
-+ rcu_read_unlock_sched();
-+
-+ return (rc);
-+}
-+#elif defined(HAVE_BLKG_TRYGET)
-+#define vdev_blkg_tryget(bg) blkg_tryget(bg)
-+#endif
- /*
- * The Linux 5.0 kernel updated the bio_set_dev() macro so it calls the
- * GPL-only bio_associate_blkg() symbol thus inadvertently converting
-@@ -487,7 +517,7 @@ vdev_bio_associate_blkg(struct bio *bio)
- ASSERT3P(q, !=, NULL);
- ASSERT3P(bio->bi_blkg, ==, NULL);
-
-- if (q->root_blkg && blkg_tryget(q->root_blkg))
-+ if (q->root_blkg && vdev_blkg_tryget(q->root_blkg))
- bio->bi_blkg = q->root_blkg;
- }
- #define bio_associate_blkg vdev_bio_associate_blkg
diff --git a/zfs.initcpio.hook b/zfs.initcpio.hook
new file mode 100644
index 000000000000..7288ab8018b3
--- /dev/null
+++ b/zfs.initcpio.hook
@@ -0,0 +1,119 @@
+#
+# WARNING: This script is parsed by ash in busybox at boot time, not bash!
+# http://linux.die.net/man/1/ash
+# https://wiki.ubuntu.com/DashAsBinSh
+# http://www.jpsdomain.org/public/2008-JP_bash_vs_dash.pdf
+#
+ZPOOL_FORCE=""
+ZPOOL_IMPORT_FLAGS=""
+
+zfs_get_bootfs () {
+ for zfs_dataset in $(zpool list -H -o bootfs); do
+ case ${zfs_dataset} in
+ "" | "-")
+ # skip this line/dataset
+ ;;
+ "no pools available")
+ return 1
+ ;;
+ *)
+ ZFS_DATASET=${zfs_dataset}
+ return 0
+ ;;
+ esac
+ done
+ return 1
+}
+
+zfs_mount_handler () {
+ if [ "${ZFS_DATASET}" = "bootfs" ] ; then
+ if ! zfs_get_bootfs ; then
+ # Lets import everything and try again
+ zpool import ${ZPOOL_IMPORT_FLAGS} -N -a ${ZPOOL_FORCE}
+ if ! zfs_get_bootfs ; then
+ die "ZFS: Cannot find bootfs."
+ fi
+ fi
+ fi
+
+ local pool="${ZFS_DATASET%%/*}"
+ local rwopt_exp="${rwopt:-ro}"
+
+ if ! zpool list -H "${pool}" 2>&1 > /dev/null ; then
+ if [ ! "${rwopt_exp}" = "rw" ]; then
+ msg "ZFS: Importing pool ${pool} readonly."
+ ZPOOL_IMPORT_FLAGS="${ZPOOL_IMPORT_FLAGS} -o readonly=on"
+ else
+ msg "ZFS: Importing pool ${pool}."
+ fi
+
+ if ! zpool import ${ZPOOL_IMPORT_FLAGS} -N "${pool}" ${ZPOOL_FORCE} ; then
+ die "ZFS: Unable to import pool ${pool}."
+ fi
+ fi
+
+ local node="$1"
+ local tab_file="${node}/etc/fstab"
+ local zfs_datasets="$(zfs list -H -o name -t filesystem -r ${ZFS_DATASET})"
+
+ # Mount the root, and any child datasets
+ for dataset in ${zfs_datasets}; do
+ mountpoint=$(zfs get -H -o value mountpoint "${dataset}")
+ case ${mountpoint} in
+ "none")
+ # skip this line/dataset.
+ ;;
+ "legacy")
+ if [ -f "${tab_file}" ]; then
+ if findmnt -snero source -F "${tab_file}" -S "${dataset}" > /dev/null 2>&1; then
+ opt=$(findmnt -snero options -F "${tab_file}" -S "${dataset}")
+ mnt=$(findmnt -snero target -F "${tab_file}" -S "${dataset}")
+ mount -t zfs -o "${opt}" "${dataset}" "${node}${mnt}"
+ fi
+ fi
+ ;;
+ *)
+ mount -t zfs -o "zfsutil,${rwopt_exp}" "${dataset}" "${node}${mountpoint}"
+ ;;
+ esac
+ done
+}
+
+run_hook() {
+ # Force import the pools, useful if the pool has not properly been exported using 'zpool export <pool>'
+ [ ! "${zfs_force}" = "" ] && ZPOOL_FORCE="-f"
+
+ # Add import directory to import command flags
+ [ ! "${zfs_import_dir}" = "" ] && ZPOOL_IMPORT_FLAGS="${ZPOOL_IMPORT_FLAGS} -d ${zfs_import_dir}"
+
+ # Wait 15 seconds for ZFS devices to show up
+ [ "${zfs_wait}" = "" ] && ZFS_WAIT="15" || ZFS_WAIT="${zfs_wait}"
+
+ [ "${root}" = "zfs" ] && mount_handler="zfs_mount_handler"
+
+ case ${zfs} in
+ "")
+ # skip this line/dataset
+ ;;
+ auto|bootfs)
+ ZFS_DATASET="bootfs"
+ mount_handler="zfs_mount_handler"
+ ;;
+ *)
+ ZFS_DATASET="${zfs}"
+ mount_handler="zfs_mount_handler"
+ ;;
+ esac
+
+ # Allow up to n seconds for zfs device to show up
+ for i in $(seq 1 ${ZFS_WAIT}); do
+ [ -c "/dev/zfs" ] && break
+ sleep 1
+ done
+}
+
+run_latehook () {
+ zpool import -N -a ${ZPOOL_FORCE}
+}
+
+# vim:set ts=4 sw=4 ft=sh et:
diff --git a/zfs.initcpio.install b/zfs.initcpio.install
new file mode 100644
index 000000000000..589b46bee544
--- /dev/null
+++ b/zfs.initcpio.install
@@ -0,0 +1,102 @@
+#!/bin/bash
+
+build() {
+ map add_module \
+ zavl \
+ znvpair \
+ zunicode \
+ zcommon \
+ zfs \
+ spl
+
+ map add_binary \
+ fsck.zfs \
+ mount.zfs \
+ seq \
+ zdb \
+ zed \
+ zfs \
+ zhack \
+ zinject \
+ zpool \
+ zstreamdump \
+ /lib/udev/vdev_id \
+ /lib/udev/zvol_id \
+ findmnt
+
+ map add_file \
+ /lib/udev/rules.d/60-zvol.rules \
+ /lib/udev/rules.d/69-vdev.rules \
+ /lib/udev/rules.d/90-zfs.rules \
+ /lib/libgcc_s.so.1
+
+ map add_dir \
+ /etc/zfs/zed.d
+
+ add_runscript
+
+ # allow mount(8) to "autodetect" ZFS
+ echo 'zfs' >>"${BUILDROOT}/etc/filesystems"
+
+ [[ -f /etc/zfs/zpool.cache ]] && add_file "/etc/zfs/zpool.cache"
+ [[ -f /etc/modprobe.d/zfs.conf ]] && add_file "/etc/modprobe.d/zfs.conf"
+ [[ -f /etc/hostid ]] && add_file "/etc/hostid"
+}
+
+help() {
+ cat<<HELPEOF
+This hook allows you to use ZFS as your root filesystem.
+
+Command Line Setup:
+
+ You can append the following arguments to your kernel parameters list. See
+ https://wiki.archlinux.org/index.php/Kernel_parameters for more information.
+
+ To use ZFS as your boot filesystem:
+
+ zfs=bootfs or zfs=auto or root=zfs
+
+ To use a pool or dataset:
+
+ zfs=<pool/dataset>
+
+ To force importing of a ZFS pool:
+
+ zfs_force=1
+
+ If set to 1, this will use "zpool import -f" when attempting to import
+ pools.
+
+ To change the seconds of time to wait for ZFS devices to show up at boot:
+
+ zfs_wait=30
+
+ To search for devices in a directory other than "/dev":
+
+ zfs_import_dir=/dev/disk/by-uuid
+ or
+ zfs_import_dir=/dev/disk/by-partuuid
+ or
+ zfs_import_dir=/dev/disk/by-path
+ etc.
+
+ Following initcpio convention, the 'rw' option must be specified to load the
+ pool as read/write. Pools are loaded as read only by default.
+
+Examples:
+
+ To use bootfs on your pool, use
+
+ zfs=bootfs rw
+
+ This will setup your root using tank/root zfs pool.
+
+ zfs=tank/root rw
+
+If you want to set properties for zfs-on-linux module, you should add them to
+/etc/modprobe.d/zfs.conf and then rebuild initcpio.
+
+HELPEOF
+}
+
+# vim: set ts=4 sw=4 ft=sh et:
diff --git a/zfs.install b/zfs.install
index c2a2d7807e6d..d0860f57a33a 100644
--- a/zfs.install
+++ b/zfs.install
@@ -1,8 +1,8 @@
post_remove() {
- MK_CONF=$(grep -v '#' /etc/mkinitcpio.conf | grep zfs >/dev/null; echo $?);
- if [[ ${MK_CONF} == '0' && $1 == 'remove' ]]; then
- echo '>>> The ZFS packages have been removed, but "zfs" remains in the "hooks"'
- echo '>>> list in mkinitcpio.conf! You will need to remove "zfs" from the '
- echo '>>> "hooks" list and then regenerate the initial ramdisk.'
- fi
+ MK_CONF=$(grep -v '#' /etc/mkinitcpio.conf | grep zfs >/dev/null; echo $?);
+ if [[ ${MK_CONF} == '0' && $1 == 'remove' ]]; then
+ echo '>>> The ZFS packages have been removed, but "zfs" remains in the "hooks"'
+ echo '>>> list in mkinitcpio.conf! You will need to remove "zfs" from the '
+ echo '>>> "hooks" list and then regenerate the initial ramdisk.'
+ fi
}