-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbsx-update
executable file
·49 lines (42 loc) · 1.27 KB
/
bsx-update
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
export SWAP_DATADIR=$HOME/coinswaps
if [[ $USER == amnesia ]]; then
export SWAP_DATADIR=$HOME/Persistent/coinswaps
fi
# Colors
red="printf \e[31;1m"
green="printf \e[32;1m"
nocolor="printf \e[0m"
# Check if basicswap is running
if [[ -f $SWAP_DATADIR/particl/particl.pid ]]; then
bsx_pid=$(cat $SWAP_DATADIR/particl/particl.pid)
if [[ $bsx_pid ]]; then
bsx_run=$(pgrep particld | grep $bsx_pid)
if [[ $bsx_run ]]; then
$red"\nError: BasicSwapDEX is running.\n"; $nocolor
exit
fi
fi
fi
. $SWAP_DATADIR/venv/bin/activate
if [ -f /usr/local/bin/bsx/update.sh ]; then
/usr/local/bin/bsx/update.sh
cd /usr/local/bin
sudo rm -rf basicswap-bash bsx*
else
cd $SWAP_DATADIR/basicswap
# Download updated scripts
echo "Updating basicswap-bash scripts" && sleep 1
if [[ -d basicswap-bash ]]; then
cd basicswap-bash
git pull || { $red"Failed to update repo. Cancelling update.\n"; exit; }
else
git clone https://github.com/nahuhh/basicswap-bash || { $red"Failed to clone repo. Cancelling update.\n"; exit; }
cd basicswap-bash
fi
# Move scripts
rm -rf $HOME/.local/bin/bsx $HOME/.local/bin/basicswap-bash
cp -r basic* bsx* $HOME/.local/bin/
# Update BasicSwap, coincurve and coin cores
./bsx/update.sh
fi