Skip to content

Instantly share code, notes, and snippets.

@shanduur
Last active April 10, 2022 10:15
Show Gist options
  • Save shanduur/2fabbeeed66bc22fecb47131168e3a66 to your computer and use it in GitHub Desktop.
Save shanduur/2fabbeeed66bc22fecb47131168e3a66 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
OS=$(uname -s)
ARCH=$(uname -m)
URL="https://github.com/docker/compose/releases/latest/download/docker-compose-${OS}-${ARCH}"
if [ -z ${OVERRIDE_PATH} ];
then
INSTALL_PATH="/usr/local/lib/docker/cli-plugins/docker-compose"
else
INSTALL_PATH=${OVERRIDE_PATH}
fi
OUTPUT_PATH="./docker-compose"
if [ "$(whoami)" == "root" ];
then
SUDO=""
else
SUDO="sudo"
fi
if [ ${OS} == "Linux" ]
then
echo "saving to ${OUTPUT_PATH}"
curl -sSL \
${URL} \
-o ${OUTPUT_PATH}
echo "installing to ${INSTALL_PATH}"
${SUDO} install ${OUTPUT_PATH} ${INSTALL_PATH}
rm -f ${OUTPUT_PATH}
else
echo "OS (${OS}) not supported"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment