mirror of
https://github.com/nahuhh/basicswap-bash.git
synced 2024-12-22 11:39:21 +00:00
47 lines
1.2 KiB
Bash
Executable file
47 lines
1.2 KiB
Bash
Executable file
#!/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
|
|
git clone https://github.com/nahuhh/basicswap-bash || { $red"Failed to clone repo. Cancelling update."; exit; }
|
|
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
|
|
$HOME/.local/bin/bsx/update.sh
|
|
fi
|