+mount -o subvolid=0 $crypt /mnt
+# systemd creates subvolumes we want to delete.
+s=($(btrfs subvolume list --sort=-path /mnt |
+ sed -rn "s#^.*path\s*(root_$DISTRO/\S+)\s*\$#\1#p"))
+for subvol in ${s[@]}; do btrfs subvolume delete /mnt/$subvol; done
+btrfs subvolume set-default 0 /mnt
+[[ ! -e /mnt/root_$DISTRO ]] || btrfs subvolume delete /mnt/root_$DISTRO
+
+
+## create subvols ##
+cd /mnt
+for x in q home_$DISTRO root_$DISTRO; do
+ btrfs subvolume list . | grep "$x$" >/dev/null || btrfs subvolume create $x
+done
+for x in root/a q/a; do
+ mkdir -p $x
+ chown 1000:1000 $x
+ chmod 755 $x
+done
+btrfs subvolume set-default \
+ $(btrfs subvolume list . | grep "root_$DISTRO$" | awk '{print $2}') .
+chattr -Rf +C root
+cd /
+umount /mnt
+mount $first_boot_dev /mnt
+cd /mnt
+[[ ! -e /mnt/boot_$DISTRO ]] || btrfs subvolume delete /mnt/boot_$DISTRO
+btrfs subvolume create boot_$DISTRO
+btrfs subvolume set-default \
+ $(btrfs subvolume list . | grep "boot_$DISTRO$" | awk '{print $2}') .
+cd /
+umount /mnt
+## end create subvols ##
+