diff options
author | Jan Houben | 2018-05-07 21:06:28 +0200 |
---|---|---|
committer | Jan Houben | 2018-05-07 21:06:28 +0200 |
commit | eca07da52c9602588568cbe75c42ccb97d22438c (patch) | |
tree | e8b0a3b601ae4cb85ad7d134b7836f14030a3a4c | |
parent | c70c3114f4ac6c4e67ad945c99c99cda9e4c73fc (diff) | |
download | aur-eca07da52c9602588568cbe75c42ccb97d22438c.tar.gz |
Sync hook with archzfs
-rw-r--r-- | .SRCINFO | 6 | ||||
-rw-r--r-- | PKGBUILD | 6 | ||||
-rw-r--r-- | plymouth-zfs.initcpio.hook | 28 |
3 files changed, 25 insertions, 15 deletions
@@ -1,7 +1,7 @@ pkgbase = plymouth-zfs pkgdesc = initcpio hook to support native zfs encryption for plymouth - pkgver = 1 - pkgrel = 5 + pkgver = 2 + pkgrel = 1 install = plymouth-zfs.install arch = any license = MIT @@ -14,7 +14,7 @@ pkgbase = plymouth-zfs source = plymouth-zfs.initcpio.hook source = plymouth-zfs.initcpio.install source = plymouth-zfs.install - sha256sums = 01818d81516ccded400b313af6bd0f8a83f27cad622de36517d6cc7413bcd7ac + sha256sums = 4fc0eb84fbd8a62babbd1f85a5db7d467eb1c4178218a40a98853a62f1135176 sha256sums = 830d5231b079d83860db7e7d63839e1ec7e163311ae7e9dcd46a8358fabaf9ad sha256sums = 0910896056921ebedc1eb910d38b64d8815790f042cb3e9bc07a1a49e31e3b2b @@ -1,8 +1,8 @@ # Maintainer: Jan Houben <jan@nexttrex.de> pkgname=plymouth-zfs -pkgver=1 -pkgrel=5 +pkgver=2 +pkgrel=1 pkgdesc="initcpio hook to support native zfs encryption for plymouth" arch=('any') license=('MIT') @@ -16,7 +16,7 @@ install=plymouth-zfs.install source=("plymouth-zfs.initcpio.hook" "plymouth-zfs.initcpio.install" "plymouth-zfs.install") -sha256sums=('01818d81516ccded400b313af6bd0f8a83f27cad622de36517d6cc7413bcd7ac' +sha256sums=('4fc0eb84fbd8a62babbd1f85a5db7d467eb1c4178218a40a98853a62f1135176' '830d5231b079d83860db7e7d63839e1ec7e163311ae7e9dcd46a8358fabaf9ad' '0910896056921ebedc1eb910d38b64d8815790f042cb3e9bc07a1a49e31e3b2b') diff --git a/plymouth-zfs.initcpio.hook b/plymouth-zfs.initcpio.hook index e5afc140d368..49c632f9eaca 100644 --- a/plymouth-zfs.initcpio.hook +++ b/plymouth-zfs.initcpio.hook @@ -27,19 +27,19 @@ zfs_get_bootfs () { zfs_decrypt_fs() { dataset=$1 - + # check if 'zfs load-key' is available zfs 2>&1 | grep load-key > /dev/null || return 0 - + # check if dataset is encrypted [ "$(zfs get -H -o value encryption "${dataset}")" != "off" ] || return 0 - - # get the encryption root - encryptionroot=$(zfs get -H -o value encryptionroot "${dataset}") - + # check if key is already loaded [ "$(zfs get -H -o value keystatus "${dataset}")" != "available" ] || return 0 + # get the encryption root + encryptionroot=$(zfs get -H -o value encryptionroot "${dataset}") + # finally load the key plymouth ask-for-password --prompt="Password for ${dataset} dataset" --dont-pause-progress --number-of-tries=5 --command="zfs load-key ${encryptionroot}" @@ -75,6 +75,7 @@ zfs_mount_handler () { fi local node="$1" + local rootmnt=$(zfs get -H -o value mountpoint "${ZFS_DATASET}") local tab_file="${node}/etc/fstab" local zfs_datasets="$(zfs list -H -o name -t filesystem -r ${ZFS_DATASET})" @@ -90,7 +91,6 @@ zfs_mount_handler () { 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}") - zfs_decrypt_fs "${dataset}" mount -t zfs -o "${opt}" "${dataset}" "${node}${mnt}" fi @@ -98,7 +98,7 @@ zfs_mount_handler () { ;; *) zfs_decrypt_fs "${dataset}" - mount -t zfs -o "zfsutil,${rwopt_exp}" "${dataset}" "${node}${mountpoint}" + mount -t zfs -o "zfsutil,${rwopt_exp}" "${dataset}" "${node}/${mountpoint##${rootmnt}}" ;; esac done @@ -114,7 +114,17 @@ run_hook() { # 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 ${root} in + # root=zfs + "zfs") + mount_handler="zfs_mount_handler" + ;; + # root=ZFS=... syntax (grub) + "ZFS="*) + mount_handler="zfs_mount_handler" + ZFS_DATASET="${root#*[=]}" + ;; + esac case ${zfs} in "") |