mirror of
https://github.com/nahuhh/basicswap-bash.git
synced 2024-12-22 19:49:21 +00:00
autoupd8: use for loop
This commit is contained in:
parent
82fd60cd3c
commit
72ae7e315e
1 changed files with 31 additions and 73 deletions
|
@ -1,85 +1,43 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#set -x
|
set -x
|
||||||
SWAP_DATADIR=$HOME/coinswaps
|
SWAP_DATADIR=$HOME/coinswaps
|
||||||
|
BINDIR=$SWAP_DATADIR/bin
|
||||||
|
|
||||||
echo "Checking for Coin updates" && sleep 1
|
echo "Checking for Coin updates" && sleep 1
|
||||||
|
|
||||||
if [[ -d $SWAP_DATADIR/bin/bitcoin ]]; then
|
chain=(
|
||||||
BTC=$($SWAP_DATADIR/bin/bitcoin/bitcoind --version | grep version | grep -Fxf $SWAP_DATADIR/basicswap/core_versions)
|
bitcoin
|
||||||
if [[ -z $BTC ]]; then
|
dash
|
||||||
echo "Updating Bitcoin"
|
decred
|
||||||
Bitcoin="bitcoin,"
|
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
|
fi
|
||||||
fi
|
done
|
||||||
|
|
||||||
if [[ -d $SWAP_DATADIR/bin/dash ]]; then
|
echo "Updating $list"
|
||||||
DASH=$($SWAP_DATADIR/bin/dash/dashd --version | grep version | grep -Fxf $SWAP_DATADIR/basicswap/core_versions)
|
|
||||||
if [[ -z $DASH ]]; then
|
|
||||||
echo "Updating Dash"
|
|
||||||
Dash="dash,"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -d $SWAP_DATADIR/bin/decred ]]; then
|
if [[ -n $select ]]; then
|
||||||
DCR=$($SWAP_DATADIR/bin/decred/dcrd --version | grep version | grep -Fxf $SWAP_DATADIR/basicswap/core_versions)
|
|
||||||
if [[ -z $DCR ]]; then
|
|
||||||
echo "Updating Decred"
|
|
||||||
Decred="decred,"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -d $SWAP_DATADIR/bin/firo ]]; then
|
|
||||||
FIRO=$($SWAP_DATADIR/bin/firo/firod --version | grep version | grep -Fxf $SWAP_DATADIR/basicswap/core_versions)
|
|
||||||
if [[ -z $FIRO ]]; then
|
|
||||||
echo "Updating Firo"
|
|
||||||
Firo="firo,"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -d $SWAP_DATADIR/bin/litecoin ]]; then
|
|
||||||
LTC=$($SWAP_DATADIR/bin/litecoin/litecoind --version | grep version | grep -Fxf $SWAP_DATADIR/basicswap/core_versions)
|
|
||||||
if [[ -z $LTC ]]; then
|
|
||||||
echo "Updating Litecoin"
|
|
||||||
Litecoin="litecoin,"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -d $SWAP_DATADIR/bin/particl ]]; then
|
|
||||||
PART=$($SWAP_DATADIR/bin/particl/particld --version | grep version | grep -Fxf $SWAP_DATADIR/basicswap/core_versions)
|
|
||||||
if [[ -z $PART ]]; then
|
|
||||||
echo "Updating Particl"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -d $SWAP_DATADIR/bin/pivx ]]; then
|
|
||||||
PIVX=$($SWAP_DATADIR/bin/pivx/pivxd --version | grep version | grep -Fxf $SWAP_DATADIR/basicswap/core_versions)
|
|
||||||
if [[ -z $PIVX ]]; then
|
|
||||||
echo "Updating PIVX"
|
|
||||||
Pivx="pivx,"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -d $SWAP_DATADIR/bin/monero ]]; then
|
|
||||||
XMR=$($SWAP_DATADIR/bin/monero/monerod --version | grep -Fxf $SWAP_DATADIR/basicswap/core_versions)
|
|
||||||
if [[ -z $XMR ]]; then
|
|
||||||
echo "Updating Monero"
|
|
||||||
Monero="monero,"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -d $SWAP_DATADIR/bin/wownero ]]; then
|
|
||||||
WOW=$($SWAP_DATADIR/bin/wownero/wownerod --version | grep -Fxf $SWAP_DATADIR/basicswap/core_versions)
|
|
||||||
if [[ -z $WOW ]]; then
|
|
||||||
echo "Updating Wownero"
|
|
||||||
Wownero="wownero,"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
sleep 1
|
|
||||||
|
|
||||||
if [[ -n $Bitcoin ]] || [[ -n $Dash ]] || [[ -n $Decred ]] || [[ -n $Firo ]] || [[ -n $Litecoin ]] || [[ -n $Particl ]] || [[ -n $Pivx ]] || [[ -n $Monero ]] || [[ -n $Wownero ]]; then
|
|
||||||
. $SWAP_DATADIR/venv/bin/activate
|
. $SWAP_DATADIR/venv/bin/activate
|
||||||
basicswap-prepare --datadir=$SWAP_DATADIR --preparebinonly --withcoins="$Bitcoin$Dash$Decred$Firo$Litecoin$Pivx$Monero$Wownero"particl
|
basicswap-prepare --datadir=$SWAP_DATADIR --preparebinonly --withcoins=$list
|
||||||
else
|
else
|
||||||
echo "Coin Cores are up to date"
|
echo "Coin Cores are up to date"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue