Skip to content

Commit 66aab26

Browse files
committed
_functions: add backupJMconf
1 parent f8d672a commit 66aab26

1 file changed

Lines changed: 32 additions & 13 deletions

File tree

scripts/_functions.sh

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -268,33 +268,52 @@ function updateJoininBox() {
268268
}
269269

270270
function setIRCtoTor() {
271-
#communicate with IRC servers via Tor
272-
sed -i "s/^host = irc.darkscience.net/#host = irc.darkscience.net/g" /home/joinmarket/.joinmarket/joinmarket.cfg
273-
sed -i "s/^#host = darksci3bfoka7tw.onion/host = darksci3bfoka7tw.onion/g" /home/joinmarket/.joinmarket/joinmarket.cfg
274-
sed -i "s/^host = irc.hackint.org/#host = irc.hackint.org/g" /home/joinmarket/.joinmarket/joinmarket.cfg
275-
sed -i "s/^#host = ncwkrwxpq2ikcngxq3dy2xctuheniggtqeibvgofixpzvrwpa77tozqd.onion/host = ncwkrwxpq2ikcngxq3dy2xctuheniggtqeibvgofixpzvrwpa77tozqd.onion/g" /home/joinmarket/.joinmarket/joinmarket.cfg
276-
sed -i "s/^socks5 = false/#socks5 = false/g" /home/joinmarket/.joinmarket/joinmarket.cfg
277-
sed -i "s/^#socks5 = true/socks5 = true/g" /home/joinmarket/.joinmarket/joinmarket.cfg
278-
sed -i "s/^#port = 6667/port = 6667/g" /home/joinmarket/.joinmarket/joinmarket.cfg
279-
sed -i "s/^#usessl = false/usessl = false/g" /home/joinmarket/.joinmarket/joinmarket.cfg
280-
echo "# Edited the joinmarket.cfg to communicate over Tor only."
271+
source /home/joinmarket/joinin.conf
272+
if [ "${runBehindTor}" = "on" ]; then
273+
sed -i "s/^host = irc.darkscience.net/#host = irc.darkscience.net/g" /home/joinmarket/.joinmarket/joinmarket.cfg
274+
sed -i "s/^#host = darksci3bfoka7tw.onion/host = darksci3bfoka7tw.onion/g" /home/joinmarket/.joinmarket/joinmarket.cfg
275+
sed -i "s/^host = irc.hackint.org/#host = irc.hackint.org/g" /home/joinmarket/.joinmarket/joinmarket.cfg
276+
sed -i "s/^#host = ncwkrwxpq2ikcngxq3dy2xctuheniggtqeibvgofixpzvrwpa77tozqd.onion/host = ncwkrwxpq2ikcngxq3dy2xctuheniggtqeibvgofixpzvrwpa77tozqd.onion/g" /home/joinmarket/.joinmarket/joinmarket.cfg
277+
sed -i "s/^socks5 = false/#socks5 = false/g" /home/joinmarket/.joinmarket/joinmarket.cfg
278+
sed -i "s/^#socks5 = true/socks5 = true/g" /home/joinmarket/.joinmarket/joinmarket.cfg
279+
sed -i "s/^#port = 6667/port = 6667/g" /home/joinmarket/.joinmarket/joinmarket.cfg
280+
sed -i "s/^#usessl = false/usessl = false/g" /home/joinmarket/.joinmarket/joinmarket.cfg
281+
echo "# Edited the joinmarket.cfg to communicate over Tor only."
282+
else
283+
echo "# Tor is not active, will communicate with IRC servers via clearnet"
284+
fi
281285
}
282286

283287
function generateJMconfig() {
284288
if [ ! -f "/home/joinmarket/.joinmarket/joinmarket.cfg" ] ; then
285-
echo "# Generating the joinmarket.cfg"
289+
echo "# Generating joinmarket.cfg with default settings"
286290
echo
287291
. /home/joinmarket/joinmarket-clientserver/jmvenv/bin/activate &&\
288292
cd /home/joinmarket/joinmarket-clientserver/scripts/
289293
python wallet-tool.py generate --datadir=/home/joinmarket/.joinmarket
290294
else
291295
echo "# The joinmarket.cfg is present"
292-
echo ""
296+
echo
293297
fi
298+
setIRCtoTor
294299
# set strict permission to joinmarket.cfg
295300
sudo chmod 600 /home/joinmarket/.joinmarket/joinmarket.cfg || exit 1
296301
}
297302

303+
#backupJMconf
304+
function backupJMconf() {
305+
if [ -f "/home/joinmarket/.joinmarket/joinmarket.cfg" ] ; then
306+
now=$(date +"%Y_%m_%d_%H%M%S")
307+
echo "# Moving the joinmarket.cfg to the filename joinmarket.cfg.backup$now"
308+
mv /home/joinmarket/.joinmarket/joinmarket.cfg \
309+
/home/joinmarket/.joinmarket/joinmarket.cfg.backup$now
310+
echo
311+
else
312+
echo "# The joinmarket.cfg is not present"
313+
echo
314+
fi
315+
}
316+
298317
# updateTor
299318
function updateTor() {
300319
# as in https://2019.www.torproject.org/docs/debian#source
@@ -345,4 +364,4 @@ deb-src https://deb.torproject.org/torproject.org tor-nightly-master-$distro mai
345364
sudo systemctl start tor
346365
echo "# Installed $(tor --version)"
347366
fi
348-
}
367+
}

0 commit comments

Comments
 (0)