From a84eea7834eff520f31d1b5826a015c6706f3d09 Mon Sep 17 00:00:00 2001 From: ABM Ruman Date: Tue, 31 Mar 2020 17:36:55 +0600 Subject: [PATCH] fix: install-docker-compose script without sudo if not found --- scripts/install-docker-compose.sh | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/scripts/install-docker-compose.sh b/scripts/install-docker-compose.sh index 80d870d..1490b24 100755 --- a/scripts/install-docker-compose.sh +++ b/scripts/install-docker-compose.sh @@ -1,5 +1,5 @@ #!/bin/bash -set -ev +set -ex if [ -z "$DOCKER_COMPOSE_VERSION" ]; then DOCKER_COMPOSE_VERSION=1.25.4 @@ -7,7 +7,15 @@ fi echo "Installing docker-compose version: $DOCKER_COMPOSE_VERSION" -sudo rm /usr/local/bin/docker-compose | echo -curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose -sudo chmod +x docker-compose -sudo mv docker-compose /usr/local/bin +if [ -z "`sudo -l 2>/dev/null`" ]; then + + rm /usr/local/bin/docker-compose | echo + curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose + chmod +x docker-compose + mv docker-compose /usr/local/bin +else + sudo rm /usr/local/bin/docker-compose | echo + curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose + sudo chmod +x docker-compose + sudo mv docker-compose /usr/local/bin +fi