Skip to content

Commit

Permalink
Make keylocation of target match that of source in duplicate_snapshot
Browse files Browse the repository at this point in the history
Co-authored-by: Zach Dykstra <dykstra.zachary@gmail.com>
Co-authored-by: Andrew J. Hesford <ajh@sideband.org>
  • Loading branch information
zdykstra and ahesford committed Oct 25, 2021
1 parent 48e6bcc commit 357aa5e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions 90zfsbootmenu/zfsbootmenu-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,7 @@ kexec_kernel() {

duplicate_snapshot() {
local selected target target_parent pool recv_args
local encroot keylocation

selected="${1}"
if [ -z "$selected" ]; then
Expand Down Expand Up @@ -826,6 +827,13 @@ duplicate_snapshot() {

recv_args=( "-u" "-o" "canmount=noauto" "-o" "mountpoint=/" "${target}" )

if encroot="$( be_has_encroot "${selected}" )" ; then
keylocation="$( zfs get -H -o value keylocation "${encroot}" 2>/dev/null )"
if [ -n "${keylocation}" ] && [ "${keylocation}" != "-" ]; then
recv_args+=( "-o" "keylocation=${keylocation}" )
fi
fi

(
trap 'exit 0' SIGINT
if command -v mbuffer >/dev/null 2>&1; then
Expand Down

0 comments on commit 357aa5e

Please sign in to comment.