+ # second field, non-comment line == $d
+ dev=$(sed -rn "s,^\s*([^#]\S*)\s+$d\s.*,\1,p" /etc/fstab /etc/mtab|head -n1)
+ d dev=$dev
+ subvol_dir=$(sed -rn "s,^\s*[^#]\S*\s+$d\s.*\bsubvol=([a-zA-A/]+).*,\1,p" /etc/fstab /etc/mtab|head -n1)
+ d subvol_dir=$subvol_dir
+ # note, we need $dev because $d might not be mounted, and we do this loop
+ # because the device in fstab for the rootfs can be different.
+ for devx in $(btrfs fi show $dev| sed -rn 's#.*path (/\S+)$#\1#p'); do
+ root_dir=$(sed -rn "s,^\s*$devx\s+(\S+).*\bsubvolid=[05]\b.*,\1,p" /etc/mtab|head -n1)
+ if [[ $root_dir ]]; then break; fi
+ done
+ if [[ ! $root_dir ]]; then
+ echo "$0: error could not find root subvol mount for $dev" >&2
+ exit 1
+ fi
+ svp=$root_dir/$subvol_dir
+ d "svp=$svp # subvolume path"
+
+ snaps=($root_dir/btrbk/$subvol_dir.20*) # Assumes we are in the 21st century.