. /usr/share/initramfs-tools/hook-functions
# get_fs_devices() - determine source device(s) of mount point from /etc/fstab
# * fstab mount point (full path)
# This function searches for the first entry from /etc/fstab which has the
# given mountpoint set. It returns the canonical_device() of corresponding
# source device (first field in /etc/fstab entry).
# In case of btrfs, canoncial_device() of all btrfs source devices (possibly
# more than one) are returned.
local device mount type options dump pass
if [ ! -r /etc/fstab ]; then
grep -s '^[^#]' /etc/fstab | \
while read device mount type options dump pass; do
if [ "$mount" = "$wantmount" ]; then
if [ "$type" = "btrfs" ]; then
for dev in $(btrfs filesystem show $(canonical_device "$device" --no-simplify) 2>/dev/null | sed -r -e 's/.*devid .+ path (.+)/\1/;tx;d;:x') ; do