diff --git a/deploy/install.abra.coopcloud.tech/installer b/deploy/install.abra.coopcloud.tech/installer index 02043e0..9aedde4 100755 --- a/deploy/install.abra.coopcloud.tech/installer +++ b/deploy/install.abra.coopcloud.tech/installer @@ -5,6 +5,58 @@ GIT_URL="https://git.autonomic.zone/coop-cloud/abra" ABRA_SRC="$GIT_URL/raw/tag/$ABRA_VERSION/abra" ABRA_DIR="${ABRA_DIR:-$HOME/.abra}" +function prompt_confirm { + read -rp "Continue? [y/N]? " choice + case "$choice" in + y|Y ) return ;; + * ) exit;; + esac +} + +function show_banner { + echo "" + echo " ____ ____ _ _ " + echo " / ___|___ ___ _ __ / ___| | ___ _ _ __| |" + echo " | | / _ \ _____ / _ \| '_ \ | | | |/ _ \| | | |/ _' |" + echo " | |__| (_) |_____| (_) | |_) | | |___| | (_) | |_| | (_| |" + echo " \____\___/ \___/| .__/ \____|_|\___/ \__,_|\__,_|" + echo " |_|" + echo "" +} + +function install_docker { + sudo apt-get remove docker docker-engine docker.io containerd runc + sudo apt-get install \ + apt-transport-https \ + ca-certificates \ + curl \ + gnupg \ + lsb-release + curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg + echo \ + "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \ + $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null + sudo apt-get update + sudo apt-get install docker-ce docker-ce-cli containerd.io +} + +function install_requirements { + if [ -f "/etc/debian_version" ]; then + echo "Installing curl..." + sudo apt install -y curl + + echo "Install Docker (hard requirement)?" + echo "Follows the commands listed in https://docs.docker.com/engine/install/debian/" + prompt_confirm + echo "Installing Docker..." + install_docker + else + echo "Sorry, we only support Debian at the moment" + echo "You'll have to install the requirements manually for your distribution" + echo "See https://git.autonomic.zone/coop-cloud/abra#requirements for more" + fi +} + function install_abra_release { mkdir -p "$HOME/.local/bin" curl "$ABRA_SRC" > "$HOME/.local/bin/abra" @@ -24,11 +76,15 @@ function install_abra_dev { } function run_installation { + show_banner + if [ "$1" = "--dev" ]; then install_abra_dev else install_abra_release fi + + install_requirements } run_installation "$@"