From ff07a294dfd0f3303fd709fffdb5b3b4fa49d26e Mon Sep 17 00:00:00 2001 From: rootzoll Date: Tue, 3 Aug 2021 16:15:32 +0200 Subject: [PATCH] adjust exit codes in menu scripts --- home.admin/00parallelMainnetServices.sh | 4 ++-- home.admin/00parallelTestnetServices.sh | 4 ++-- home.admin/00settingsMenuBasics.sh | 4 ++-- home.admin/00settingsMenuServices.sh | 4 ++-- home.admin/97addMobileWallet.sh | 18 ++++++++--------- home.admin/98repairMenu.sh | 6 +++--- home.admin/99updateMenu.sh | 27 +++++++++++++------------ home.admin/BBcashoutWallet.sh | 10 ++++----- home.admin/BBcloseAllChannels.sh | 8 +++----- home.admin/BBconnectPeer.sh | 2 +- home.admin/BBcreateInvoice.sh | 10 ++++----- home.admin/BBfundWallet.sh | 2 +- home.admin/BBopenChannel.sh | 12 +++++------ home.admin/BBpayInvoice.sh | 9 +++++---- 14 files changed, 60 insertions(+), 60 deletions(-) diff --git a/home.admin/00parallelMainnetServices.sh b/home.admin/00parallelMainnetServices.sh index a565e1eb6..d3427ec5a 100644 --- a/home.admin/00parallelMainnetServices.sh +++ b/home.admin/00parallelMainnetServices.sh @@ -37,10 +37,10 @@ clear echo "dialogcancel(${dialogcancel})" if [ ${dialogcancel} -eq 1 ]; then echo "user canceled" - exit 1 + exit 0 elif [ ${dialogcancel} -eq 255 ]; then echo "ESC pressed" - exit 1 + exit 0 fi needsReboot=0 diff --git a/home.admin/00parallelTestnetServices.sh b/home.admin/00parallelTestnetServices.sh index 3be1526a2..402fd3482 100644 --- a/home.admin/00parallelTestnetServices.sh +++ b/home.admin/00parallelTestnetServices.sh @@ -37,10 +37,10 @@ clear echo "dialogcancel(${dialogcancel})" if [ ${dialogcancel} -eq 1 ]; then echo "user canceled" - exit 1 + exit 0 elif [ ${dialogcancel} -eq 255 ]; then echo "ESC pressed" - exit 1 + exit 0 fi needsReboot=0 diff --git a/home.admin/00settingsMenuBasics.sh b/home.admin/00settingsMenuBasics.sh index 995664930..3c5cce643 100755 --- a/home.admin/00settingsMenuBasics.sh +++ b/home.admin/00settingsMenuBasics.sh @@ -117,10 +117,10 @@ clear echo "dialogcancel(${dialogcancel})" if [ ${dialogcancel} -eq 1 ]; then echo "user canceled" - exit 1 + exit 0 elif [ ${dialogcancel} -eq 255 ]; then echo "ESC pressed" - exit 1 + exit 0 fi needsReboot=0 diff --git a/home.admin/00settingsMenuServices.sh b/home.admin/00settingsMenuServices.sh index 2051fcecd..d43ed1b11 100755 --- a/home.admin/00settingsMenuServices.sh +++ b/home.admin/00settingsMenuServices.sh @@ -60,10 +60,10 @@ clear echo "dialogcancel(${dialogcancel})" if [ ${dialogcancel} -eq 1 ]; then echo "user canceled" - exit 1 + exit 0 elif [ ${dialogcancel} -eq 255 ]; then echo "ESC pressed" - exit 1 + exit 0 fi needsReboot=0 diff --git a/home.admin/97addMobileWallet.sh b/home.admin/97addMobileWallet.sh index 874286136..4de3e2f44 100755 --- a/home.admin/97addMobileWallet.sh +++ b/home.admin/97addMobileWallet.sh @@ -155,7 +155,7 @@ clear echo "creating install info ..." case $CHOICE in CLOSE) - exit 1; + exit 0; ;; SPHINX) if [ "${sphinxrelay}" != "on" ]; then @@ -173,7 +173,7 @@ case $CHOICE in fi # make pairing thru sphinx relay script /home/admin/config.scripts/bonus.sphinxrelay.sh menu - exit 1; + exit 0; ;; ZAP_IOS) appstoreLink="https://apps.apple.com/us/app/zap-bitcoin-lightning-wallet/id1406311960" @@ -206,7 +206,7 @@ Or scan the qr code on the LCD with your mobile phone. choose_IP_or_TOR fi /home/admin/config.scripts/bonus.lndconnect.sh zap-ios ${connect} - exit 1; + exit 0; ;; ZAP_ANDROID) appstoreLink="https://play.google.com/store/apps/details?id=zapsolutions.zap" @@ -229,7 +229,7 @@ Or scan the qr code on the LCD with your mobile phone. choose_IP_or_TOR fi /home/admin/config.scripts/bonus.lndconnect.sh zap-android ${connect} - exit 1; + exit 0; ;; SENDMANY_ANDROID) @@ -241,7 +241,7 @@ To use the chat feature of the SendMany app, you need to activate the Keysend fe Please go to MAINMENU > SERVICES and activate KEYSEND first. " 12 65 - exit 1 + exit 0 fi appstoreLink="https://github.com/fusion44/sendmany/releases" @@ -256,7 +256,7 @@ Please go to MAINMENU > SERVICES and activate KEYSEND first. /home/admin/config.scripts/blitz.display.sh hide checkIP2TOR LND-GRPC-API /home/admin/config.scripts/bonus.lndconnect.sh sendmany-android ${connect} - exit 1; + exit 0; ;; ZEUS_IOS) appstoreLink="https://testflight.apple.com/join/gpVFzEHN" @@ -271,7 +271,7 @@ Please go to MAINMENU > SERVICES and activate KEYSEND first. fi /home/admin/config.scripts/blitz.display.sh hide /home/admin/config.scripts/bonus.lndconnect.sh zeus-ios tor - exit 1; + exit 0; ;; ZEUS_ANDROID) appstoreLink="https://play.google.com/store/apps/details?id=app.zeusln.zeus" @@ -290,7 +290,7 @@ Or scan the qr code on the LCD with your mobile phone. fi /home/admin/config.scripts/blitz.display.sh hide /home/admin/config.scripts/bonus.lndconnect.sh zeus-android tor - exit 1; + exit 0; ;; FULLY_NODED) appstoreLink="https://apps.apple.com/us/app/fully-noded/id1436425586" @@ -309,6 +309,6 @@ Or scan the qr code on the LCD with your mobile phone. fi /home/admin/config.scripts/blitz.display.sh hide /home/admin/config.scripts/bonus.fullynoded.sh - exit 1; + exit 0; ;; esac diff --git a/home.admin/98repairMenu.sh b/home.admin/98repairMenu.sh index 933081416..a6b172565 100755 --- a/home.admin/98repairMenu.sh +++ b/home.admin/98repairMenu.sh @@ -118,7 +118,7 @@ case $CHOICE in # go back to main menu (and show) /home/admin/00raspiblitz.sh - exit 1; + exit 0; ;; RESET-HDD) askBackupCopy @@ -136,11 +136,11 @@ case $CHOICE in ;; DELETE-ELEC) /home/admin/config.scripts/bonus.electrs.sh off deleteindex - exit 1; + exit 0; ;; DELETE-INDEX) /home/admin/config.scripts/network.txindex.sh delete - exit 1; + exit 0; ;; COPY-SOURCE) /home/admin/config.scripts/blitz.copychain.sh source diff --git a/home.admin/99updateMenu.sh b/home.admin/99updateMenu.sh index bdae6bb38..e80d247ad 100755 --- a/home.admin/99updateMenu.sh +++ b/home.admin/99updateMenu.sh @@ -21,7 +21,7 @@ No need to close channels or download blockchain again. Do you want to start the Update now? " 16 62 if [ $? -eq 0 ]; then - exit 1 + exit 0 fi whiptail --title "LND Data Backup" --yes-button "Download Backup" --no-button "Skip" --yesno " @@ -69,7 +69,7 @@ and do you WANT TO START UPDATE NOW? OK. RaspiBlitz will NOT update now. " 7 39 sudo systemctl start lnd - exit 1 + exit 0 fi clear @@ -93,7 +93,7 @@ hotfix the code and might compromise your security. Do you want to Patch your RaspiBlitz now? " 18 58 if [ $? -eq 0 ]; then - exit 1 + exit 0 fi } @@ -128,10 +128,11 @@ patch() echo "REBOOT .." /home/admin/config.scripts/blitz.shutdown.sh reboot sleep 8 + exit 1 else echo "SKIP REBOOT .." + exit 0 fi - exit 1 ;; REPO) clear @@ -148,7 +149,7 @@ patch() fi fi patch - exit 1 + exit 0 ;; BRANCH) clear @@ -165,7 +166,7 @@ patch() fi fi patch - exit 1 + exit 0 ;; PR) clear @@ -186,7 +187,7 @@ patch() /home/admin/config.scripts/blitz.github.sh -justinstall fi fi - exit 1 + exit 0 ;; esac @@ -212,7 +213,7 @@ lnd() VERIFIED) if [ ${lndUpdateInstalled} -eq 1 ]; then whiptail --title "ALREADY INSTALLED" --msgbox "The LND version ${lndUpdateVersion} is already installed." 8 30 - exit 1 + exit 0 fi whiptail --title "OPTIONAL LND UPDATE" --yes-button "Cancel" --no-button "Update" --yesno "BEWARE on updating to LND v${lndUpdateVersion}: @@ -222,7 +223,7 @@ Do you really want to update LND now? " 16 58 if [ $? -eq 0 ]; then echo "# cancel update" - exit 1 + exit 0 fi # if loop is installed remove if [ "${loop}" == "on" ]; then @@ -255,7 +256,7 @@ Do you really want to update LND now? " 16 58 if [ $? -eq 0 ]; then echo "# cancel update" - exit 1 + exit 0 fi error="" source <(sudo -u admin /home/admin/config.scripts/lnd.update.sh reckless) @@ -296,7 +297,7 @@ bitcoinUpdate() { if [ ${bitcoinUpdateInstalled} -eq 1 ]; then whiptail --title "ALREADY INSTALLED" \ --msgbox "The Bitcoin Core version ${bitcoinUpdateVersion} is already installed." 8 30 - exit 1 + exit 0 fi whiptail --title "OPTIONAL Bitcoin Core update" --yes-button "Cancel" --no-button "Update" \ --yesno "Info on updating to Bitcoin Core v${bitcoinVersion}: @@ -308,7 +309,7 @@ Do you really want to update Bitcoin Core now? " 12 58 if [ $? -eq 0 ]; then echo "# cancel update" - exit 1 + exit 0 fi error="" @@ -332,7 +333,7 @@ Do you really want to update Bitcoin Core now? " 16 58 if [ $? -eq 0 ]; then echo "# cancel update" - exit 1 + exit 0 fi error="" source <(sudo -u admin /home/admin/config.scripts/bitcoin.update.sh reckless) diff --git a/home.admin/BBcashoutWallet.sh b/home.admin/BBcashoutWallet.sh index 1f05a896e..95db2d24e 100755 --- a/home.admin/BBcashoutWallet.sh +++ b/home.admin/BBcashoutWallet.sh @@ -33,13 +33,13 @@ if [ ${#openChannels} -eq 0 ]; then echo "************************************************" echo "Press ENTER to return to main menu." read key - exit 1 + exit 0 fi if [ ${openChannels} -gt 0 ]; then whiptail --title 'Info' --yes-button='Cashout Anyway' --no-button='Go Back' --yesno 'You still have funds in open Lightning Channels.\nUse CLOSEALL first if you want to cashout all funds.\nNOTICE: Just confirmed on-chain funds can be moved.' 10 56 if [ $? -eq 1 ]; then - exit 1 + exit 0 fi echo "..." fi @@ -59,7 +59,7 @@ fi if [ ${unconfirmed} -gt 0 ]; then whiptail --title 'Info' --yes-button='Cashout Anyway' --no-button='Go Back' --yesno "Still waiting confirmation for (some of) your funds.\nNOTICE: Just confirmed on-chain funds can be moved." 8 58 if [ $? -eq 1 ]; then - exit 1 + exit 0 fi echo "..." fi @@ -72,7 +72,7 @@ then echo "ok pressed" else echo "cancel pressed" - exit 1 + exit 0 fi address=$(cat $_temp | xargs) shred -u $_temp @@ -80,7 +80,7 @@ if [ ${#address} -eq 0 ]; then echo "FAIL - not a valid address (${address})" echo "Press ENTER to return to main menu." read key - exit 1 + exit 0 fi clear diff --git a/home.admin/BBcloseAllChannels.sh b/home.admin/BBcloseAllChannels.sh index 3e5141006..7f23b223e 100755 --- a/home.admin/BBcloseAllChannels.sh +++ b/home.admin/BBcloseAllChannels.sh @@ -34,7 +34,7 @@ elif [ $LNTYPE = lnd ];then # precheck: AutoPilot if [ "${autoPilot}" = "on" ]; then dialog --title 'Info' --msgbox 'You need to turn OFF the LND AutoPilot first,\nso that closed channels are not opening up again.\nYou find the AutoPilot -----> SERVICES section' 7 55 - exit 1 + exit 0 fi command="$lncli_alias closeallchannels --force" fi @@ -62,7 +62,7 @@ if [ ${chainOutSync} -eq 1 ]; then echo echo "# PRESS ENTER to return to menu" read key - exit 1 + exit 0 else echo "# OK - the chain is synced" fi @@ -87,6 +87,4 @@ fi echo echo "# OK - please recheck if channels really closed" -sleep 5 - -#TODO exits to CLI, not returning to menu \ No newline at end of file +sleep 5 \ No newline at end of file diff --git a/home.admin/BBconnectPeer.sh b/home.admin/BBconnectPeer.sh index d8d0b47c6..008f385ef 100755 --- a/home.admin/BBconnectPeer.sh +++ b/home.admin/BBconnectPeer.sh @@ -32,7 +32,7 @@ if [ ${#_input} -eq 0 ]; then echo echo "no peer entered - returning to menu ..." sleep 2 - exit 1 + exit 0 fi pubkey=$(echo "${_input}"|cut -d@ -f1) diff --git a/home.admin/BBcreateInvoice.sh b/home.admin/BBcreateInvoice.sh index 84f338d33..aa1ba034e 100755 --- a/home.admin/BBcreateInvoice.sh +++ b/home.admin/BBcreateInvoice.sh @@ -40,7 +40,7 @@ while [ "${chainInSync}" == "0" ]; do --pause "\n\n'$lncommand getinfo' shows 'synced_to_chain': false\n\nTry again in a few seconds." 15 60 5 if [ $? -gt 0 ]; then - exit 1 + exit 0 fi chainInSync=${cmdChainInSync} done @@ -57,8 +57,8 @@ if [ ${openChannels} -eq 0 ]; then echo "!!!!!!!!!!!!!!!!!!!" echo "FAIL - You have NO ESTABLISHED CHANNELS .. open a channel first." echo "!!!!!!!!!!!!!!!!!!!" - echo - exit 1 + sleep 3 + exit 0 fi # let user enter the invoice @@ -72,8 +72,8 @@ if [ ${#amount} -eq 0 ]; then clear echo echo "no amount entered - returning to menu ..." - sleep 2 - exit 1 + sleep 3 + exit 0 fi # TODO let user enter a description diff --git a/home.admin/BBfundWallet.sh b/home.admin/BBfundWallet.sh index a5674543a..a55b3bd90 100755 --- a/home.admin/BBfundWallet.sh +++ b/home.admin/BBfundWallet.sh @@ -34,7 +34,7 @@ if [ ${chainOutSync} -eq 1 ]; then echo echo "# PRESS ENTER to return to menu" read key - exit 1 + exit 0 else echo "# OK - the chain is synced" fi diff --git a/home.admin/BBopenChannel.sh b/home.admin/BBopenChannel.sh index 8540e6161..59617a538 100755 --- a/home.admin/BBopenChannel.sh +++ b/home.admin/BBopenChannel.sh @@ -36,7 +36,7 @@ if [ ${chainOutSync} -eq 1 ]; then echo echo "# PRESS ENTER to return to menu" read key - exit 1 + exit 0 else echo "# OK - the chain is synced" fi @@ -57,7 +57,7 @@ if [ ${confirmedBalance} -eq 0 ]; then echo echo "Press ENTER to return to main menu." read key - exit 1 + exit 0 fi # check number of connected peers @@ -74,7 +74,7 @@ if [ ${numConnectedPeers} -eq 0 ]; then echo echo "Press ENTER to return to main menu." read key - exit 1 + exit 0 fi # let user pick a peer to open a channels with @@ -109,7 +109,7 @@ if [ ${#pubKey} -eq 0 ]; then echo echo "no channel selected - returning to menu ..." sleep 4 - exit 1 + exit 0 fi # find out what is the minimum amount @@ -140,7 +140,7 @@ if [ ${#amount} -eq 0 ]; then echo echo "no valid amount entered - returning to menu ..." sleep 4 - exit 1 + exit 0 fi # let user enter a confirmation target @@ -154,7 +154,7 @@ if [ ${#conf_target} -eq 0 ]; then echo echo "no valid target entered - returning to menu ..." sleep 4 - exit 1 + exit 0 fi # build command diff --git a/home.admin/BBpayInvoice.sh b/home.admin/BBpayInvoice.sh index 5aa57e31e..2785c688c 100755 --- a/home.admin/BBpayInvoice.sh +++ b/home.admin/BBpayInvoice.sh @@ -40,7 +40,7 @@ while [ "${chainInSync}" == "0" ]; do --pause "\n\n'$lncommand getinfo' shows 'synced_to_chain': false\n\nTry again in a few seconds." 15 60 5 if [ $? -gt 0 ]; then - exit 1 + exit 0 fi chainInSync=${cmdChainInSync} done @@ -57,8 +57,9 @@ if [ ${openChannels} -eq 0 ]; then echo "!!!!!!!!!!!!!!!!!!!" echo "FAIL - You have NO ESTABLISHED CHANNELS .. open a channel first." echo "!!!!!!!!!!!!!!!!!!!" + sleep 3 echo - exit 1 + exit 0 fi paymentRequestStart="???" @@ -95,8 +96,8 @@ if [ ${#invoice} -eq 0 ]; then clear echo echo "no invoice entered - returning to menu ..." - sleep 2 - exit 1 + sleep 3 + exit 0 fi # TODO: maybe try/show the decoded info first by using https://api.lightning.community/#decodepayreq