This effectively makes the installer pass correct values to sfdisk during automatic partition preparation (sfdisk expects MiB, not MB) Signed-off-by: Evangelos Foutras <foutrelis@gmail.com> --- setup | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-) diff --git a/setup b/setup index 6f119c6..82f5687 100755 --- a/setup +++ b/setup @@ -348,13 +348,13 @@ _getdisccapacity() # Get a list of available disks for use in the "Available disks" dialogs. This # will print the disks as follows, getting size info from _getdisccapacity(): -# /dev/sda: 640133 MBytes (640 GB) -# /dev/sdb: 640135 MBytes (640 GB) +# /dev/sda: 625000 MiB (610 GiB) +# /dev/sdb: 476940 MiB (465 GiB) _getavaildisks() { for DISC in $(finddisks); do DISC_SIZE=$(_getdisccapacity $DISC) - echo "$DISC: $((DISC_SIZE / 10**6)) MBytes ($((DISC_SIZE / 10**9)) GB)\n" + echo "$DISC: $((DISC_SIZE / 2**20)) MiB ($((DISC_SIZE / 2**30)) GiB)\n" done } @@ -373,15 +373,15 @@ autoprepare() SWAP_PART_SET="" ROOT_PART_SET="" CHOSEN_FS="" - # disk size in MB - DISC_SIZE=$(($(_getdisccapacity $DISC) / 10**6)) + # disk size in MiB + DISC_SIZE=$(($(_getdisccapacity $DISC) / 2**20)) while [ "$SET_DEFAULTFS" = "" ]; do FSOPTS="ext2 ext2 ext3 ext3 ext4 ext4" [ "$(which mkreiserfs 2>/dev/null)" ] && FSOPTS="$FSOPTS reiserfs Reiser3" [ "$(which mkfs.xfs 2>/dev/null)" ] && FSOPTS="$FSOPTS xfs XFS" [ "$(which mkfs.jfs 2>/dev/null)" ] && FSOPTS="$FSOPTS jfs JFS" while [ "$BOOT_PART_SET" = "" ]; do - DIALOG --inputbox "Enter the size (MB) of your /boot partition. Minimum value is 16.\n\nDisk space left: $DISC_SIZE MB" 10 65 "32" 2>$ANSWER || return 1 + DIALOG --inputbox "Enter the size (MiB) of your /boot partition. Minimum value is 16.\n\nDisk space left: $DISC_SIZE MiB" 10 65 "32" 2>$ANSWER || return 1 BOOT_PART_SIZE="$(cat $ANSWER)" if [ "$BOOT_PART_SIZE" = "" ]; then DIALOG --msgbox "ERROR: You have entered an invalid size, please enter again." 0 0 @@ -395,7 +395,7 @@ autoprepare() done DISC_SIZE=$(($DISC_SIZE-$BOOT_PART_SIZE)) while [ "$SWAP_PART_SET" = "" ]; do - DIALOG --inputbox "Enter the size (MB) of your swap partition. Minimum value is > 0.\n\nDisk space left: $DISC_SIZE MB" 10 65 "256" 2>$ANSWER || return 1 + DIALOG --inputbox "Enter the size (MiB) of your swap partition. Minimum value is > 0.\n\nDisk space left: $DISC_SIZE MiB" 10 65 "256" 2>$ANSWER || return 1 SWAP_PART_SIZE=$(cat $ANSWER) if [ "$SWAP_PART_SIZE" = "" -o "$SWAP_PART_SIZE" -le "0" ]; then DIALOG --msgbox "ERROR: You have entered an invalid size, please enter again." 0 0 @@ -409,7 +409,7 @@ autoprepare() done DISC_SIZE=$(($DISC_SIZE-$SWAP_PART_SIZE)) while [ "$ROOT_PART_SET" = "" ]; do - DIALOG --inputbox "Enter the size (MB) of your / partition. The /home partition will use the remaining space.\n\nDisk space left: $DISC_SIZE MB" 10 65 "7500" 2>$ANSWER || return 1 + DIALOG --inputbox "Enter the size (MiB) of your / partition. The /home partition will use the remaining space.\n\nDisk space left: $DISC_SIZE MiB" 10 65 "7500" 2>$ANSWER || return 1 ROOT_PART_SIZE=$(cat $ANSWER) if [ "$ROOT_PART_SIZE" = "" -o "$ROOT_PART_SIZE" -le "0" ]; then DIALOG --msgbox "ERROR: You have entered an invalid size, please enter again." 0 0 @@ -417,7 +417,7 @@ autoprepare() if [ "$ROOT_PART_SIZE" -ge "$DISC_SIZE" ]; then DIALOG --msgbox "ERROR: You have entered a too large size, please enter again." 0 0 else - DIALOG --yesno "$(($DISC_SIZE-$ROOT_PART_SIZE)) MB will be used for your /home partition. Is this OK?" 0 0 && ROOT_PART_SET=1 + DIALOG --yesno "$(($DISC_SIZE-$ROOT_PART_SIZE)) MiB will be used for your /home partition. Is this OK?" 0 0 && ROOT_PART_SET=1 fi fi done -- 1.6.1.1