joininbox/scripts/start.script.sh

77 lines
1.5 KiB
Bash
Raw Normal View History

2020-06-13 19:25:26 +01:00
#!/bin/bash
2021-03-02 10:19:53 +00:00
if [ ${#1} -eq 0 ]||[ $1 = "-h" ]||[ $1 = "--help" ];then
echo "# Usage:"
echo "start.script.sh [script] [wallet] [method|nomethod] [mixdepth|nomixdepth]\
[makercount|nomakercount] <amount|PSBT> <address> <nickname>"
2021-10-03 00:37:34 +01:00
echo "# Applies 'torsocks' automatically"
2021-03-02 10:19:53 +00:00
fi
source /home/joinmarket/_functions.sh
2020-06-22 20:53:48 +01:00
2020-06-13 19:25:26 +01:00
script="$1"
if [ ${#script} -eq 0 ]; then
2020-06-15 15:34:43 +01:00
echo "must specify a script to run"
2020-06-16 13:12:56 +01:00
exit 1
2020-06-13 19:25:26 +01:00
fi
2020-06-16 14:29:39 +01:00
wallet="$2"
2020-06-16 13:12:56 +01:00
if [ ${#wallet} -eq 0 ] || [ ${wallet} == "" ]; then
2020-06-22 15:15:28 +01:00
echo "must specify a wallet to use"
exit 1
2020-06-15 15:34:43 +01:00
fi
2021-03-02 10:19:53 +00:00
method="$3"
if [ ${#method} -eq 0 ] || [ ${method} = "nomethod" ]; then
method=""
2020-06-13 19:25:26 +01:00
fi
2020-06-15 15:34:43 +01:00
mixdepth="$4"
2021-03-02 21:22:19 +00:00
if [ ${#mixdepth} -eq 0 ] || [ ${mixdepth} = "nomixdepth" ]; then
2020-06-15 15:34:43 +01:00
mixdepth=""
else
mixdepth="-m$4"
fi
2020-06-13 19:25:26 +01:00
2020-06-15 15:34:43 +01:00
makercount="$5"
2020-06-21 11:33:57 +01:00
if [ ${#makercount} -eq 0 ] || [ ${makercount} = "nomakercount" ]; then
2020-06-15 15:34:43 +01:00
makercount=""
else
makercount="-N$5"
fi
2020-06-13 19:25:26 +01:00
2020-06-15 15:34:43 +01:00
amount="$6"
if [ ${#amount} -eq 0 ]; then
amount=""
fi
address="$7"
if [ ${#address} -eq 0 ]; then
address=""
fi
nickname="$8"
if [ ${#nickname} -eq 0 ]; then
nickname=""
else
nickname="-T $8"
fi
2020-06-17 14:52:34 +01:00
source /home/joinmarket/joinin.conf
if [ ${RPCoverTor} = "on" ]; then
2021-10-03 00:37:34 +01:00
tor="torsocks"
2020-06-15 15:34:43 +01:00
else
tor=""
fi
2020-06-13 19:25:26 +01:00
2020-06-22 20:53:48 +01:00
clear
# display
2020-06-22 20:53:48 +01:00
echo "Running the command:
2020-06-22 14:37:32 +01:00
$tor python $script.py \
2021-03-02 10:19:53 +00:00
$makercount $mixdepth $(echo $wallet | sed "s#$walletPath##g") $method \
$amount $address $nickname
2020-06-22 20:53:48 +01:00
"
# run
. /home/joinmarket/joinmarket-clientserver/jmvenv/bin/activate
$tor python ~/joinmarket-clientserver/scripts/$script.py \
2021-03-02 10:19:53 +00:00
$makercount $mixdepth $wallet $method $amount $address $nickname