mirror of
https://github.com/nahuhh/basicswap-bash.git
synced 2024-12-22 19:49:21 +00:00
Compare commits
3 commits
10e81c85d1
...
72ae7e315e
Author | SHA1 | Date | |
---|---|---|---|
|
72ae7e315e | ||
|
82fd60cd3c | ||
|
e9eee1c826 |
4 changed files with 49 additions and 98 deletions
|
@ -1,85 +1,43 @@
|
|||
#!/bin/bash
|
||||
#set -x
|
||||
set -x
|
||||
SWAP_DATADIR=$HOME/coinswaps
|
||||
BINDIR=$SWAP_DATADIR/bin
|
||||
|
||||
echo "Checking for Coin updates" && sleep 1
|
||||
|
||||
if [[ -d $SWAP_DATADIR/bin/bitcoin ]]; then
|
||||
BTC=$($SWAP_DATADIR/bin/bitcoin/bitcoind --version | grep version | grep -Fxf $SWAP_DATADIR/basicswap/core_versions)
|
||||
if [[ -z $BTC ]]; then
|
||||
echo "Updating Bitcoin"
|
||||
Bitcoin="bitcoin,"
|
||||
fi
|
||||
fi
|
||||
chain=(
|
||||
bitcoin
|
||||
dash
|
||||
decred
|
||||
firo
|
||||
litecoin
|
||||
particl
|
||||
pivx
|
||||
monero
|
||||
wownero
|
||||
)
|
||||
|
||||
if [[ -d $SWAP_DATADIR/bin/dash ]]; then
|
||||
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,"
|
||||
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
|
||||
|
||||
if [[ -d $SWAP_DATADIR/bin/decred ]]; 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
|
||||
echo "Updating $list"
|
||||
|
||||
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
|
||||
if [[ -n $select ]]; then
|
||||
. $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
|
||||
echo "Coin Cores are up to date"
|
||||
fi
|
||||
|
|
|
@ -62,5 +62,5 @@ else
|
|||
enable_tor
|
||||
fi
|
||||
|
||||
$green"Install complete.\n\nUse 'basicswap-bash' to run, 'bsx-update' to update, and 'bsx-addcoin' to add a coin\n\nYou'll need to open a new login shell (a new terminal window) for the start scripts to be recognized.\n";$nocolor
|
||||
$green"Install complete.\n\nUse 'basicswap-bash' to run, 'bsx-update' to update, and 'bsx-addcoin' to add a coin\n\n";$nocolor
|
||||
$red"You may have to logout / login or open a new terminal window for the commands to be detected\n";$nocolor
|
||||
|
|
|
@ -5,20 +5,19 @@ red="echo -e -n \e[31;1m"
|
|||
green="echo -e -n \e[32;1m"
|
||||
nocolor="echo -e -n \e[0m"
|
||||
|
||||
## Download & Install coincurve stuff
|
||||
cd $SWAP_DATADIR
|
||||
wget -O coincurve-anonswap.zip https://github.com/tecnovert/coincurve/archive/refs/tags/anonswap_v0.2.zip
|
||||
unzip -d coincurve-anonswap coincurve-anonswap.zip
|
||||
mv -f ./coincurve-anonswap/*/{.,}* ./coincurve-anonswap || true
|
||||
cd $SWAP_DATADIR/coincurve-anonswap
|
||||
torsocks $SWAP_DATADIR/venv/bin/pip install . # Tails requires torsocks for pip
|
||||
|
||||
## Clone basicswap git
|
||||
cd $SWAP_DATADIR
|
||||
git clone https://github.com/tecnovert/basicswap -b wow
|
||||
git clone https://github.com/basicswap/basicswap
|
||||
cd $SWAP_DATADIR/basicswap
|
||||
## Install basicswap
|
||||
torsocks $SWAP_DATADIR/venv/bin/pip install . # Tails requires torsocks for pip
|
||||
|
||||
## Macos
|
||||
if [[ $MACOS ]]; then
|
||||
$SWAP_DATADIR/venv/bin/pip install certifi
|
||||
fi
|
||||
|
||||
## Install basicswap, coincurve, and pip dependencies
|
||||
torsocks $SWAP_DATADIR/venv/bin/pip install -r requirements.txt --require-hashes
|
||||
torsocks $SWAP_DATADIR/venv/bin/pip install .
|
||||
|
||||
## Decide a source for Monero's restore height
|
||||
if [[ "$xmrrestoreheight" ]]; then
|
||||
|
@ -42,27 +41,20 @@ enable_tor() {
|
|||
if [[ "$particl_mnemonic" && "$monerod_addr" ]]; then
|
||||
# Restore seed
|
||||
PARTICL_MNEMONIC=$particl_mnemonic
|
||||
basicswap-prepare --datadir=$SWAP_DATADIR --particl_mnemonic="$PARTICL_MNEMONIC"
|
||||
# Add coins and use a remote monero node
|
||||
XMR_RPC_HOST=$monerod_addr BASE_XMR_RPC_PORT=$monerod_port \
|
||||
basicswap-prepare --datadir=$SWAP_DATADIR --addcoin=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000
|
||||
XMR_RPC_HOST=$monerod_addr XMR_RPC_PORT=$monerod_port \
|
||||
basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000 --particl_mnemonic="$PARTICL_MNEMONIC"
|
||||
enable_tor
|
||||
|
||||
elif [[ "$particl_mnemonic" ]]; then
|
||||
# Restore seed
|
||||
PARTICL_MNEMONIC=$particl_mnemonic
|
||||
basicswap-prepare --datadir=$SWAP_DATADIR --particl_mnemonic="$PARTICL_MNEMONIC"
|
||||
# Add coins using local nodes
|
||||
basicswap-prepare --datadir=$SWAP_DATADIR --addcoin=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000
|
||||
basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000 --particl_mnemonic="$PARTICL_MNEMONIC"
|
||||
enable_tor
|
||||
|
||||
elif [[ "$monerod_addr" ]]; then
|
||||
# Setup new install and use a remote monero node
|
||||
XMR_RPC_HOST=$monerod_addr BASE_XMR_RPC_PORT=$monerod_port \
|
||||
XMR_RPC_HOST=$monerod_addr XMR_RPC_PORT=$monerod_port \
|
||||
basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000
|
||||
$red"\n\nMake note of your seed above\n"; $nocolor
|
||||
enable_tor
|
||||
|
||||
else
|
||||
# Setup new install using local nodes
|
||||
basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000
|
||||
|
@ -70,4 +62,5 @@ else
|
|||
enable_tor
|
||||
fi
|
||||
|
||||
$green"Install complete.\n\nUse 'basicswap-bash' to run, 'bsx-update' to update, and 'bsx-addcoin' to add a coin\n"; $nocolor
|
||||
$green"Install complete.\n\nUse 'basicswap-bash' to run, 'bsx-update' to update, and 'bsx-addcoin' to add a coin\n\n";$nocolor
|
||||
$red"You may have to logout / login or open a new terminal window for the commands to be detected\n";$nocolor
|
||||
|
|
|
@ -211,7 +211,7 @@ fi
|
|||
if [[ -d $HOME/.local/bin/bsx ]]; then
|
||||
rm -r $HOME/.local/bin/bsx* $HOME/.local/bin/basicswap-bash
|
||||
fi
|
||||
mv -f -t $HOME/.local/bin/ basicswap-bash bsx*
|
||||
cp -r -t $HOME/.local/bin/ basicswap-bash bsx*
|
||||
|
||||
## Make venv and set variables for install
|
||||
export monerod_addr=$monerod_addr
|
||||
|
|
Loading…
Reference in a new issue