add scripts for updating, adding coins and upgrading nodes

This commit is contained in:
nahuhh 2024-01-22 17:06:38 -05:00
parent 118b4f84e0
commit e7438f33c5
8 changed files with 70 additions and 2 deletions

View file

@ -10,3 +10,9 @@ cd basicswap-bash && ./install.sh
# Running BasicSwapDEX
`basicswap-bash`
# Add coins
`bsx-addcoin`
# Update BSX core
`bsx-update`
# Update blockchains
`bsx-upgrade-coins`

4
bsx-addcoin Executable file
View file

@ -0,0 +1,4 @@
#!/bin/bash
export SWAP_DATADIR=$HOME/coinswaps
. $SWAP_DATADIR/venv/bin/activate && python -V
./dep/addcoin.sh

4
bsx-update Executable file
View file

@ -0,0 +1,4 @@
#!/bin/bash
export SWAP_DATADIR=$HOME/coinswaps
. $SWAP_DATADIR/venv/bin/activate && python -V
./dep/update.sh

4
bsx-upgrade-coins Executable file
View file

@ -0,0 +1,4 @@
#!/bin/bash
export SWAP_DATADIR=$HOME/coinswaps
. $SWAP_DATADIR/venv/bin/activate && python -V
./dep/upgradecoins.sh

28
dep/addcoin.sh Executable file
View file

@ -0,0 +1,28 @@
#!/bin/bash
## Prompt for user input
echo -e "\n\nThe following coins can be added (case sensitive)\nbitcoin\ndash\nfiro\nlitecoin\nparticl\nPIVX\n"
read -p 'Full name of coin to add [example: litecoin] ' addcoin
## Confirm
echo -e "\nAdd $addcoin to your BasicSwap install, correct? Press any key to continue. CTRL-C to exit"
read
## Add the coin
if [ $addcoin = bitcoin ]; then
read -p 'Use --usebtcfastsync for bitcoin? [Y/n] ' btcfastsync
case $btcfastsync in
n | N) confirmed=no;;
*) confirmed=yes;;
esac
if [ $confirmed = yes ]; then
echo using btcfastsync
basicswap-prepare --usebtcfastsync --datadir=/$SWAP_DATADIR --addcoin=$addcoin
else
echo "not using btcfastsync"
basicswap-prepare --datadir=/$SWAP_DATADIR --addcoin=$addcoin
fi
else
echo "not using bitcoin, using $addcoin"
basicswap-prepare --datadir=/$SWAP_DATADIR --addcoin=$addcoin
fi

View file

@ -12,10 +12,14 @@ pip3 install .
cd $SWAP_DATADIR
git clone https://github.com/tecnovert/basicswap.git
cd $SWAP_DATADIR/basicswap
## Install basicswap
protoc -I=basicswap --python_out=basicswap basicswap/messages.proto
pip3 install .
mv basicswap-bash dep/startup.sh /usr/local/bin
# Move scripts to /usr/local/bin
cd $SWAP_DATADIR
sudo mv -f -t /usr/local/bin/ basicswap-bash bsx* dep
## Run basicswap-prepare with particl and monero
CURRENT_XMR_HEIGHT=$(curl "http://$monerod_addr:$monerod_port/get_info" | jq .height)
@ -23,4 +27,4 @@ XMR_RPC_HOST=$monerod_addr BASE_XMR_RPC_PORT=$monerod_port basicswap-prepare --d
echo -e "\n\nMake note of your seed above\n"
echo 'Install complete.
Use `basicswap-bash` to run, `update.sh` to update, and `addcoin.sh` to add a coin'
Use `basicswap-bash` to run, `bsx-update` to update, and `bsx-addcoin` to add a coin'

4
dep/update.sh Executable file
View file

@ -0,0 +1,4 @@
#!/bin/bash
cd $SWAP_DATADIR/basicswap
git pull
pip3 install .

14
dep/upgradecoins.sh Executable file
View file

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