support LUKS in shell libraries
This commit is contained in:
parent
9d647e4e18
commit
8306591ff3
3 changed files with 28 additions and 1 deletions
|
@ -456,6 +456,8 @@ for dir in "${localedir}"/*; do
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
is_path_readable_by_grub "${grubdir}" || (echo "${grubdir}" not readable 1>&2 ; exit 1)
|
||||||
|
|
||||||
# Write device to a variable so we don't have to traverse /dev every time.
|
# Write device to a variable so we don't have to traverse /dev every time.
|
||||||
grub_device="`"$grub_probe" --device-map="${device_map}" --target=device "${grubdir}"`" || exit 1
|
grub_device="`"$grub_probe" --device-map="${device_map}" --target=device "${grubdir}"`" || exit 1
|
||||||
|
|
||||||
|
@ -536,6 +538,12 @@ if [ "x${devabstraction_module}" = "x" ] ; then
|
||||||
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
if [ x$GRUB_LUKS_ENABLE = xy ]; then
|
||||||
|
for uuid in "`"${grub_probe}" --device "${device}" --target=luks_uuid`"; do
|
||||||
|
echo "luksmount -u $uuid"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
echo "search.fs_uuid ${uuid} root " >> "${grubdir}/load.cfg"
|
echo "search.fs_uuid ${uuid} root " >> "${grubdir}/load.cfg"
|
||||||
echo 'set prefix=($root)'"${relative_grubdir}" >> "${grubdir}/load.cfg"
|
echo 'set prefix=($root)'"${relative_grubdir}" >> "${grubdir}/load.cfg"
|
||||||
config_opt="-c ${grubdir}/load.cfg "
|
config_opt="-c ${grubdir}/load.cfg "
|
||||||
|
|
|
@ -254,6 +254,7 @@ export GRUB_DEFAULT \
|
||||||
GRUB_DISABLE_OS_PROBER \
|
GRUB_DISABLE_OS_PROBER \
|
||||||
GRUB_INIT_TUNE \
|
GRUB_INIT_TUNE \
|
||||||
GRUB_SAVEDEFAULT \
|
GRUB_SAVEDEFAULT \
|
||||||
|
GRUB_ENABLE_LUKS \
|
||||||
GRUB_BADRAM
|
GRUB_BADRAM
|
||||||
|
|
||||||
if test "x${grub_cfg}" != "x"; then
|
if test "x${grub_cfg}" != "x"; then
|
||||||
|
|
|
@ -63,10 +63,22 @@ is_path_readable_by_grub ()
|
||||||
|
|
||||||
# ... or if we can't figure out the abstraction module, for example if
|
# ... or if we can't figure out the abstraction module, for example if
|
||||||
# memberlist fails on an LVM volume group.
|
# memberlist fails on an LVM volume group.
|
||||||
if ${grub_probe} -t abstraction $path > /dev/null 2>&1 ; then : ; else
|
if abstractions="`"${grub_probe}" -t abstraction "$path"`" 2>&1 ; then
|
||||||
|
:
|
||||||
|
else
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ x$GRUB_LUKS_ENABLE = xy ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
for abstraction in $abstractions; do
|
||||||
|
if [ "x$abstraction" = xluks ]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,6 +138,12 @@ prepare_grub_to_access_device ()
|
||||||
echo "insmod ${module}"
|
echo "insmod ${module}"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ x$GRUB_LUKS_ENABLE = xy ]; then
|
||||||
|
for uuid in "`"${grub_probe}" --device "${device}" --target=luks_uuid`"; do
|
||||||
|
echo "luksmount -u $uuid"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
# If there's a filesystem UUID that GRUB is capable of identifying, use it;
|
# If there's a filesystem UUID that GRUB is capable of identifying, use it;
|
||||||
# otherwise set root as per value in device.map.
|
# otherwise set root as per value in device.map.
|
||||||
echo "set root='`"${grub_probe}" --device "${device}" --target=drive`'"
|
echo "set root='`"${grub_probe}" --device "${device}" --target=drive`'"
|
||||||
|
|
Loading…
Add table
Reference in a new issue