Browse Source

Refactor condition, add set -e

migrate-pregen
nicolas.dorier 7 years ago
parent
commit
0d0092186d
  1. 16
      btcpay-setup.sh

16
btcpay-setup.sh

@ -1,5 +1,7 @@
#!/bin/bash #!/bin/bash
set -e
if [ "$0" = "$BASH_SOURCE" ]; then if [ "$0" = "$BASH_SOURCE" ]; then
echo "This script must be sourced \". btcpay-setup.sh\"" echo "This script must be sourced \". btcpay-setup.sh\""
exit 1 exit 1
@ -145,7 +147,7 @@ export BTCPAY_ENV_FILE=\"$BTCPAY_ENV_FILE\"" > /etc/profile.d/btcpay-env.sh
chmod +x /etc/profile.d/btcpay-env.sh chmod +x /etc/profile.d/btcpay-env.sh
echo "BTCPay Server environment variables successfully saved in /etc/profile.d/btcpay-env.sh" echo "BTCPay Server environment variables successfully saved in /etc/profile.d/btcpay-env.sh"
if ! [ -x "$(command -v docker)" ]; then if ! [ -x "$(command -v docker)" ] || ! [ -x "$(command -v docker-compose)" ]; then
apt-get update 2>error apt-get update 2>error
apt-get install -y \ apt-get install -y \
curl \ curl \
@ -153,6 +155,9 @@ if ! [ -x "$(command -v docker)" ]; then
ca-certificates \ ca-certificates \
software-properties-common \ software-properties-common \
2>error 2>error
fi
if ! [ -x "$(command -v docker)" ]; then
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository \ add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
@ -178,13 +183,6 @@ fi
# Install docker-compose # Install docker-compose
if ! [ -x "$(command -v docker-compose)" ]; then if ! [ -x "$(command -v docker-compose)" ]; then
apt-get update 2>error
apt-get install -y \
curl \
apt-transport-https \
ca-certificates \
software-properties-common \
2>error
curl -L https://github.com/docker/compose/releases/download/1.17.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose curl -L https://github.com/docker/compose/releases/download/1.17.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose
else else
@ -204,7 +202,7 @@ echo "BTCPay Server docker-compose parameters saved in $BTCPAY_ENV_FILE"
# Generate the docker compose in BTCPAY_DOCKER_COMPOSE # Generate the docker compose in BTCPAY_DOCKER_COMPOSE
. ./build.sh . ./build.sh
cd BTCPAY_BASE_DIRECTORY cd $BTCPAY_BASE_DIRECTORY
# Schedule for reboot # Schedule for reboot
if [ -d "/etc/systemd/system" ]; then # Use systemd if [ -d "/etc/systemd/system" ]; then # Use systemd

Loading…
Cancel
Save