From 92d351ce6420029f13422b8285da3b4fc8dcc621 Mon Sep 17 00:00:00 2001 From: Tobias Powalowski Date: Sun, 20 Jun 2010 22:18:53 +0200 Subject: [PATCH] start subvolume btrfs support --- usr/share/archboot/installer/setup | 35 +++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/usr/share/archboot/installer/setup b/usr/share/archboot/installer/setup index 7ac231734..b073cc9c6 100755 --- a/usr/share/archboot/installer/setup +++ b/usr/share/archboot/installer/setup @@ -1937,7 +1937,36 @@ select_btrfs_raid_devices () { } btrfs_scan() { - btrfs device scan + btrfs device scan >/dev/null 2>&1 +} + +# check btrfs subvolume +check_btrfs_subvolume(){ + btrfs_scan + BTRFSMP="$(mktemp -d /tmp/brtfsmp.XXXX)" + mount $PART $BTRFSMP + for i in $(btrfs subvolume list $BTRFSMP | cut -d " " -f 7); do + if [ "$(echo $i | grep "$BTRFS_SUBVOLUME"$)" ]; then + DIALOG --msgbox "ERROR: You have defined 2 identical SUBVOLUME names! Please enter another name." 8 65 + BTRFS_SUBVOLUME="" + fi + done + umount $BTRFSMP + rm -r $BTRFSMP +} + +create_btrfs_subvolume() { + BTRFS_SUBVOLUME="" + DIALOG --yesno "Would you like to create a subvolume on $PART?" 0 0 && DOSUBVOLUME="yes" + if [ "$DOSUBVOLUME" = "yes" ]; then + while [ "${BTRFS_SUBVOLUME}" = "" ]; do + DIALOG --inputbox "Enter the SUBVOLUME name for the device, keep it short\nand use no spaces or special\ncharacters." 10 65 2>$ANSWER || return 1 + BTRFS_SUBVOLUME=$(cat $ANSWER) + check_btrfs_subvolume + done + else + BTRFS_SUBVOLUME="NONE" + fi } # find btrfs subvolume @@ -1956,10 +1985,6 @@ choose_btrfs_subvolume () { echo "dummy function" } -create_btrfs_subvolume() { - echo "dummy function" -} - prepare_btrfs() { btrfs_raid_level #create_btrfs_subvolume