Skip to content

Commit 0bb4f35

Browse files
committed
menu: improve setup flow on the first run
1 parent 04f9b02 commit 0bb4f35

1 file changed

Lines changed: 17 additions & 13 deletions

File tree

scripts/start.joininbox.sh

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ if [ "$cpuEntry" -eq 0 ]; then
1414
echo "cpu=$cpu" >> /home/joinmarket/joinin.conf
1515
fi
1616

17-
# get settings on the first run
17+
#############
18+
# FIRST RUN #
19+
#############
1820
runningEnvEntry=$(grep -c "runningEnv" < /home/joinmarket/joinin.conf)
1921
if [ "$runningEnvEntry" -eq 0 ]; then
2022
if [ -f "/mnt/hdd/raspiblitz.conf" ] ; then
2123
runningEnv="raspiblitz"
22-
setupStep=100
24+
setupStep=0
2325
else
2426
runningEnv="standalone"
2527
setupStep=0
@@ -50,20 +52,19 @@ if [ "$runningEnvEntry" -eq 0 ]; then
5052
# check if JoinMarket is installed
5153
/home/joinmarket/install.joinmarket.sh install
5254

53-
# connect to remote node
54-
/home/joinmarket/menu.bitcoinrpc.sh
55-
# run config after install
56-
/home/joinmarket/install.joinmarket.sh config
57-
55+
# connect to remote node on first start if standalone
56+
if [ "$runningEnv" = "standalone" ]; then
57+
/home/joinmarket/menu.bitcoinrpc.sh
58+
# run config after install
59+
/home/joinmarket/install.joinmarket.sh config
60+
fi
5861
fi
5962

6063
source /home/joinmarket/_functions.sh
6164
source /home/joinmarket/joinin.conf
6265

63-
if [ "$runningEnv" = "raspiblitz" ]; then
64-
66+
if [ "$runningEnv" = "raspiblitz" ] && [ "$setupStep" -eq 0 ]; then
6567
generateJMconfig
66-
6768
echo
6869
echo "# editing the joinmarket.cfg"
6970
sed -i "s/^rpc_user =.*/rpc_user = raspibolt/g" /home/joinmarket/.joinmarket/joinmarket.cfg
@@ -72,11 +73,14 @@ if [ "$runningEnv" = "raspiblitz" ]; then
7273
echo "# filled the bitcoin RPC password (PASSWORD_B)"
7374
sed -i "s/^rpc_wallet_file =.*/rpc_wallet_file = wallet.dat/g" /home/joinmarket/.joinmarket/joinmarket.cfg
7475
echo "# using the bitcoind wallet: wallet.dat"
75-
7676
setIRCtoTor
77-
77+
# setup finished
78+
sudo sed -i "s#setupStep=.*#setupStep=100#g" /home/joinmarket/joinin.conf
7879
fi
7980

81+
#############
82+
# EVERY RUN #
83+
#############
8084
# check bitcoind RPC setting
8185
# add default value to joinin config if needed
8286
if ! grep -Eq "^RPCoverTor=" /home/joinmarket/joinin.conf; then
@@ -91,7 +95,7 @@ else
9195
sed -i "s/^RPCoverTor=.*/RPCoverTor=off/g" /home/joinmarket/joinin.conf
9296
fi
9397

94-
# check if there is only one wallet and make default
98+
# check if there is only one joinmarket wallet and make default
9599
# add default value to joinin config if needed
96100
if ! grep -Eq "^defaultWallet=" /home/joinmarket/joinin.conf; then
97101
echo "defaultWallet=off" >> /home/joinmarket/joinin.conf

0 commit comments

Comments
 (0)