From 3ca41f352134444fd64773b9f22e8130ceea5288 Mon Sep 17 00:00:00 2001 From: Ryan Amos <49767442+rbamos@users.noreply.github.com> Date: Fri, 12 Jul 2024 10:10:00 -0400 Subject: [PATCH] Better non-interactive option --- setup.sh | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/setup.sh b/setup.sh index 3ec2445..dd1f210 100755 --- a/setup.sh +++ b/setup.sh @@ -1,4 +1,8 @@ #!/bin/bash +# Arguments as environment variables: +# CONFIGURE: 0 to skip configuration, unset or other value will ask for input +# INTEGRATION_PORTAL_URL: See https://panoramaed.atlassian.net/wiki/spaces/ENG/pages/2847113303/Leapp +# LEAPP_ROLES: See https://panoramaed.atlassian.net/wiki/spaces/ENG/pages/2847113303/Leapp # xcode command line tools installation will hang on OS versions lower than this MIN_OS_VERSION="12.4.0" @@ -26,12 +30,12 @@ if [[ "$kernel_name" == 'Darwin' ]]; then fi -if [[ -z "${INTEGRATION_PORTAL_URL}" ]]; then +if [[ "${CONFIGURE}" != "0" ]] && [[ -z "${INTEGRATION_PORTAL_URL}" ]]; then red_echo "INTEGRATION_PORTAL_URL must be provided" exit fi -if [[ -z "${LEAPP_ROLES}" ]]; then +if [[ "${CONFIGURE}" != "0" ]] && [[ -z "${LEAPP_ROLES}" ]]; then red_echo "LEAPP_ROLES must be provided" exit fi @@ -120,21 +124,10 @@ else [[ "$kernel_name" == "Linux" ]] # brew install Noovolari/brew/leapp-cli fi -# If NON_INTERACTIVE = 1, exit the script -if [[ "${NON_INTERACTIVE}" -eq 1 ]]; then +if [[ "${CONFIGURE}" == "0" ]]; then exit fi -# Check if the user wants to continue -while true; do - read -p "Leapp has been installed. This script will now configure Leapp. Do you wish to continue? [Yes / No] " yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done - # If the config.sh file is not present, download & run it if [[ ! -e "config.sh" ]]; then eval "$(curl -Ls 'https://raw.githubusercontent.com/panorama-ed/leapp-setup/main/config.sh')"