From e09d951920c95ed7ac25e75215849973fb52e2a6 Mon Sep 17 00:00:00 2001 From: rootzoll Date: Mon, 3 May 2021 14:21:29 +0200 Subject: [PATCH] exit states --- .../setup.scripts/dialogLightningWallet.sh | 20 +++++++++---------- .../setup.scripts/setupDialogControl.sh | 10 +++++++++- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/home.admin/setup.scripts/dialogLightningWallet.sh b/home.admin/setup.scripts/dialogLightningWallet.sh index c2ab95b1b..579d4c73e 100644 --- a/home.admin/setup.scripts/dialogLightningWallet.sh +++ b/home.admin/setup.scripts/dialogLightningWallet.sh @@ -81,16 +81,14 @@ or having a complete LND rescue-backup from your old node. fi else - echo "# you selected cancel - exited to terminal" - echo "# use command 'restart' to reboot & start again" - exit 1 + # user cancel - signal to outside app by exit code (2 = submenu) + exit 2 fi done else - echo "# you selected cancel - exited to terminal" - echo "# use command 'restart' to reboot & start again" + # user cancel - signal to outside app by exit code (1 = mainmenu) exit 1 fi @@ -105,8 +103,8 @@ if [ ${uploadLNDRESCUE} -eq 1 ]; then # if user canceled upload if [ "${lndrescue}" == "" ]; then - # signal cancel to the calling script by exit code - exit 1 + # signal cancel to the calling script by exit code (3 = exit on lndrescue) + exit 3 fi # clear setup state from all fomer possible choices (previous loop) @@ -127,8 +125,8 @@ if [ ${enterSEED} -eq 1 ]; then # if user canceled the seed input if [ "${seedWords}" == "" ]; then - # signal cancel to the calling script by exit code - exit 1 + # signal cancel to the calling script by exit code (4 = exit on seedwords) + exit 4 fi # clear setup state from all fomer possible choices (previous loop) @@ -151,8 +149,8 @@ if [ ${uploadSCB} -eq 1 ]; then # if user canceled the upload if [ "${staticchannelbackup}" == "" ]; then - # signal cancel to the calling script by exit code - exit 1 + # signal cancel to the calling script by exit code (5 = exit on scb) + exit 5 fi # clear setup state from all fomer possible choices (previous loop) diff --git a/home.admin/setup.scripts/setupDialogControl.sh b/home.admin/setup.scripts/setupDialogControl.sh index b0e7a5a13..14cfc9e98 100755 --- a/home.admin/setup.scripts/setupDialogControl.sh +++ b/home.admin/setup.scripts/setupDialogControl.sh @@ -55,7 +55,7 @@ else # Setting Name for Node echo "# Starting basic setup dialog ..." - /home/admin/setup.scripts/dialogPasswords.sh + /home/admin/setup.scripts/dialogName.sh ############################################ # Lightning Wallet (new or restore) do this before passwords @@ -73,6 +73,14 @@ else lightningWalletDone=1 fi + # allow user to cancel to terminal on dialog main menu + # all other cancels have other exit codes + if [ "$?" == "1" ]; then + echo "# you selected cancel - exited to terminal" + echo "# to re-start setup use command --> setup" + exit 1 + fi + done fi