Browse Source

Merge branch 'feature/install-only'

feature/more-args
nicolas.dorier 5 years ago
parent
commit
e47f9b38a9
No known key found for this signature in database GPG Key ID: 6618763EF09186FE
  1. 23
      btcpay-setup.sh

23
btcpay-setup.sh

@ -30,7 +30,8 @@ Usage:
Install BTCPay on this server Install BTCPay on this server
This script must be run as root This script must be run as root
-i : Run install -i : Run install and start BTCPay Server
--install-only : Run install only
This script will: This script will:
@ -71,11 +72,16 @@ Add-on specific variables:
END END
} }
if [ "$1" != "-i" ]; then if [ "$1" != "-i" ] && [ "$1" != "--install-only" ]; then
display_help display_help
return return
fi fi
START=true
if [ "$1" == "--install-only" ]; then
START=false
fi
if [ -z "$BTCPAYGEN_CRYPTO1" ]; then if [ -z "$BTCPAYGEN_CRYPTO1" ]; then
if [ -f "/etc/profile.d/btcpay-env.sh" ]; then if [ -f "/etc/profile.d/btcpay-env.sh" ]; then
echo "This script must be run as root after running \"sudo su -\"" echo "This script must be run as root after running \"sudo su -\""
@ -351,11 +357,13 @@ systemctl restart docker
fi fi
echo -e "BTCPay Server systemd configured in /etc/systemd/system/btcpayserver.service\n" echo -e "BTCPay Server systemd configured in /etc/systemd/system/btcpayserver.service\n"
echo "BTCPay Server starting... this can take 5 to 10 minutes..."
systemctl daemon-reload systemctl daemon-reload
systemctl enable btcpayserver systemctl enable btcpayserver
systemctl start btcpayserver if $START; then
echo "BTCPay Server started" echo "BTCPay Server starting... this can take 5 to 10 minutes..."
systemctl start btcpayserver
echo "BTCPay Server started"
fi
else # Use upstart else # Use upstart
echo "Using upstart" echo "Using upstart"
echo " echo "
@ -376,9 +384,11 @@ script
docker-compose -f \"\$BTCPAY_DOCKER_COMPOSE\" up -d docker-compose -f \"\$BTCPAY_DOCKER_COMPOSE\" up -d
end script" > /etc/init/start_containers.conf end script" > /etc/init/start_containers.conf
echo -e "BTCPay Server upstart configured in /etc/init/start_containers.conf\n" echo -e "BTCPay Server upstart configured in /etc/init/start_containers.conf\n"
if $START; then
initctl reload-configuration initctl reload-configuration
echo "BTCPay Server started" echo "BTCPay Server started"
fi fi
fi
cd "$(dirname $BTCPAY_ENV_FILE)" cd "$(dirname $BTCPAY_ENV_FILE)"
@ -387,7 +397,8 @@ if [ ! -z "$OLD_BTCPAY_DOCKER_COMPOSE" ] && [ "$OLD_BTCPAY_DOCKER_COMPOSE" != "$
docker-compose -f "$OLD_BTCPAY_DOCKER_COMPOSE" down -t "${COMPOSE_HTTP_TIMEOUT:-180}" docker-compose -f "$OLD_BTCPAY_DOCKER_COMPOSE" down -t "${COMPOSE_HTTP_TIMEOUT:-180}"
fi fi
docker-compose -f "$BTCPAY_DOCKER_COMPOSE" up -d --remove-orphans -t "${COMPOSE_HTTP_TIMEOUT:-180}" $START && docker-compose -f "$BTCPAY_DOCKER_COMPOSE" up -d --remove-orphans -t "${COMPOSE_HTTP_TIMEOUT:-180}"
! $START && docker-compose -f "$BTCPAY_DOCKER_COMPOSE" pull
# Give SSH key to BTCPay # Give SSH key to BTCPay
if [[ -f "$BTCPAY_HOST_SSHKEYFILE" ]]; then if [[ -f "$BTCPAY_HOST_SSHKEYFILE" ]]; then

Loading…
Cancel
Save