A little setup bulletproofing

This commit is contained in:
Ben Gras 2005-09-13 09:52:15 +00:00
parent 540d299088
commit 169fbb62cf

View File

@ -329,6 +329,13 @@ Please finish the name of the primary partition you have created:
if [ ! -b "/dev/$primary" ] if [ ! -b "/dev/$primary" ]
then echo "/dev/$primary is not a block device." then echo "/dev/$primary is not a block device."
step4="" step4=""
else
devsize="`devsize /dev/$primary`"
if [ "$devsize" -lt 1 ]
then echo "/dev/$primary is a 0-sized device."
step4=""
fi
fi fi
done # while step4 != ok done # while step4 != ok
# end Step 4 # end Step 4
@ -340,17 +347,16 @@ umount /dev/$root 2>/dev/null && echo "Unmounted $root for you."
umount /dev/$home 2>/dev/null && echo "Unmounted $home for you." umount /dev/$home 2>/dev/null && echo "Unmounted $home for you."
umount /dev/$usr 2>/dev/null && echo "Unmounted $usr for you." umount /dev/$usr 2>/dev/null && echo "Unmounted $usr for you."
devsize="`devsize /dev/$primary`"
devsizemb="`expr $devsize / 1024 / 2`" devsizemb="`expr $devsize / 1024 / 2`"
maxhome="`expr $devsizemb - $TOTALMB - 1`" maxhome="`expr $devsizemb - $TOTALMB - 1`"
if [ $devsizemb -lt $TOTALMB ] if [ "$devsizemb" -lt "$TOTALMB" ]
then echo "The selected partition ($devsizemb MB) is too small." then echo "The selected partition ($devsizemb MB) is too small."
echo "You'll need $TOTALMB MB at least." echo "You'll need $TOTALMB MB at least."
exit 1 exit 1
fi fi
if [ $maxhome -lt 1 ] if [ "$maxhome" -lt 1 ]
then echo "Note: you can't have /home with that size partition." then echo "Note: you can't have /home with that size partition."
maxhome=0 maxhome=0
fi fi
@ -400,7 +406,7 @@ echo " --- Step 6: /home configuration ---------------------------------------"
# 20% of what is left over after /home and /usr # 20% of what is left over after /home and /usr
# are taken. # are taken.
defmb="`expr $maxhome / 5`" defmb="`expr $maxhome / 5`"
if [ $defmb -gt $maxhome ] if [ "$defmb" -gt "$maxhome" ]
then then
defmb=$maxhome defmb=$maxhome
fi fi
@ -414,7 +420,7 @@ echo " --- Step 6: /home configuration ---------------------------------------"
then nohome=1 then nohome=1
homesize=0 homesize=0
else else
if [ "`expr $TOTALMB + $homesize`" -gt $devsizemb ] if [ "`expr $TOTALMB + $homesize`" -gt "$devsizemb" ]
then echo "That won't fit!" then echo "That won't fit!"
else else
echo -n "$homesize MB Ok? [Y] " echo -n "$homesize MB Ok? [Y] "