bsx-update: only update once

This commit is contained in:
nahuhh 2024-10-16 14:52:16 +00:00
parent 97a5d1215e
commit 9991176e0e
5 changed files with 17 additions and 74 deletions

View file

@ -25,5 +25,20 @@ if [ -f /usr/local/bin/bsx/update.sh ]; then
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
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

View file

@ -1,46 +0,0 @@
#!/bin/bash
export SWAP_DATADIR=$HOME/coinswaps
# Colors
red="echo -e -n \e[31;1m"
green="echo -e -n \e[32;1m"
nocolor="echo -e -n \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=$(pidof particld | grep $bsx_pid)
if [[ $bsx_run ]]; then
$red"\nError: BasicSwapDEX is running.\n"; $nocolor
exit
fi
fi
fi
echo -e "BasicSwapDEX is currently:\n[1] Password protected\n[2] NOT password protected\n"
until [[ "$l" =~ ^[12]$ ]]; do
read -p 'Select an option [1|2]: ' l
case $l in
1)
until [[ $pass1 ]] && [[ $pass1 == $pass2 ]]; do
read -sp 'Enter your BasicSwap password: ' pass1
read -sp $'\nRe-enter your BasicSwap password: ' pass2
if [[ $pass1 == $pass2 ]]; then
export WALLET_ENCRYPTION_PWD=$pass1
else
$red"\nThe passwords entered don't match. Try again\n\n"; $nocolor
fi
done
;;
2)
$nocolor"\nProceeding without a password\n"
;;
*)
$red"You must answer 1 or 2\n"; $nocolor
;;
esac
done
. $SWAP_DATADIR/venv/bin/activate && python -V
$HOME/.local/bin/bsx/upgradecoins.sh

View file

@ -1,7 +1,7 @@
#!/bin/bash
#set -x
SWAP_DATADIR=$HOME/coinswaps
echo "Checking for Coin updates" && sleep 1
if [[ -d $SWAP_DATADIR/bin/bitcoin ]]; then

View file

@ -1,18 +1,5 @@
#!/bin/bash
COINCURVE=0.2
cd $SWAP_DATADIR/basicswap
# Download updated scripts
echo "Updating basicswap-bash scripts" && sleep 1
git clone https://github.com/nahuhh/basicswap-bash
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
echo "Updating BasicSwapDEX" && sleep 1
# Delete dangling build folder. Same as --no-cache for docker
@ -22,7 +9,7 @@ rm -rf $SWAP_DATADIR/basicswap/build
cd $SWAP_DATADIR
if [[ -d coincurve-basicswap ]]; then
cd coincurve-basicswap
git pull
git fetch
git checkout basicswap_v$COINCURVE
else
git clone https://github.com/basicswap/coincurve -b basicswap_v$COINCURVE coincurve-basicswap && cd $_

View file

@ -1,13 +0,0 @@
#!/bin/bash
## Prompt for user input
echo "You can only upgrade coins which you have already added to your install"
echo -e "\n\nList of coins supported by BasicSwapDEX (case sensitive):\nbitcoin\ndash\ndecred\nfiro\nlitecoin\nmonero\nparticl\npivx\nwownero\n"
read -p 'Full name of coin to upgrade [example: litecoin] ' upgradecoin
## Confirm
read -p $'\nUpgrade '$upgradecoin', correct? Press any key to continue. CTRL-C to exit'
## Upgrade the coin
basicswap-prepare --datadir=$SWAP_DATADIR -preparebinonly --withcoins=$upgradecoin
echo "Upgraded $upgradecoin"