From c082c32de0da35425c3fee87b77c44e75f41ff28 Mon Sep 17 00:00:00 2001 From: Nicholas D Steeves Date: Wed, 20 Jan 2021 03:23:32 -0500 Subject: [PATCH] import fixes from Kali's method --- mount.d/btrfs | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/mount.d/btrfs b/mount.d/btrfs index 28332b1..3ced36c 100755 --- a/mount.d/btrfs +++ b/mount.d/btrfs @@ -11,14 +11,19 @@ pass=$6 case $type in btrfs) - if [ "$mp" = "/" ]; then - mount -t btrfs ${options:+-o "$options"} $fs /target/ || exit 1 - btrfs subvolume create /target/@rootfs || exit 1 - umount /target || exit 1 - mount -t btrfs ${options:+-o "$options,subvol=@rootfs"} $fs /target || exit 1 - else - mount -t btrfs ${options:+-o "$options"} $fs /target"$mp" || exit 1 - fi + # import workaround from Kali's partman-btrfs commit:7f43d2c + options="${options%,subvol=*}" + #for removing the option subvol,when thats the only option + #eg: options=="subvol=@", no comma present + options="${options%subvol=*}" + mount -t btrfs ${options:+-o "$options"} $fs /target"$mp" || exit 1 + if [ $mp = / ]; then + btrfs subvolume create /target$mp/@rootfs + chmod 755 /target$mp/@rootfs + umount /target$mp + options="${options:+$options,}subvol=@rootfs" + mount -t btrfs -o $options $fs /target$mp + fi echo "umount /target$mp" exit 0 ;;