basicswap-bash/bsx/auto_coinupd8.sh

47 lines
938 B
Bash
Raw Normal View History

2024-09-16 00:14:47 +00:00
#!/bin/bash
#set -x
2024-11-09 20:42:32 +00:00
export SWAP_DATADIR=$HOME/coinswaps
if [[ $USER == amnesia ]]; then
export SWAP_DATADIR=$HOME/Persistent/coinswaps
fi
2024-10-19 03:35:41 +00:00
BINDIR=$SWAP_DATADIR/bin
2024-10-16 14:52:16 +00:00
2024-09-16 00:14:47 +00:00
echo "Checking for Coin updates" && sleep 1
2024-10-19 03:35:41 +00:00
chain=(
bitcoin
dash
decred
firo
litecoin
particl
pivx
monero
wownero
)
list=""
select=""
for coin in "${chain[@]}"; do
if [[ -d $BINDIR/$coin ]]; then
if [[ $coin == decred ]]; then
UPDATE=$($BINDIR/$coin/dcrd --version | head -n 1 | grep -Fxf $SWAP_DATADIR/basicswap/core_versions)
else
UPDATE=$($BINDIR/$coin/"$coin"d --version | head -n 1 | grep -Fxf $SWAP_DATADIR/basicswap/core_versions)
fi
if [[ -z $UPDATE ]]; then
select+="$coin,"
list=${select%,}
fi
fi
done
echo "Updating $list"
if [[ -n $select ]]; then
2024-09-16 00:14:47 +00:00
. $SWAP_DATADIR/venv/bin/activate
2024-10-19 03:35:41 +00:00
basicswap-prepare --datadir=$SWAP_DATADIR --preparebinonly --withcoins=$list
2024-09-16 00:14:47 +00:00
else
echo "Coin Cores are up to date"
fi