Fix incorrect bash script condition check (#83)
* fix: correct bash script syntaxes * fix: fix linux install docker condition
This commit is contained in:
parent
5390c6ac52
commit
4131a3b183
18
run.sh
18
run.sh
@ -1,6 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
|
||||||
|
|
||||||
### Clean sub-processes on exit
|
### Clean sub-processes on exit
|
||||||
trap "trap - SIGTERM && kill -- -$$" SIGINT
|
trap "trap - SIGTERM && kill -- -$$" SIGINT
|
||||||
|
|
||||||
@ -26,15 +24,14 @@ progress() {
|
|||||||
sleep 0.1
|
sleep 0.1
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
if [ -s "error.log" ] && [ $(cat "error.log") != "WARNING"* ]; then
|
if [ -s "error.log" ] && [[ "$(cat error.log)" != "WARNING"* ]]; then
|
||||||
echo -ne "\\r\\033[1A- [$3/$MAX_STEPS] [x] $2\\n $(cat "error.log")"
|
echo -ne "\\r\\033[1A- [$3/$MAX_STEPS] [x] $2\\n $(cat error.log)"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo -ne "\\r\\033[1A- [$3/$MAX_STEPS] [✔] $2 $CLEAR_LINE\\n"
|
echo -ne "\\r\\033[1A- [$3/$MAX_STEPS] [✔] $2 $CLEAR_LINE\\n"
|
||||||
}
|
}
|
||||||
step=1
|
step=1
|
||||||
|
|
||||||
|
|
||||||
### macOS setup
|
### macOS setup
|
||||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
MAX_STEPS=13
|
MAX_STEPS=13
|
||||||
@ -76,7 +73,7 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
|
|||||||
progress '' "docker-compose - Installed" $((step++))
|
progress '' "docker-compose - Installed" $((step++))
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
###
|
###
|
||||||
|
|
||||||
### Debian setup
|
### Debian setup
|
||||||
if [[ "$OSTYPE" == "linux"* ]]; then
|
if [[ "$OSTYPE" == "linux"* ]]; then
|
||||||
@ -102,7 +99,7 @@ if [[ "$OSTYPE" == "linux"* ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
docker compose version &>/dev/null
|
docker compose version &>/dev/null
|
||||||
if [ $? -ne 0 ] || [ ! -x "$(command -v docker-compose)" ]; then
|
if [ $? -ne 0 ] && [ ! -x "$(command -v docker-compose)" ]; then
|
||||||
progress 'sudo apt install docker-compose' "Installing Docker Compose" $((step++))
|
progress 'sudo apt install docker-compose' "Installing Docker Compose" $((step++))
|
||||||
else
|
else
|
||||||
progress '' "docker-compose - Installed" $((step++))
|
progress '' "docker-compose - Installed" $((step++))
|
||||||
@ -147,7 +144,7 @@ elif [[ "$OSTYPE" == "linux"* ]]; then
|
|||||||
progress 'sudo service docker start 2>/dev/null' "Starting Docker Service" $((step++))
|
progress 'sudo service docker start 2>/dev/null' "Starting Docker Service" $((step++))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
docker compose version >/dev/null
|
docker compose version &>/dev/null
|
||||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
if [ $? == 0 ]; then
|
if [ $? == 0 ]; then
|
||||||
progress 'docker compose up -d --quiet-pull --remove-orphans 2>/dev/null' "Docker compose up" $((step++))
|
progress 'docker compose up -d --quiet-pull --remove-orphans 2>/dev/null' "Docker compose up" $((step++))
|
||||||
@ -155,11 +152,14 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
|
|||||||
progress 'docker-compose up -d --quiet-pull --remove-orphans 2>/dev/null' "Docker compose up" $((step++))
|
progress 'docker-compose up -d --quiet-pull --remove-orphans 2>/dev/null' "Docker compose up" $((step++))
|
||||||
fi
|
fi
|
||||||
elif [[ "$OSTYPE" == "linux"* ]]; then
|
elif [[ "$OSTYPE" == "linux"* ]]; then
|
||||||
if [ $? == 0 ]; then
|
if [[ $? == 0 ]]; then
|
||||||
progress 'sudo docker compose up -d --quiet-pull --remove-orphans 2>/dev/null' "Docker compose up" $((step++))
|
progress 'sudo docker compose up -d --quiet-pull --remove-orphans 2>/dev/null' "Docker compose up" $((step++))
|
||||||
elif [[ -x "$(command -v docker-compose)" ]]; then
|
elif [[ -x "$(command -v docker-compose)" ]]; then
|
||||||
progress 'sudo docker-compose up -d --quiet-pull --remove-orphans 2>/dev/null' "Docker compose up" $((step++))
|
progress 'sudo docker-compose up -d --quiet-pull --remove-orphans 2>/dev/null' "Docker compose up" $((step++))
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
echo >&2 "Can not find docker compose runner"
|
||||||
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
###
|
###
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user