#!/bin/bash
#
#	This is the entry-level script for Voyage configuration.
#	It prompts the user to determine whether this is a new
#	installation, or an update to an existing system.
#

# by default export all variables
set -a

# remember the current dir for future use and get the path to
# the directory where this script is located
RUNDIR=$PWD
cd `dirname $0`
EXECDIR=$PWD
cd $RUNDIR

# load the script containing our utility routines
source $EXECDIR/script-utils.sh
# select-profile is a separate script but usually needed
source $EXECDIR/select-profile.sh

case "$1" in
	-i) v=1
		shift
		;;
	-u) v=2
		shift
		;;
	*) # now ask what the user wants to do
		OPTIONS="1:Create new Voyage Linux disk:%2:Update existing Voyage configuration:%3:Exit:"
		ask_setting "What would you like to do?" "$OPTIONS" 1
		;;
esac

case $v in
	1) $EXECDIR/voyage-install.sh "$@";;
	2) $EXECDIR/voyage-update.sh;;
	*) err_quit "No action taken";;
esac
