@@ -14,7 +14,7 @@ if [ "$cpuEntry" -eq 0 ]; then
1414 echo " cpu=$cpu " >> /home/joinmarket/joinin.conf
1515fi
1616
17- # get settings on first run
17+ # get settings on the first run
1818runningEnvEntry=$( grep -c " runningEnv" < /home/joinmarket/joinin.conf)
1919if [ " $runningEnvEntry " -eq 0 ]; then
2020 if [ -f " /mnt/hdd/raspiblitz.conf" ] ; then
@@ -44,6 +44,9 @@ if [ "$runningEnvEntry" -eq 0 ]; then
4444 sudo apt install dialog
4545 fi
4646
47+ # check if JoinMarket is installed
48+ /home/joinmarket/install.joinmarket.sh install
49+
4750fi
4851
4952source /home/joinmarket/joinin.conf
@@ -82,4 +85,34 @@ elif [ "$runningEnv" = "raspiblitz" ]; then
8285 sed -i " s/^#usessl = false/usessl = false/g" /home/joinmarket/.joinmarket/joinmarket.cfg
8386 echo " # edited the joinmarket.cfg to communicate over Tor only"
8487 fi
88+ fi
89+
90+ # check bitcoind RPC setting
91+ # add default value to joinin config if needed
92+ if ! grep -Eq " ^RPCoverTor=" /home/joinmarket/joinin.conf; then
93+ echo " RPCoverTor=off" >> /home/joinmarket/joinin.conf
94+ fi
95+ # check if bitcoin RPC connection is over Tor
96+ if grep -Eq " ^rpc_host = .*.onion" /home/joinmarket/.joinmarket/joinmarket.cfg; then
97+ echo " # RPC over Tor is on"
98+ sed -i " s/^RPCoverTor=.*/RPCoverTor=on/g" /home/joinmarket/joinin.conf
99+ else
100+ echo " # RPC over Tor is off"
101+ sed -i " s/^RPCoverTor=.*/RPCoverTor=off/g" /home/joinmarket/joinin.conf
102+ fi
103+
104+ # check if there is only one wallet and make default
105+ # add default value to joinin config if needed
106+ if ! grep -Eq " ^defaultWallet=" /home/joinmarket/joinin.conf; then
107+ echo " defaultWallet=off" >> /home/joinmarket/joinin.conf
108+ fi
109+ if [ " $( ls -p /home/joinmarket/.joinmarket/wallets/ | grep -cv /) " -gt 1 ]; then
110+ echo " # Found more than one wallet file"
111+ echo " # Setting defaultWallet to off"
112+ sed -i " s#^defaultWallet=.*#defaultWallet=off#g" /home/joinmarket/joinin.conf
113+ elif [ " $( ls -p /home/joinmarket/.joinmarket/wallets/ | grep -cv /) " -eq 1 ]; then
114+ onlyWallet=$( ls -p /home/joinmarket/.joinmarket/wallets/ | grep -v /)
115+ echo " # Found only one wallet file: $onlyWallet "
116+ echo " # Using it as default"
117+ sed -i " s#^defaultWallet=.*#defaultWallet=$onlyWallet #g" /home/joinmarket/joinin.conf
85118fi
0 commit comments