Skip to content

Commit 6349ada

Browse files
authored
Merge pull request #17 from nahuhh/auto-retry
install: auto-retry on failure
2 parents a6eb484 + 1fec591 commit 6349ada

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

bsx/setup.sh

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,21 @@ enable_tor() {
4242
}
4343

4444
# Install bsx
45+
tries=1
4546
[[ $monerod_addr ]] && export XMR_RPC_HOST=$monerod_addr XMR_RPC_PORT=$monerod_port
4647
[[ $monerod_user ]] && export XMR_RPC_USER=$monerod_user XMR_RPC_PWD=$monerod_pass
47-
basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero --xmrrestoreheight=$xmrrestoreheight ${particl_mnemonic:+"--particl_mnemonic=\"$particl_mnemonic\""} ${use_electrum:-} ${add_wow:-} ${regtest:-} || {
48-
red "Installation failed. Try again"
49-
exit 1
50-
}
48+
while [[ 1 ]]; do
49+
basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero --xmrrestoreheight=$xmrrestoreheight ${particl_mnemonic:+"--particl_mnemonic=\"$particl_mnemonic\""} ${use_electrum:-} ${add_wow:-} ${regtest:-} && break || {
50+
if [[ $tries -lt 3 ]]; then
51+
red "Attempt ${tries}/3 - Installation failed. Retrying in 2 seconds.."
52+
sleep 2
53+
((tries++))
54+
else
55+
red "Attempt ${tries}/3 - Installation failed."
56+
exit 1
57+
fi
58+
}
59+
done
5160
red "\nMonero wallet restore height is ${xmrrestoreheight}"
5261
[[ -z $particl_mnemonic ]] && red "\nIMPORTANT!! Make note of your seed (wallet recovery phrase) above!!\n\n"
5362
read -p "Press ENTER to continue. "

0 commit comments

Comments
 (0)