#!/bin/sh

vdir=$(dirname $0)
. $vdir/setup-functions

VERSION=".0"
HD_SWAP="256"
HD_ROOT="2000"
HD_HOME="1000"

# Get settings if available
if [ -f ../etc/setup.conf ]; then
 . ../etc/setup.conf
fi

menuA()
{
while [ 0 ]; do

BACKTITLE="Vector Linux Install : Main"
TITLE="VECTOR LINUX INSTALL"
DIMENSION="21 76 5"
TEXT="\n
Welcome to $NAME version $VERSION installation.\n
We promise you a quick and easy install process. 
However, you have to prepare the following
Linux partitions on your harddisk:\n
- A swap for virtual memory      : $HD_SWAP MB.\n
- A root for system and programs : $HD_ROOT MB minimal.\n
- A home for your data           : $HD_HOME MB or more.\n\n
If you have these partitions already, let's go straight to\n
the INSTALL menu. Otherwise choose RESIZE or FDISK menu."

$DCMD --backtitle "$BACKTITLE" --title "$TITLE" --no-cancel \
--menu "$TEXT" $DIMENSION \
"KEYMAP" "Change keymap first if your keyboard is not US-layout" \
"RESIZE" "Claim some space from a Windows partition for Linux" \
"FDISK"  "Launch fdisk utility to make Linux partitions" \
"INSTALL" "Bring it on ..., I can't wait" \
"EXIT"    "Exit this setup program. You will be on your own !" \
2> $freply

status=$?
[ $status == 1 ] && return 1
[ $status != 0 ] && continue

reply=$(cat $freply)

dbug "reply=$reply"
case $reply in
  KEYMAP)
     $vdir/setup-kmapset
     ;;
  RESIZE)
     $vdir/setup-resize $HD_SWAP $HD_ROOT $HD_HOME
     ;;
  FDISK)
     $vdir/setup-fdisk $HD_SWAP $HD_ROOT $HD_HOME
     ;;
  INSTALL)
     $vdir/setup-install $HD_SWAP $HD_ROOT $HD_HOME
     ;;
  EXIT)
     return 1
     ;;
esac
[ $? == 1 ] && return 1
done

}

###################################################################################
# MAIN 

menuA

clear
echo -e "${LTRED}OK you wanna quit already so be it.....${OFF}"
echo "If you get disoriented or give up, press Ctrl-Alt-Del."
echo "but if you want me back, call $0"

clean_exit 1
