mirror of
https://github.com/nahuhh/basicswap-bash.git
synced 2024-12-22 19:49:21 +00:00
Compare commits
No commits in common. "98da79699c8eab6ebf5c3ea06d0c4864eac37906" and "c319bcfcd33d954aa67bd6014fa39c6f262addb5" have entirely different histories.
98da79699c
...
c319bcfcd3
11 changed files with 48 additions and 101 deletions
|
@ -1,9 +1,5 @@
|
|||
#!/bin/bash
|
||||
export SWAP_DATADIR=$HOME/coinswaps
|
||||
if [[ $USER == amnesia ]]; then
|
||||
export SWAP_DATADIR=$HOME/Persistent/coinswaps
|
||||
TAILS=1
|
||||
fi
|
||||
|
||||
# Colors
|
||||
red="echo -e -n \e[31;1m"
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
#!/bin/bash
|
||||
export SWAP_DATADIR=$HOME/coinswaps
|
||||
if [[ $USER == amnesia ]]; then
|
||||
export SWAP_DATADIR=$HOME/Persistent/coinswaps
|
||||
fi
|
||||
|
||||
# Colors
|
||||
red="printf \e[31;1m"
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
#!/bin/bash
|
||||
export SWAP_DATADIR=$HOME/coinswaps
|
||||
if [[ $USER == amnesia ]]; then
|
||||
export SWAP_DATADIR=$HOME/Persistent/coinswaps
|
||||
fi
|
||||
|
||||
# Colors
|
||||
red="printf \e[31;1m"
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
#!/bin/bash
|
||||
export SWAP_DATADIR=$HOME/coinswaps
|
||||
if [[ $USER == amnesia ]]; then
|
||||
export SWAP_DATADIR=$HOME/Persistent/coinswaps
|
||||
fi
|
||||
|
||||
# Colors
|
||||
red="printf \e[31;1m"
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
#!/bin/bash
|
||||
export SWAP_DATADIR=$HOME/coinswaps
|
||||
if [[ $USER == amnesia ]]; then
|
||||
export SWAP_DATADIR=$HOME/Persistent/coinswaps
|
||||
fi
|
||||
|
||||
# Colors
|
||||
red="printf \e[31;1m"
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
#!/bin/bash
|
||||
export SWAP_DATADIR=$HOME/coinswaps
|
||||
if [[ $USER == amnesia ]]; then
|
||||
export SWAP_DATADIR=$HOME/Persistent/coinswaps
|
||||
fi
|
||||
|
||||
# Colors
|
||||
red="printf \e[31;1m"
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
#!/bin/bash
|
||||
export SWAP_DATADIR=$HOME/coinswaps
|
||||
if [[ $USER == amnesia ]]; then
|
||||
export SWAP_DATADIR=$HOME/Persistent/coinswaps
|
||||
fi
|
||||
|
||||
# Colors
|
||||
red="printf \e[31;1m"
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
#!/bin/bash
|
||||
#set -x
|
||||
export SWAP_DATADIR=$HOME/coinswaps
|
||||
if [[ $USER == amnesia ]]; then
|
||||
export SWAP_DATADIR=$HOME/Persistent/coinswaps
|
||||
fi
|
||||
SWAP_DATADIR=$HOME/coinswaps
|
||||
BINDIR=$SWAP_DATADIR/bin
|
||||
|
||||
echo "Checking for Coin updates" && sleep 1
|
||||
|
|
30
bsx/setup.sh
30
bsx/setup.sh
|
@ -7,13 +7,8 @@ nocolor="printf \e[0m"
|
|||
|
||||
## Clone basicswap git
|
||||
cd $SWAP_DATADIR
|
||||
if [[ -d basicswap ]]; then
|
||||
git clone https://github.com/basicswap/basicswap
|
||||
cd $SWAP_DATADIR/basicswap
|
||||
git pull || { $red"Failed to pull repo. Installation aborted"; exit; }
|
||||
else
|
||||
git clone https://github.com/basicswap/basicswap || { $red"Failed to clone repo. Please run the installer again"; exit; }
|
||||
cd $SWAP_DATADIR/basicswap
|
||||
fi
|
||||
|
||||
## Macos
|
||||
if [[ $MACOS ]]; then
|
||||
|
@ -24,6 +19,17 @@ fi
|
|||
$SWAP_DATADIR/venv/bin/pip3 install -r requirements.txt --require-hashes
|
||||
$SWAP_DATADIR/venv/bin/pip3 install .
|
||||
|
||||
## Decide a source for Monero's restore height
|
||||
if [[ "$xmrrestoreheight" ]]; then
|
||||
CURRENT_XMR_HEIGHT=$xmrrestoreheight
|
||||
elif [[ "$monerod_addr" ]]; then
|
||||
# Use custom Monero node
|
||||
CURRENT_XMR_HEIGHT=$(curl "http://$monerod_addr:$monerod_port/get_info" | jq .height)
|
||||
else
|
||||
# Use public node
|
||||
CURRENT_XMR_HEIGHT=$(curl http://node3.monerodevs.org:18089/get_info | jq .height)
|
||||
fi
|
||||
|
||||
# Use Tor if we want
|
||||
enable_tor() {
|
||||
if [[ "$tor_on" = 1 ]]; then
|
||||
|
@ -36,26 +42,22 @@ if [[ "$particl_mnemonic" && "$monerod_addr" ]]; then
|
|||
# Restore seed
|
||||
PARTICL_MNEMONIC=$particl_mnemonic
|
||||
XMR_RPC_HOST=$monerod_addr XMR_RPC_PORT=$monerod_port \
|
||||
basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$xmrrestoreheight --wowrestoreheight=600000 --particl_mnemonic="$PARTICL_MNEMONIC" || { $red"Installation failed. Try again"; exit; }
|
||||
$red"\n\nMonero wallet restore height is ${xmrrestoreheight}"; $nocolor
|
||||
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 --withcoins=monero,wownero --xmrrestoreheight=$xmrrestoreheight --wowrestoreheight=600000 --particl_mnemonic="$PARTICL_MNEMONIC" || { $red"Installation failed. Try again"; exit; }
|
||||
$red"\n\nMonero wallet restore height is ${xmrrestoreheight}"; $nocolor
|
||||
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 XMR_RPC_PORT=$monerod_port \
|
||||
basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$xmrrestoreheight --wowrestoreheight=600000 || { $red"Installation failed. Try again"; exit; }
|
||||
$red"\n\nMonero wallet restore height is ${xmrrestoreheight}"; $nocolor
|
||||
basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000
|
||||
$red"\n\nMake note of your seed above\n\n"; $nocolor
|
||||
enable_tor
|
||||
else
|
||||
# Setup new install using local nodes
|
||||
basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$xmrrestoreheight --wowrestoreheight=600000 || { $red"Installation failed. Try again"; exit; }
|
||||
$red"\n\nMonero wallet restore height is ${xmrrestoreheight}"; $nocolor
|
||||
basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000
|
||||
$red"\n\nMake note of your seed above\n\n"; $nocolor
|
||||
enable_tor
|
||||
fi
|
||||
|
|
|
@ -7,13 +7,8 @@ nocolor="printf \e[0m"
|
|||
|
||||
## Clone basicswap git
|
||||
cd $SWAP_DATADIR
|
||||
if [[ -d basicswap ]]; then
|
||||
git clone https://github.com/basicswap/basicswap
|
||||
cd $SWAP_DATADIR/basicswap
|
||||
git pull || { $red"Failed to pull repo. Installation aborted"; exit; }
|
||||
else
|
||||
git clone https://github.com/basicswap/basicswap || { $red"Failed to clone repo. Please run the installer again"; exit; }
|
||||
cd $SWAP_DATADIR/basicswap
|
||||
fi
|
||||
|
||||
## Macos
|
||||
if [[ $MACOS ]]; then
|
||||
|
@ -24,6 +19,17 @@ fi
|
|||
torsocks $SWAP_DATADIR/venv/bin/pip3 install -r requirements.txt --require-hashes
|
||||
torsocks $SWAP_DATADIR/venv/bin/pip3 install .
|
||||
|
||||
## Decide a source for Monero's restore height
|
||||
if [[ "$xmrrestoreheight" ]]; then
|
||||
CURRENT_XMR_HEIGHT=$xmrrestoreheight
|
||||
elif [[ "$monerod_addr" ]]; then
|
||||
# Use custom Monero node
|
||||
CURRENT_XMR_HEIGHT=$(curl "http://$monerod_addr:$monerod_port/get_info" | jq .height)
|
||||
else
|
||||
# Use public node
|
||||
CURRENT_XMR_HEIGHT=$(curl http://node3.monerodevs.org:18089/get_info | jq .height)
|
||||
fi
|
||||
|
||||
# Use Tor if we want
|
||||
enable_tor() {
|
||||
if [[ "$tor_on" = 1 ]]; then
|
||||
|
@ -36,26 +42,22 @@ if [[ "$particl_mnemonic" && "$monerod_addr" ]]; then
|
|||
# Restore seed
|
||||
PARTICL_MNEMONIC=$particl_mnemonic
|
||||
XMR_RPC_HOST=$monerod_addr XMR_RPC_PORT=$monerod_port \
|
||||
basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$xmrrestoreheight --wowrestoreheight=600000 --particl_mnemonic="$PARTICL_MNEMONIC" || { $red"Installation failed. Try again"; exit; }
|
||||
$red"\n\nMonero wallet restore height is ${xmrrestoreheight}"; $nocolor
|
||||
torsocks 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 --withcoins=monero,wownero --xmrrestoreheight=$xmrrestoreheight --wowrestoreheight=600000 --particl_mnemonic="$PARTICL_MNEMONIC" || { $red"Installation failed. Try again"; exit; }
|
||||
$red"\n\nMonero wallet restore height is ${xmrrestoreheight}"; $nocolor
|
||||
torsocks 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 XMR_RPC_PORT=$monerod_port \
|
||||
basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$xmrrestoreheight --wowrestoreheight=600000 || { $red"Installation failed. Try again"; exit; }
|
||||
$red"\n\nMonero wallet restore height is ${xmrrestoreheight}"; $nocolor
|
||||
torsocks basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000
|
||||
$red"\n\nMake note of your seed above\n\n"; $nocolor
|
||||
enable_tor
|
||||
else
|
||||
# Setup new install using local nodes
|
||||
basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$xmrrestoreheight --wowrestoreheight=600000 || { $red"Installation failed. Try again"; exit; }
|
||||
$red"\n\nMonero wallet restore height is ${xmrrestoreheight}"; $nocolor
|
||||
torsocks basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000
|
||||
$red"\n\nMake note of your seed above\n\n"; $nocolor
|
||||
enable_tor
|
||||
fi
|
||||
|
|
58
install.sh
58
install.sh
|
@ -1,41 +1,16 @@
|
|||
#/bin/bash
|
||||
#set -x
|
||||
export SWAP_DATADIR=$HOME/coinswaps
|
||||
if [[ $USER == amnesia ]]; then
|
||||
export SWAP_DATADIR=$HOME/Persistent/coinswaps
|
||||
fi
|
||||
|
||||
# Colors
|
||||
red="printf \e[31;1m"
|
||||
green="printf \e[32;1m"
|
||||
nocolor="printf \e[0m"
|
||||
|
||||
# Check if bsx is already installedo
|
||||
chain=(particl monero wownero dash decred firo litecoin bitcoin bitcoincash pivx)
|
||||
for coin in "${chain[@]}"; do
|
||||
if [[ -f "${SWAP_DATADIR}/${coin}/${coin}.conf" ]]; then
|
||||
printf "Existing configuration file found at ${SWAP_DATADIR}/${coin}/${coin}.conf\n"
|
||||
abort=1
|
||||
fi
|
||||
if [[ -f "${SWAP_DATADIR}/${coin}/${coin}d.conf" ]]; then
|
||||
printf "Existing configuration file found at ${SWAP_DATADIR}/${coin}/${coin}d.conf\n"
|
||||
abort=1
|
||||
fi
|
||||
done
|
||||
if [[ -f "${SWAP_DATADIR}/basicswap.json" ]]; then
|
||||
printf "Existing configuration file(s) found at ${SWAP_DATADIR}/basicswap.json.\n"
|
||||
abort=1
|
||||
fi
|
||||
if [[ $abort ]]; then
|
||||
$red"Aborting install\n"; $nocolor; exit
|
||||
fi
|
||||
|
||||
|
||||
# Check if basicswap is running
|
||||
if [[ -f ${SWAP_DATADIR}/particl/particl.pid ]]; then
|
||||
bsx_pid=$(cat ${SWAP_DATADIR}/particl/particl.pid)
|
||||
if [[ -f $SWAP_DATADIR/particl/particl.pid ]]; then
|
||||
bsx_pid=$(cat $SWAP_DATADIR/particl/particl.pid)
|
||||
if [[ $bsx_pid ]]; then
|
||||
bsx_run=$(pgrep particld | grep $bsx_pid)
|
||||
bsx_run=$(pidof particld | grep $bsx_pid)
|
||||
if [[ $bsx_run ]]; then
|
||||
$red"\nError: BasicSwapDEX is already installed.\n"; $nocolor
|
||||
exit
|
||||
|
@ -87,7 +62,7 @@ detect_os_arch() {
|
|||
# Debian / Ubuntu / Mint
|
||||
INSTALL="sudo apt install"
|
||||
UPDATE="sudo apt update"
|
||||
DEPENDENCY="python3-pip python3-venv gnupg pkg-config"
|
||||
DEPENDENCY="python3-pip python3-venv libpython3-dev gnupg pkg-config"
|
||||
elif type -p dnf > /dev/null; then
|
||||
# Fedora
|
||||
INSTALL="sudo dnf install"
|
||||
|
@ -117,7 +92,7 @@ $INSTALL $DEPENDENCY automake libtool jq
|
|||
# Enable tor
|
||||
printf "\n[1] Tor ON (requires sudo)\n[2] Tor OFF\n"
|
||||
until [[ "$tor_on" =~ ^[12]$ ]]; do
|
||||
read -p 'Select an option: [1|2]: ' tor_on
|
||||
read -p 'Select an option: [1|2] ' tor_on
|
||||
case $tor_on in
|
||||
1)
|
||||
$green"BasicSwapDEX will use Tor\n";$nocolor
|
||||
|
@ -134,7 +109,7 @@ done
|
|||
## Particl restore Seed
|
||||
printf "\n[1] New Install (default)\n[2] Restore from Particl Seed\n"
|
||||
until [[ "$restore" =~ ^[12]$ ]]; do
|
||||
read -p 'Select an option: [1|2]: ' restore
|
||||
read -p 'Select an option: [1|2] ' restore
|
||||
case $restore in
|
||||
1)
|
||||
$green"Installing BasicSwapDEX\n"; $nocolor
|
||||
|
@ -192,17 +167,10 @@ read -p 'Select an option [1|2]: ' l
|
|||
else
|
||||
$red"The node at $monerod_addr:$monerod_port is not accessible. Try again\n"; $nocolor
|
||||
fi
|
||||
|
||||
done
|
||||
if [[ -z $xmrrestoreheight ]]; then
|
||||
xmrrestoreheight="${checknode}"
|
||||
fi
|
||||
$green"Monero wallet Restore Height set to ${xmrrestoreheight}\n"; $nocolor
|
||||
;;
|
||||
2)
|
||||
xmrrestoreheight=$(curl -s http://node3.monerodevs.org:18089/get_info | jq .height || { echo "Failed to get Monero blockchain height. Please run the installer again."; exit; })
|
||||
$green"BasicSwapDEX will run the Monero node for you.\n"; $nocolor
|
||||
$green"Monero wallet Restore Height set to ${xmrrestoreheight}\n"; $nocolor
|
||||
;;
|
||||
*)
|
||||
$red"You must answer 1 or 2\n"; $nocolor
|
||||
|
@ -246,12 +214,12 @@ fi
|
|||
cp -r basicswap-bash bsx* $HOME/.local/bin/
|
||||
|
||||
## Make venv and set variables for install
|
||||
export monerod_addr="${monerod_addr}"
|
||||
export monerod_port="${monerod_port}"
|
||||
export particl_mnemonic="${particl_mnemonic}"
|
||||
export xmrrestoreheight="${xmrrestoreheight}"
|
||||
export tor_on="${tor_on}"
|
||||
export TAILS="${TAILS}"
|
||||
python3 -m venv "${SWAP_DATADIR}/venv"
|
||||
export monerod_addr=$monerod_addr
|
||||
export monerod_port=$monerod_port
|
||||
export particl_mnemonic=$particl_mnemonic
|
||||
export xmrrestoreheight=$xmrrestoreheight
|
||||
export tor_on=$tor_on
|
||||
export TAILS=$TAILS
|
||||
python3 -m venv "$SWAP_DATADIR/venv"
|
||||
## Activate venv
|
||||
$HOME/.local/bin/bsx/activate_venv.sh
|
||||
|
|
Loading…
Reference in a new issue