From e5724dff4be54d863f1ecd8df5848f6c39419453 Mon Sep 17 00:00:00 2001 From: Yorick Date: Sun, 5 May 2024 04:38:05 +0000 Subject: [PATCH] UX improvements to install and config --- ethd | 90 ++++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 51 insertions(+), 39 deletions(-) diff --git a/ethd b/ethd index b622aa08..f1065090 100755 --- a/ethd +++ b/ethd @@ -237,21 +237,23 @@ install-bash-completions() { install() { - read -rp "This will attempt to install Docker and make your user part of the docker group. Do you wish to \ -continue? (no/yes) " yn - case $yn in - [Yy]* ) ;; - * ) echo "Aborting, no changes made"; return 0;; - esac if [[ "$__distro" = "ubuntu" ]]; then - if [ "${__os_major_version}" -lt 22 ]; then - echo "${__project_name} cannot install Docker on Ubuntu ${__os_major_version}." - echo "Consider upgrading to 22.04 and then 24.04." - exit 1 - fi + ${__auto_sudo} apt-get update + ${__auto_sudo} apt-get install -y ca-certificates curl gnupg whiptail chrony pkg-config + echo + echo if [ -z "$(command -v docker)" ]; then - ${__auto_sudo} apt-get update - ${__auto_sudo} apt-get install -y ca-certificates curl gnupg whiptail chrony pkg-config + if [ "${__os_major_version}" -lt 22 ]; then + echo "${__project_name} cannot install Docker on Ubuntu ${__os_major_version}." + echo "Consider upgrading to 22.04 and then 24.04." + exit 1 + fi + read -rp "This will attempt to install Docker and make your user part of the docker group. Do you wish to \ + continue? (no/yes) " yn + case $yn in + [Yy]* ) ;; + * ) echo "Aborting, no changes made"; return 0;; + esac ${__auto_sudo} mkdir -p /etc/apt/keyrings ${__auto_sudo} curl -fsSL https://download.docker.com/linux/ubuntu/gpg | ${__auto_sudo} gpg --dearmor \ --yes -o /etc/apt/keyrings/docker.gpg @@ -275,36 +277,44 @@ continue? (no/yes) " yn echo "Your user is already part of the docker group" fi elif [[ "$__distro" =~ "debian" ]]; then + ${__auto_sudo} apt-get update + ${__auto_sudo} apt-get -y install ca-certificates curl gnupg whiptail chrony pkg-config + echo + echo if [ -z "$(command -v docker)" ]; then - ${__auto_sudo} apt-get update - ${__auto_sudo} apt-get -y install ca-certificates curl gnupg whiptail chrony pkg-config if [ "${__os_major_version}" -lt 11 ]; then echo "${__project_name} cannot install Docker on Debian ${__os_major_version}." echo "Consider upgrading to 11 and then 12." exit 1 fi - ${__auto_sudo} mkdir -p /etc/apt/keyrings - ${__auto_sudo} curl -fsSL https://download.docker.com/linux/debian/gpg | ${__auto_sudo} gpg --dearmor \ - --yes -o /etc/apt/keyrings/docker.gpg - ${__auto_sudo} echo \ - "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \ - https://download.docker.com/linux/debian $(lsb_release -cs) stable" \ - | ${__auto_sudo} tee /etc/apt/sources.list.d/docker.list > /dev/null - ${__auto_sudo} apt-get update - ${__auto_sudo} apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin \ - docker-buildx-plugin - echo "Installed docker-ce and docker-compose-plugin" - else - echo "Docker is already installed" - fi - __groups=$(${__as_owner} groups) - if [[ ! "$__groups" =~ "docker" ]]; then - echo "Making your user part of the docker group" - ${__auto_sudo} usermod -aG docker "${OWNER}" - echo "Please run newgrp docker or log out and back in" - else - echo "Your user is already part of the docker group" - fi + read -rp "This will attempt to install Docker and make your user part of the docker group. Do you wish to \ + continue? (no/yes) " yn + case $yn in + [Yy]* ) ;; + * ) echo "Aborting, no changes made"; return 0;; + esac + ${__auto_sudo} mkdir -p /etc/apt/keyrings + ${__auto_sudo} curl -fsSL https://download.docker.com/linux/debian/gpg | ${__auto_sudo} gpg --dearmor \ + --yes -o /etc/apt/keyrings/docker.gpg + ${__auto_sudo} echo \ + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \ + https://download.docker.com/linux/debian $(lsb_release -cs) stable" \ + | ${__auto_sudo} tee /etc/apt/sources.list.d/docker.list > /dev/null + ${__auto_sudo} apt-get update + ${__auto_sudo} apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin \ + docker-buildx-plugin + echo "Installed docker-ce and docker-compose-plugin" + else + echo "Docker is already installed" + fi + __groups=$(${__as_owner} groups) + if [[ ! "$__groups" =~ "docker" ]]; then + echo "Making your user part of the docker group" + ${__auto_sudo} usermod -aG docker "${OWNER}" + echo "Please run newgrp docker or log out and back in" + else + echo "Your user is already part of the docker group" + fi else echo "${__project_name} does not know how to install Docker on $__distro" fi @@ -2876,14 +2886,16 @@ config() { ${__as_owner} git update-index --assume-unchanged ext-network.yml # Create ENV file if needed if ! [[ -f "${ENV_FILE}" ]]; then - echo "Your configuration file template is: default.env" - ${__as_owner} cp default.env "${ENV_FILE}" __minty_fresh=1 else __minty_fresh=0 fi + echo "Your configuration file is: $(dirname "$(realpath "${BASH_SOURCE[0]}")")/${ENV_FILE}" + echo "You can change advanced config items with \"nano .env\" when in the $(dirname "$(realpath "${BASH_SOURCE[0]}")") directory." + echo + __during_config=1 check_legacy