From 97f54942f97ddf59668fc6cea0dc3392308e6c69 Mon Sep 17 00:00:00 2001 From: Tyler Trott <66637408+TylerTrott@users.noreply.github.com> Date: Tue, 21 Nov 2023 16:25:09 -0800 Subject: [PATCH 1/8] Update getdess.sh --- getdess.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/getdess.sh b/getdess.sh index a60fe18..6d630ca 100644 --- a/getdess.sh +++ b/getdess.sh @@ -140,7 +140,9 @@ install_docker () { amzn) $pkg_man install -y libffi libffi-devel openssl-devel python3 python3-pip python3-devel gcc;; *) $pkg_man install -y python3 python3-pip;; esac; - pip3 install docker-compose; + python3 -m venv .venv; + source .venv/bin/activate; + python3 -m pip install -r docker-compose ;; esac COMPOSE_RESULT=$? From 9a948b40076390b77d68022b45dc4cdd8fa6a033 Mon Sep 17 00:00:00 2001 From: Tyler Trott <66637408+TylerTrott@users.noreply.github.com> Date: Wed, 22 Nov 2023 10:17:26 -0800 Subject: [PATCH 2/8] Update pkg installations --- getdess.sh | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/getdess.sh b/getdess.sh index 6d630ca..0404938 100644 --- a/getdess.sh +++ b/getdess.sh @@ -127,7 +127,23 @@ install_docker () { dnf -y install docker-ce docker-ce-cli containerd.io; systemctl enable --now docker.service; ;; - *) curl -fsSL https://get.docker.com | sh;; + *) + # Add Docker's official GPG key: + sudo apt-get update + sudo apt-get install ca-certificates curl gnupg + sudo install -m 0755 -d /etc/apt/keyrings + curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg + sudo chmod a+r /etc/apt/keyrings/docker.gpg + + # Add the repository to Apt sources: + # Need to add conditional for derivative distros + echo \ + "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \ + "$(. /etc/os-release && echo "$VERSION_CODENAME")" 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 docker-buildx-plugin docker-compose-plugin + ;; esac fi @@ -140,9 +156,13 @@ install_docker () { amzn) $pkg_man install -y libffi libffi-devel openssl-devel python3 python3-pip python3-devel gcc;; *) $pkg_man install -y python3 python3-pip;; esac; + # Setting up docker-compose in a virtualenv python3 -m venv .venv; source .venv/bin/activate; - python3 -m pip install -r docker-compose + compose_version=$(curl https://api.github.com/repos/docker/compose/releases/latest | jq .name -r) + output='/usr/local/bin/docker-compose' + curl -L https://github.com/docker/compose/releases/download/$compose_version/docker-compose-$(uname -s)-$(uname -m) -o $output + chmod +x $output ;; esac COMPOSE_RESULT=$? From bd8332281e3c9c93378c8f808fc7a43514718610 Mon Sep 17 00:00:00 2001 From: TylerTrott Date: Wed, 15 May 2024 12:25:36 -0700 Subject: [PATCH 3/8] Slight modifications to venv usage --- getdess.sh | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/getdess.sh b/getdess.sh index 0404938..01dadb9 100644 --- a/getdess.sh +++ b/getdess.sh @@ -156,13 +156,34 @@ install_docker () { amzn) $pkg_man install -y libffi libffi-devel openssl-devel python3 python3-pip python3-devel gcc;; *) $pkg_man install -y python3 python3-pip;; esac; - # Setting up docker-compose in a virtualenv - python3 -m venv .venv; - source .venv/bin/activate; - compose_version=$(curl https://api.github.com/repos/docker/compose/releases/latest | jq .name -r) - output='/usr/local/bin/docker-compose' - curl -L https://github.com/docker/compose/releases/download/$compose_version/docker-compose-$(uname -s)-$(uname -m) -o $output + # Setting up docker-compose in a virtualenv + python3 -m venv .venv + source .venv/bin/activate + + # Ensure jq is installed + if ! command -v jq &> /dev/null; then + echo "jq could not be found, please install it." + exit 1 + fi + + # Fetch the latest docker-compose version + compose_version=$(curl -s https://api.github.com/repos/docker/compose/releases/latest | jq .name -r) + + # Define the output path and ensure the script is run with sudo if needed + output='/usr/local/bin/docker-compose' + if [ ! -w $(dirname $output) ]; then + echo "You need to run this script with sudo." + exit 1 + fi + + # Download docker-compose + curl -L https://github.com/docker/compose/releases/download/$compose_version/docker-compose-$(uname -s)-$(uname -m) -o $output + + # Set executable permissions chmod +x $output + + echo "Docker-compose $compose_version installed successfully." + ;; esac COMPOSE_RESULT=$? From 528ee5abb696ef2abfd560e9618c88c891d5e1ed Mon Sep 17 00:00:00 2001 From: TylerTrott Date: Wed, 15 May 2024 12:40:14 -0700 Subject: [PATCH 4/8] Fixes for ShellCheck --- getdess.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/getdess.sh b/getdess.sh index 01dadb9..ef05832 100644 --- a/getdess.sh +++ b/getdess.sh @@ -138,8 +138,8 @@ install_docker () { # Add the repository to Apt sources: # Need to add conditional for derivative distros echo \ - "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \ - "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \ + "deb [arch=\"$(dpkg --print-architecture)\" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \ + "$(. /etc/os-release && echo \"$VERSION_CODENAME\")\" 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 docker-buildx-plugin docker-compose-plugin @@ -177,13 +177,12 @@ install_docker () { fi # Download docker-compose - curl -L https://github.com/docker/compose/releases/download/$compose_version/docker-compose-$(uname -s)-$(uname -m) -o $output + ""curl -L https://github.com/docker/compose/releases/download/$compose_version/docker-compose-$(uname -s)-$(uname -m) -o $output"" # Set executable permissions chmod +x $output - + echo "Docker-compose $compose_version installed successfully." - ;; esac COMPOSE_RESULT=$? From 9438aaf2a4bc8287c5cbf87999759c3a13c6799d Mon Sep 17 00:00:00 2001 From: TylerTrott Date: Wed, 15 May 2024 12:47:20 -0700 Subject: [PATCH 5/8] ShellCheck Changes --- getdess.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/getdess.sh b/getdess.sh index ef05832..af0538e 100644 --- a/getdess.sh +++ b/getdess.sh @@ -149,7 +149,7 @@ install_docker () { # docker-compose if ! command_exists docker-compose; then - case $(uname -m) in + case "$(uname -m)" in x86_64|amd64) curl -fsSL "$compose_url/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose;; *) case "$os_release" in @@ -171,14 +171,15 @@ install_docker () { # Define the output path and ensure the script is run with sudo if needed output='/usr/local/bin/docker-compose' - if [ ! -w $(dirname $output) ]; then + if [ ! -w "$(dirname "$output")" ]; then echo "You need to run this script with sudo." exit 1 fi # Download docker-compose - ""curl -L https://github.com/docker/compose/releases/download/$compose_version/docker-compose-$(uname -s)-$(uname -m) -o $output"" - + curl -L "https://github.com/docker/compose/releases/download/$compose_version/docker-compose-$(uname -s)-$(uname -m)" -o "$output" + chmod +x "$output" + # Set executable permissions chmod +x $output From cca5440280f0a4ba5c5aaef79e665037ba501c8f Mon Sep 17 00:00:00 2001 From: TylerTrott Date: Wed, 15 May 2024 12:54:44 -0700 Subject: [PATCH 6/8] ShellCheck fixes --- getdess.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/getdess.sh b/getdess.sh index af0538e..cca7a1d 100644 --- a/getdess.sh +++ b/getdess.sh @@ -139,7 +139,7 @@ install_docker () { # Need to add conditional for derivative distros echo \ "deb [arch=\"$(dpkg --print-architecture)\" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \ - "$(. /etc/os-release && echo \"$VERSION_CODENAME\")\" stable\" | \ + $\"(. /etc/os-release && echo \"$\"VERSION_CODENAME\"\")"\" 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 docker-buildx-plugin docker-compose-plugin @@ -177,7 +177,7 @@ install_docker () { fi # Download docker-compose - curl -L "https://github.com/docker/compose/releases/download/$compose_version/docker-compose-$(uname -s)-$(uname -m)" -o "$output" + curl -L "https://github.com/docker/compose/releases/download/$compose_version/docker-compose-\"$(uname -s)\"-\"$(uname -m)\"" -o "$output" chmod +x "$output" # Set executable permissions From ce71bafaafc3d827bda507826f6daed8a7c947e1 Mon Sep 17 00:00:00 2001 From: TylerTrott Date: Fri, 24 May 2024 11:31:51 -0700 Subject: [PATCH 7/8] Updating docker-compose installation without venv --- getdess.sh | 72 ++++++++++++++++++------------------------------------ 1 file changed, 24 insertions(+), 48 deletions(-) diff --git a/getdess.sh b/getdess.sh index cca7a1d..3f06487 100644 --- a/getdess.sh +++ b/getdess.sh @@ -147,55 +147,31 @@ install_docker () { esac fi - # docker-compose - if ! command_exists docker-compose; then - case "$(uname -m)" in - x86_64|amd64) curl -fsSL "$compose_url/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose;; - *) - case "$os_release" in - amzn) $pkg_man install -y libffi libffi-devel openssl-devel python3 python3-pip python3-devel gcc;; - *) $pkg_man install -y python3 python3-pip;; - esac; - # Setting up docker-compose in a virtualenv - python3 -m venv .venv - source .venv/bin/activate - - # Ensure jq is installed - if ! command -v jq &> /dev/null; then - echo "jq could not be found, please install it." - exit 1 - fi - - # Fetch the latest docker-compose version - compose_version=$(curl -s https://api.github.com/repos/docker/compose/releases/latest | jq .name -r) - - # Define the output path and ensure the script is run with sudo if needed - output='/usr/local/bin/docker-compose' - if [ ! -w "$(dirname "$output")" ]; then - echo "You need to run this script with sudo." - exit 1 - fi - - # Download docker-compose - curl -L "https://github.com/docker/compose/releases/download/$compose_version/docker-compose-\"$(uname -s)\"-\"$(uname -m)\"" -o "$output" - chmod +x "$output" - - # Set executable permissions - chmod +x $output - - echo "Docker-compose $compose_version installed successfully." - ;; - esac - COMPOSE_RESULT=$? - echo "$COMPOSE_RESULT" - if [[ $COMPOSE_RESULT -gt 0 ]]; then - error_exit 51 - fi - chown root:docker /usr/local/bin/docker-compose - chmod +x /usr/local/bin/docker-compose + # Install docker-compose v2 + echo "Installing Docker Compose v2..." + curl -SL https://github.com/docker/compose/releases/download/v2.27.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose + # Apply executable permissions to the binary + echo "Applying executable permissions to Docker Compose binary..." + chmod +x "${/usr/local/bin/docker-compose}" + + # Test the installation + echo "Testing Docker Compose installation..." + if "${/usr/local/bin/docker-compose}" --version; then + echo "Docker Compose installed successfully." + else + echo "Docker Compose installation failed." + exit 1 fi - ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose - systemctl enable --now docker.service + + # Check if /usr/local/bin is in the PATH + if ! echo "$PATH" | grep -q "/usr/local/bin"; then + echo "/usr/local/bin is not in the PATH. Creating a symbolic link to /usr/bin..." + sudo ln -s "${/usr/local/bin/docker-compose}" /usr/bin/docker-compose + else + echo "/usr/local/bin is in the PATH. No need to create a symbolic link." + fi + +echo "Installation completed." } mkdir_atsign () { From 111e9386eb3fc0a9ce4714266a30935cebd143a7 Mon Sep 17 00:00:00 2001 From: Tyler Trott <66637408+TylerTrott@users.noreply.github.com> Date: Fri, 24 May 2024 11:42:45 -0700 Subject: [PATCH 8/8] Update getdess.sh --- getdess.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/getdess.sh b/getdess.sh index 3f06487..5934fbc 100644 --- a/getdess.sh +++ b/getdess.sh @@ -14,9 +14,6 @@ arch_support='x86_64 amd64 aarch64 arm64 armv7l' # Required base packages packages="curl openssl qrencode" -# Docker compose link -compose_url="https://github.com/docker/compose/releases/download/1.29.2" - # Atsign user info user_info="atsign, secondaries account, atsign.com"