2024-01-22 22:06:38 +00:00
|
|
|
#!/bin/bash
|
|
|
|
export SWAP_DATADIR=$HOME/coinswaps
|
2024-11-09 20:42:32 +00:00
|
|
|
if [[ $USER == amnesia ]]; then
|
|
|
|
export SWAP_DATADIR=$HOME/Persistent/coinswaps
|
|
|
|
fi
|
2024-09-16 20:58:53 +00:00
|
|
|
|
|
|
|
# Colors
|
2024-11-09 03:03:53 +00:00
|
|
|
red="printf \e[31;1m"
|
|
|
|
green="printf \e[32;1m"
|
|
|
|
nocolor="printf \e[0m"
|
2024-09-16 20:58:53 +00:00
|
|
|
|
|
|
|
# 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
|
2024-11-09 03:03:53 +00:00
|
|
|
bsx_run=$(pgrep particld | grep $bsx_pid)
|
2024-09-16 20:58:53 +00:00
|
|
|
if [[ $bsx_run ]]; then
|
|
|
|
$red"\nError: BasicSwapDEX is running.\n"; $nocolor
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2024-10-17 17:28:56 +00:00
|
|
|
. $SWAP_DATADIR/venv/bin/activate
|
2024-06-11 20:51:02 +00:00
|
|
|
|
|
|
|
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
|
2024-10-16 14:52:16 +00:00
|
|
|
cd $SWAP_DATADIR/basicswap
|
|
|
|
|
|
|
|
# Download updated scripts
|
|
|
|
echo "Updating basicswap-bash scripts" && sleep 1
|
2024-11-19 14:51:11 +00:00
|
|
|
git clone https://github.com/nahuhh/basicswap-bash || { $red"Failed to clone repo. Cancelling update."; exit; }
|
2024-10-16 14:52:16 +00:00
|
|
|
cd basicswap-bash
|
|
|
|
|
|
|
|
# Move scripts
|
|
|
|
rm -rf $HOME/.local/bin/bsx
|
|
|
|
mv -f basic* bsx* $HOME/.local/bin/
|
|
|
|
|
|
|
|
# Copy core_versions to basicswap folder
|
|
|
|
mv core_versions $SWAP_DATADIR/basicswap/core_versions
|
|
|
|
|
|
|
|
# Update BasicSwap, coincurve and coin cores
|
2024-06-11 20:51:02 +00:00
|
|
|
$HOME/.local/bin/bsx/update.sh
|
|
|
|
fi
|