If $ZFS_BOOTFS contains guid, replace the guid portion with $pool

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Richard Laager <rlaager@wiktel.com>
Signed-off-by: Garrett Fields <ghfields@gmail.com>
Closes #8356
This commit is contained in:
Garrett Fields 2019-06-06 16:04:35 -04:00 committed by Brian Behlendorf
parent 3ce85b5e60
commit 627f5117a3
1 changed files with 3 additions and 1 deletions

View File

@ -878,7 +878,9 @@ mountroot()
pool="$("${ZPOOL}" get name,guid -o name,value -H | \
awk -v pool="${ZFS_RPOOL}" '$2 == pool { print $1 }')"
if [ -n "$pool" ]; then
ZFS_BOOTFS="${pool}/${ZFS_BOOTFS#*/}"
# If $ZFS_BOOTFS contains guid, replace the guid portion with $pool
ZFS_BOOTFS=$(echo "$ZFS_BOOTFS" | \
sed -e "s/$("${ZPOOL}" get guid -o value "$pool" -H)/$pool/g")
ZFS_RPOOL="${pool}"
fi