diff --git a/setup.sh b/setup.sh index 230eccb..89291ea 100755 --- a/setup.sh +++ b/setup.sh @@ -3,41 +3,75 @@ # Author : NTT Data AG # Date : 11-05-2023 -show_help() { - echo "Usage: $0 [-m ] [-a ]" - echo "Options:" - echo " -m Install helm" - echo " -a Specify the app name" -} - helm_install=false app_name="" -while getopts "hm:a:" option; do - case $option in - h) +# fetch helm resources +# docs: https://helm.sh/docs/intro/install/ +install_helm () { + curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 + chmod 700 get_helm.sh + ./get_helm.sh +} + +show_help() { + cat < Specify the app name +EOF +} + +while [ "$#" -gt 0 ]; do + case "$1" in + -h|--help) show_help exit 0 ;; - m) - helm_install="$OPTARG" + -m|--helm) + helm_install=true + shift ;; - a) - app_name="$OPTARG" + -a|--app) + if [ "$2" ]; then + app_name="$2" + shift 2 + else + echo "Error: Missing argument for $1 option" + show_help + exit 1 + fi ;; *) + echo "Error: Unrecognized option $1" show_help exit 1 ;; esac done -if [ "$helm_install" = "true" ]; then +# Check if --helm was set +if [ "$helm_install" = true ]; then echo "Installing helm" + # install_helm +else + echo "Skipping helm" fi +# Validate app names if [ -z "$app_name" ]; then echo "Please specify app" else - echo "Installing $app_name" + case $app_name in + "socks_shop") + echo "installing sock shop" + ;; + *) + echo "Only following apps allowed" + exit 1 + ;; + esac fi \ No newline at end of file