Skip to content

Commit

Permalink
Better non-interactive option
Browse files Browse the repository at this point in the history
  • Loading branch information
rbamos committed Jul 12, 2024
1 parent 2884bf9 commit 3ca41f3
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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')"
Expand Down

0 comments on commit 3ca41f3

Please sign in to comment.