Skip to content
This repository has been archived by the owner on Dec 17, 2024. It is now read-only.

Commit

Permalink
build: move all user prompts to secondary install scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
spwoodcock committed Apr 28, 2024
1 parent 0c9cb36 commit f7ccbc4
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 29 deletions.
36 changes: 7 additions & 29 deletions docs/get-installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -62,5 +40,5 @@ TEMP_DIR=$(mktemp -d)
cd "${TEMP_DIR}" || exit 1

download_utils
check_docker
install_docker
install_sandbox
27 changes: 27 additions & 0 deletions docs/install-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit f7ccbc4

Please sign in to comment.