diff --git a/docs/get-installer.sh b/docs/get-installer.sh index f8feed1..202c2a0 100644 --- a/docs/get-installer.sh +++ b/docs/get-installer.sh @@ -17,36 +17,14 @@ download_utils() { --location https://get.sandbox.hotosm.dev/utils.sh \ --output utils.sh 2>&1 chmod +x utils.sh - . utils.sh } -check_docker() { - heading_echo "Docker Install" - - if command -v docker &> /dev/null; then - echo "Docker already installed: $(which docker)" - echo "Skipping." - return 0 - fi - - echo "Docker must be installed for this tool to work." - echo - echo "Do you want to install Docker? (y/n)" - echo - read -rp "Enter 'y' to install, anything else to continue: " install_docker - - if [[ "$install_docker" = "y" || "$install_docker" = "yes" ]]; then - curl --proto '=https' --tlsv1.2 --silent --show-error --fail \ - --location https://get.sandbox.hotosm.dev/install-docker.sh \ - --output install-docker.sh 2>&1 - chmod +x install-docker.sh - bash install-docker.sh - else - echo - red_echo "Docker is required. Aborting." - echo - exit 1 - fi +install_docker() { + curl --proto '=https' --tlsv1.2 --silent --show-error --fail \ + --location https://get.sandbox.hotosm.dev/install-docker.sh \ + --output install-docker.sh 2>&1 + chmod +x install-docker.sh + bash install-docker.sh } install_sandbox() { @@ -62,5 +40,5 @@ TEMP_DIR=$(mktemp -d) cd "${TEMP_DIR}" || exit 1 download_utils -check_docker +install_docker install_sandbox diff --git a/docs/install-docker.sh b/docs/install-docker.sh index d5b4dbc..d7ba0b0 100644 --- a/docs/install-docker.sh +++ b/docs/install-docker.sh @@ -316,3 +316,30 @@ install_docker() { yellow_echo "Enable login linger for user $(whoami) (docker daemon on ssh disconnect)." loginctl enable-linger "$(whoami)" } + +prompt_user() { + heading_echo "Docker Install" + + if command -v docker &> /dev/null; then + echo "Docker already installed: $(which docker)" + echo "Skipping." + return 0 + fi + + echo "Docker must be installed for this tool to work." + echo + echo "Do you want to install Docker? (y/n)" + echo + read -rp "Enter 'y' to install, anything else to continue: " install + + if [[ "$install" = "y" || "$install" = "yes" ]]; then + install_docker + else + echo + red_echo "Docker is required. Aborting." + echo + exit 1 + fi +} + +prompt_user