+###############################################################################
+# Options and arguments
+
+params="$(getopt -o suhb: -l install-so,install-ui,build-ui:,help --name "$0" -- "$@")"
+if [ $? != 0 ] ; then echo "Failed parsing options." >&2 ; exit 1 ; fi
+
+eval set -- $params
+
+installSO=false
+installUI=false
+UIPathToBuild=
+
+while true; do
+ case "$1" in
+ -s|--install-so) installSO=true; shift;;
+ -u|--install-ui) installUI=true; shift;;
+ -b|--build-ui) shift; UIPathToBuild=$1; shift;;
+ -h|--help)
+ echo
+ echo "NAME:"
+ echo " $0"
+ echo
+ echo "SYNOPSIS:"
+ echo " $0 -h|--help"
+ echo " $0 [-s] [-u|-b PATH-TO-UI-REPO] [PLATFORM_REPOSITORY] [PLATFORM_VERSION]"
+ echo
+ echo "DESCRIPTION:"
+ echo " Prepare current system to run SO and UI. By default, the system"
+ echo " is set up to support building SO and UI; optionally, either or"
+ echo " both SO and UI can be installed from a Debian package repository."
+ echo
+ echo " -s|--install-so: install SO from package"
+ echo " -u|--install-ui: install UI from package"
+ echo " -b|--build-ui PATH-TO-UI-REPO: build the UI in the specified repo"
+ echo " PLATFORM_REPOSITORY (optional): name of the RIFT.ware repository."
+ echo " PLATFORM_VERSION (optional): version of the platform packages to be installed."
+ echo
+ exit 0;;
+ --) shift; break;;
+ *) echo "Not implemented: $1" >&2; exit 1;;
+ esac
+done
+
+if $installUI && [[ $UIPathToBuild ]]; then
+ echo "Cannot both install and build the UI!"
+ exit 1
+fi