From 0a6b45068496554f43d26bb6d4cd817cbe60e954 Mon Sep 17 00:00:00 2001 From: openoms <43343391+openoms@users.noreply.github.com> Date: Tue, 7 Feb 2023 20:32:22 +0000 Subject: [PATCH] break scripts on fatal failures (#3658) --- .../config.scripts/bonus.btcpayserver.sh | 21 +++++-------------- home.admin/config.scripts/bonus.fulcrum.sh | 4 ++-- .../config.scripts/cl-plugin.cln-grpc.sh | 2 +- home.admin/config.scripts/cl.hsmtool.sh | 2 +- 4 files changed, 9 insertions(+), 20 deletions(-) diff --git a/home.admin/config.scripts/bonus.btcpayserver.sh b/home.admin/config.scripts/bonus.btcpayserver.sh index b4d78be08..13772ce68 100644 --- a/home.admin/config.scripts/bonus.btcpayserver.sh +++ b/home.admin/config.scripts/bonus.btcpayserver.sh @@ -399,10 +399,7 @@ if [ "$1" = "install" ]; then sudo -u btcpay /home/admin/config.scripts/blitz.git-verify.sh "${PGPsigner}" "${PGPpubkeyLink}" "${PGPpubkeyFingerprint}" || exit 1 echo "# Build NBXplorer $NBXplorerVersion" # from the build.sh with path - sudo -u btcpay /home/btcpay/dotnet/dotnet build -c Release NBXplorer/NBXplorer.csproj || ( - echo "# Build failed" - exit 1 - ) + sudo -u btcpay /home/btcpay/dotnet/dotnet build -c Release NBXplorer/NBXplorer.csproj || exit 1 # BTCPayServer echo "# Install BTCPayServer" @@ -423,10 +420,7 @@ if [ "$1" = "install" ]; then echo "# Build BTCPayServer $BTCPayVersion" # from the build.sh with path sudo -u btcpay /home/btcpay/dotnet/dotnet build -c Release \ - /home/btcpay/btcpayserver/BTCPayServer/BTCPayServer.csproj || ( - echo "# Build failed" - exit 1 - ) + /home/btcpay/btcpayserver/BTCPayServer/BTCPayServer.csproj || exit 1 exit 0 fi @@ -757,10 +751,8 @@ if [ "$1" = "update" ]; then echo "# Build NBXplorer $TAG" # from the build.sh with path sudo systemctl stop nbxplorer - sudo -u btcpay /home/btcpay/dotnet/dotnet build -c Release NBXplorer/NBXplorer.csproj || ( - echo "# Build failed" - exit 1 - ) + sudo -u btcpay /home/btcpay/dotnet/dotnet build -c Release NBXplorer/NBXplorer.csproj || exit 1 + # whitelist localhost in bitcoind if ! sudo grep -Eq "^whitelist=127.0.0.1" /mnt/hdd/bitcoin/bitcoin.conf; then echo "whitelist=127.0.0.1" | sudo tee -a /mnt/hdd/bitcoin/bitcoin.conf @@ -813,10 +805,7 @@ if [ "$1" = "update" ]; then echo "# Build BTCPayServer $TAG" # from the build.sh with path sudo systemctl stop btcpayserver - sudo -u btcpay /home/btcpay/dotnet/dotnet build -c Release /home/btcpay/btcpayserver/BTCPayServer/BTCPayServer.csproj || ( - echo "# Build failed" - exit 1 - ) + sudo -u btcpay /home/btcpay/dotnet/dotnet build -c Release /home/btcpay/btcpayserver/BTCPayServer/BTCPayServer.csproj || exit 1 sudo systemctl start btcpayserver echo "# Updated BTCPayServer to $TAG" fi diff --git a/home.admin/config.scripts/bonus.fulcrum.sh b/home.admin/config.scripts/bonus.fulcrum.sh index cd177311f..bf008cc9a 100644 --- a/home.admin/config.scripts/bonus.fulcrum.sh +++ b/home.admin/config.scripts/bonus.fulcrum.sh @@ -52,10 +52,10 @@ if [ "$1" = on ]; then curl https://raw.githubusercontent.com/Electron-Cash/keys-n-hashes/master/pubkeys/calinkey.txt | sudo -u fulcrum gpg --import # look for 'Good signature' - sudo -u fulcrum gpg --verify Fulcrum-${fulcrumVersion}-${build}.tar.gz.asc || (echo "Failed to verify the GPG signature of Fulcrum-${fulcrumVersion}-${build}.tar.gz"; exit 1) + sudo -u fulcrum gpg --verify Fulcrum-${fulcrumVersion}-${build}.tar.gz.asc || exit 1 # look for 'OK' - sudo -u fulcrum sha256sum -c Fulcrum-${fulcrumVersion}-${build}.tar.gz.sha256sum --ignore-missing || (echo "Failed to verify the sha256 hash of Fulcrum-${fulcrumVersion}-${build}.tar.gz"; exit 1) + sudo -u fulcrum sha256sum -c Fulcrum-${fulcrumVersion}-${build}.tar.gz.sha256sum --ignore-missing || exit 1 # decompress sudo -u fulcrum tar -xvf Fulcrum-${fulcrumVersion}-${build}.tar.gz diff --git a/home.admin/config.scripts/cl-plugin.cln-grpc.sh b/home.admin/config.scripts/cl-plugin.cln-grpc.sh index 649db719a..00dbe4bb4 100644 --- a/home.admin/config.scripts/cl-plugin.cln-grpc.sh +++ b/home.admin/config.scripts/cl-plugin.cln-grpc.sh @@ -114,7 +114,7 @@ elif [ "$1" = off ]; then elif [ "$1" = update ]; then if [ "$(echo "$@" | grep -c source)" -gt 0 ];then - cd /home/bitcoin/lightning/ || (echo " The source is not present"; exit 1) + cd /home/bitcoin/lightning/ || exit 1 sudo -u bitcoin git pull fi sudo rm -rf /home/bitcoin/cl-plugins-available/cln-grpc diff --git a/home.admin/config.scripts/cl.hsmtool.sh b/home.admin/config.scripts/cl.hsmtool.sh index 4912a09e3..f69919253 100644 --- a/home.admin/config.scripts/cl.hsmtool.sh +++ b/home.admin/config.scripts/cl.hsmtool.sh @@ -156,7 +156,7 @@ function decryptHSMsecret() { /home/admin/config.scripts/cl.hsmtool.sh unlock ${CHAIN} # attempt to decrypt again sudo cat $passwordFile | sudo -u bitcoin lightning-hsmtool decrypt \ - "$hsmSecretPath" || (echo "# Couldn't decrypt"; exit 1) + "$hsmSecretPath" || exit 1 fi fi shredPasswordFile