mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-17 18:11:00 +03:00
Use %%/* instead of awk -F/ {print $1} to strip datasets
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #12108
This commit is contained in:
parent
2dde9202d9
commit
11b165cc9b
@ -58,7 +58,7 @@ ZFS_POOL="${ZFS_DATASET%%/*}"
|
||||
|
||||
if import_pool "${ZFS_POOL}" ; then
|
||||
# Load keys if we can or if we need to
|
||||
if [ "$(zpool list -H -o feature@encryption "$(echo "${ZFS_POOL}" | awk -F/ '{print $1}')")" = 'active' ]; then
|
||||
if [ "$(zpool list -H -o feature@encryption "${ZFS_POOL}")" = 'active' ]; then
|
||||
# if the root dataset has encryption enabled
|
||||
ENCRYPTIONROOT="$(zfs get -H -o value encryptionroot "${ZFS_DATASET}")"
|
||||
if ! [ "${ENCRYPTIONROOT}" = "-" ]; then
|
||||
|
@ -33,7 +33,7 @@ else
|
||||
fi
|
||||
|
||||
# if pool encryption is active and the zfs command understands '-o encryption'
|
||||
if [ "$(zpool list -H -o feature@encryption "$(echo "${BOOTFS}" | awk -F/ '{print $1}')")" = 'active' ]; then
|
||||
if [ "$(zpool list -H -o feature@encryption "${BOOTFS%%/*}")" = 'active' ]; then
|
||||
# if the root dataset has encryption enabled
|
||||
ENCRYPTIONROOT="$(zfs get -H -o value encryptionroot "${BOOTFS}")"
|
||||
if ! [ "${ENCRYPTIONROOT}" = "-" ]; then
|
||||
|
@ -390,7 +390,7 @@ decrypt_fs()
|
||||
fs="$1"
|
||||
|
||||
# If pool encryption is active and the zfs command understands '-o encryption'
|
||||
if [ "$(zpool list -H -o feature@encryption "$(echo "${fs}" | awk -F/ '{print $1}')")" = 'active' ]; then
|
||||
if [ "$(zpool list -H -o feature@encryption "${fs%%/*}")" = 'active' ]; then
|
||||
|
||||
# Determine dataset that holds key for root dataset
|
||||
ENCRYPTIONROOT="$(get_fs_value "${fs}" encryptionroot)"
|
||||
|
Loading…
Reference in New Issue
Block a user