From 1991c499a691a6d5aacd63b6bc808fc0f8bfea04 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Thu, 6 Dec 2018 14:30:43 +0900 Subject: [PATCH] Error if the user did not run sudo su - --- btcpay-setup.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/btcpay-setup.sh b/btcpay-setup.sh index 776faae..7af3133 100755 --- a/btcpay-setup.sh +++ b/btcpay-setup.sh @@ -70,6 +70,15 @@ if [ "$1" != "-i" ]; then return fi +if [ -z "$BTCPAY_HOST" ]; then + if [ -f "/etc/profile.d/btcpay-env.sh" ]; then + echo "This script must be run as root after running \"sudo su -\"" + else + echo "BTCPAY_HOST should not be empty" + fi + return +fi + ######### Migration: old pregen environment to new environment ############ if [ ! -z $BTCPAY_DOCKER_COMPOSE ] && [ ! -z $DOWNLOAD_ROOT ] && [ -z $BTCPAYGEN_OLD_PREGEN ]; then echo "Your deployment is too old, you need to migrate by following instructions on this link https://github.com/btcpayserver/btcpayserver-docker/tree/master#i-deployed-before-btcpay-setupsh-existed-before-may-17-can-i-migrate-to-this-new-system" @@ -157,11 +166,6 @@ BTCPAY_SSHTRUSTEDFINGERPRINTS:$BTCPAY_SSHTRUSTEDFINGERPRINTS ---------------------- " -if [ -z "$BTCPAY_HOST" ]; then - echo "BTCPAY_HOST should not be empty" - return -fi - if [ -z "$BTCPAYGEN_CRYPTO1" ]; then echo "BTCPAYGEN_CRYPTO1 should not be empty" return