basicswap-bash/bsx/auto_coinupd8.sh

52 lines
927 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
2024-11-30 12:38:34 +00:00
bitcoincash
2024-10-19 03:35:41 +00:00
dash
decred
firo
litecoin
particl
pivx
monero
wownero
)
list=""
select=""
for coin in "${chain[@]}"; do
2024-11-30 12:38:34 +00:00
if [[ $coin == bitcoincash ]]; then
coind="bitcoin"
elif [[ $coin == decred ]]; then
coind="dcr"
else
coind="$coin"
fi
2024-10-19 03:35:41 +00:00
if [[ -d $BINDIR/$coin ]]; then
2024-11-30 12:38:34 +00:00
UPDATE=$($BINDIR/$coin/"$coind"d --version | head -n 1 | grep -Fxf $SWAP_DATADIR/basicswap/core_versions)
2024-10-19 03:35:41 +00:00
fi
2024-11-30 12:38:34 +00:00
if [[ -z $UPDATE ]]; then
select+="$coin,"
list="${select%,}"
fi
done
2024-10-19 03:35:41 +00:00
if [[ -n $select ]]; then
2024-11-30 12:38:34 +00:00
echo "Updating $list"
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