added sanity checks in autoprepare

This commit is contained in:
Tobias Powalowski 2010-04-16 07:31:29 +02:00
parent 736f6b1cf7
commit 55bfa66f74

View file

@ -1418,8 +1418,10 @@ autoprepare() {
fi
done
DISC_SIZE=$(($DISC_SIZE-$BOOT_PART_SIZE))
SWAP_SIZE="256"
[ "$DISC_SIZE" -lt "256" ] && SWAP_SIZE="$DISC_SIZE"
while [ "$SWAP_PART_SET" = "" ]; do
DIALOG --inputbox "Enter the size (MB) of your swap partition,\nMinimum value is > 0.\n\nDisk space left: $DISC_SIZE MB" 10 65 "256" 2>$ANSWER || return 1
DIALOG --inputbox "Enter the size (MB) of your swap partition,\nMinimum value is > 0.\n\nDisk space left: $DISC_SIZE MB" 10 65 "$SWAP_SIZE" 2>$ANSWER || return 1
SWAP_PART_SIZE=$(cat $ANSWER)
if [ "$SWAP_PART_SIZE" = "" -o "$SWAP_PART_SIZE" = "0" ]; then
DIALOG --msgbox "ERROR: You have entered an invalid size, please enter again." 0 0
@ -1432,8 +1434,10 @@ autoprepare() {
fi
done
DISC_SIZE=$(($DISC_SIZE-$SWAP_PART_SIZE))
ROOT_SIZE="7500"
[ "$DISC_SIZE" -lt "7500" ] && ROOT_SIZE="$DISC_SIZE"
while [ "$ROOT_PART_SET" = "" ]; do
DIALOG --inputbox "Enter the size (MB) of your / partition,\nthe /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 (MB) of your / partition,\nthe /home partition will use the remaining space.\n\nDisk space left: $DISC_SIZE MB" 10 65 "$ROOT_SIZE" 2>$ANSWER || return 1
ROOT_PART_SIZE=$(cat $ANSWER)
if [ "$ROOT_PART_SIZE" = "" -o "$ROOT_PART_SIZE" = "0" ]; then
DIALOG --msgbox "ERROR: You have entered an invalid size, please enter again." 0 0