Skip to content

Commit

Permalink
UX improvements to install and config
Browse files Browse the repository at this point in the history
  • Loading branch information
yorickdowne committed May 5, 2024
1 parent 04593ea commit e5724df
Showing 1 changed file with 51 additions and 39 deletions.
90 changes: 51 additions & 39 deletions ethd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e5724df

Please sign in to comment.