Compare commits

..

No commits in common. "98da79699c8eab6ebf5c3ea06d0c4864eac37906" and "c319bcfcd33d954aa67bd6014fa39c6f262addb5" have entirely different histories.

11 changed files with 48 additions and 101 deletions

View file

@ -1,9 +1,5 @@
#!/bin/bash #!/bin/bash
export SWAP_DATADIR=$HOME/coinswaps export SWAP_DATADIR=$HOME/coinswaps
if [[ $USER == amnesia ]]; then
export SWAP_DATADIR=$HOME/Persistent/coinswaps
TAILS=1
fi
# Colors # Colors
red="echo -e -n \e[31;1m" red="echo -e -n \e[31;1m"

View file

@ -1,8 +1,5 @@
#!/bin/bash #!/bin/bash
export SWAP_DATADIR=$HOME/coinswaps export SWAP_DATADIR=$HOME/coinswaps
if [[ $USER == amnesia ]]; then
export SWAP_DATADIR=$HOME/Persistent/coinswaps
fi
# Colors # Colors
red="printf \e[31;1m" red="printf \e[31;1m"

View file

@ -1,8 +1,5 @@
#!/bin/bash #!/bin/bash
export SWAP_DATADIR=$HOME/coinswaps export SWAP_DATADIR=$HOME/coinswaps
if [[ $USER == amnesia ]]; then
export SWAP_DATADIR=$HOME/Persistent/coinswaps
fi
# Colors # Colors
red="printf \e[31;1m" red="printf \e[31;1m"

View file

@ -1,8 +1,5 @@
#!/bin/bash #!/bin/bash
export SWAP_DATADIR=$HOME/coinswaps export SWAP_DATADIR=$HOME/coinswaps
if [[ $USER == amnesia ]]; then
export SWAP_DATADIR=$HOME/Persistent/coinswaps
fi
# Colors # Colors
red="printf \e[31;1m" red="printf \e[31;1m"

View file

@ -1,8 +1,5 @@
#!/bin/bash #!/bin/bash
export SWAP_DATADIR=$HOME/coinswaps export SWAP_DATADIR=$HOME/coinswaps
if [[ $USER == amnesia ]]; then
export SWAP_DATADIR=$HOME/Persistent/coinswaps
fi
# Colors # Colors
red="printf \e[31;1m" red="printf \e[31;1m"

View file

@ -1,8 +1,5 @@
#!/bin/bash #!/bin/bash
export SWAP_DATADIR=$HOME/coinswaps export SWAP_DATADIR=$HOME/coinswaps
if [[ $USER == amnesia ]]; then
export SWAP_DATADIR=$HOME/Persistent/coinswaps
fi
# Colors # Colors
red="printf \e[31;1m" red="printf \e[31;1m"

View file

@ -1,8 +1,5 @@
#!/bin/bash #!/bin/bash
export SWAP_DATADIR=$HOME/coinswaps export SWAP_DATADIR=$HOME/coinswaps
if [[ $USER == amnesia ]]; then
export SWAP_DATADIR=$HOME/Persistent/coinswaps
fi
# Colors # Colors
red="printf \e[31;1m" red="printf \e[31;1m"

View file

@ -1,9 +1,6 @@
#!/bin/bash #!/bin/bash
#set -x #set -x
export SWAP_DATADIR=$HOME/coinswaps SWAP_DATADIR=$HOME/coinswaps
if [[ $USER == amnesia ]]; then
export SWAP_DATADIR=$HOME/Persistent/coinswaps
fi
BINDIR=$SWAP_DATADIR/bin BINDIR=$SWAP_DATADIR/bin
echo "Checking for Coin updates" && sleep 1 echo "Checking for Coin updates" && sleep 1

View file

@ -7,13 +7,8 @@ nocolor="printf \e[0m"
## Clone basicswap git ## Clone basicswap git
cd $SWAP_DATADIR cd $SWAP_DATADIR
if [[ -d basicswap ]]; then git clone https://github.com/basicswap/basicswap
cd $SWAP_DATADIR/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 ## Macos
if [[ $MACOS ]]; then 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 -r requirements.txt --require-hashes
$SWAP_DATADIR/venv/bin/pip3 install . $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 # Use Tor if we want
enable_tor() { enable_tor() {
if [[ "$tor_on" = 1 ]]; then if [[ "$tor_on" = 1 ]]; then
@ -36,26 +42,22 @@ if [[ "$particl_mnemonic" && "$monerod_addr" ]]; then
# Restore seed # Restore seed
PARTICL_MNEMONIC=$particl_mnemonic PARTICL_MNEMONIC=$particl_mnemonic
XMR_RPC_HOST=$monerod_addr XMR_RPC_PORT=$monerod_port \ 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; } basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000 --particl_mnemonic="$PARTICL_MNEMONIC"
$red"\n\nMonero wallet restore height is ${xmrrestoreheight}"; $nocolor
enable_tor enable_tor
elif [[ "$particl_mnemonic" ]]; then elif [[ "$particl_mnemonic" ]]; then
# Restore seed # Restore seed
PARTICL_MNEMONIC=$particl_mnemonic 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; } basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000 --particl_mnemonic="$PARTICL_MNEMONIC"
$red"\n\nMonero wallet restore height is ${xmrrestoreheight}"; $nocolor
enable_tor enable_tor
elif [[ "$monerod_addr" ]]; then elif [[ "$monerod_addr" ]]; then
# Setup new install and use a remote monero node # Setup new install and use a remote monero node
XMR_RPC_HOST=$monerod_addr XMR_RPC_PORT=$monerod_port \ 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; } basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000
$red"\n\nMonero wallet restore height is ${xmrrestoreheight}"; $nocolor
$red"\n\nMake note of your seed above\n\n"; $nocolor $red"\n\nMake note of your seed above\n\n"; $nocolor
enable_tor enable_tor
else else
# Setup new install using local nodes # Setup new install using local nodes
basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$xmrrestoreheight --wowrestoreheight=600000 || { $red"Installation failed. Try again"; exit; } basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000
$red"\n\nMonero wallet restore height is ${xmrrestoreheight}"; $nocolor
$red"\n\nMake note of your seed above\n\n"; $nocolor $red"\n\nMake note of your seed above\n\n"; $nocolor
enable_tor enable_tor
fi fi

View file

@ -7,13 +7,8 @@ nocolor="printf \e[0m"
## Clone basicswap git ## Clone basicswap git
cd $SWAP_DATADIR cd $SWAP_DATADIR
if [[ -d basicswap ]]; then git clone https://github.com/basicswap/basicswap
cd $SWAP_DATADIR/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 ## Macos
if [[ $MACOS ]]; then 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 -r requirements.txt --require-hashes
torsocks $SWAP_DATADIR/venv/bin/pip3 install . 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 # Use Tor if we want
enable_tor() { enable_tor() {
if [[ "$tor_on" = 1 ]]; then if [[ "$tor_on" = 1 ]]; then
@ -36,26 +42,22 @@ if [[ "$particl_mnemonic" && "$monerod_addr" ]]; then
# Restore seed # Restore seed
PARTICL_MNEMONIC=$particl_mnemonic PARTICL_MNEMONIC=$particl_mnemonic
XMR_RPC_HOST=$monerod_addr XMR_RPC_PORT=$monerod_port \ 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; } torsocks basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000 --particl_mnemonic="$PARTICL_MNEMONIC"
$red"\n\nMonero wallet restore height is ${xmrrestoreheight}"; $nocolor
enable_tor enable_tor
elif [[ "$particl_mnemonic" ]]; then elif [[ "$particl_mnemonic" ]]; then
# Restore seed # Restore seed
PARTICL_MNEMONIC=$particl_mnemonic 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; } torsocks basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000 --particl_mnemonic="$PARTICL_MNEMONIC"
$red"\n\nMonero wallet restore height is ${xmrrestoreheight}"; $nocolor
enable_tor enable_tor
elif [[ "$monerod_addr" ]]; then elif [[ "$monerod_addr" ]]; then
# Setup new install and use a remote monero node # Setup new install and use a remote monero node
XMR_RPC_HOST=$monerod_addr XMR_RPC_PORT=$monerod_port \ 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; } torsocks basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000
$red"\n\nMonero wallet restore height is ${xmrrestoreheight}"; $nocolor
$red"\n\nMake note of your seed above\n\n"; $nocolor $red"\n\nMake note of your seed above\n\n"; $nocolor
enable_tor enable_tor
else else
# Setup new install using local nodes # Setup new install using local nodes
basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$xmrrestoreheight --wowrestoreheight=600000 || { $red"Installation failed. Try again"; exit; } torsocks basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000
$red"\n\nMonero wallet restore height is ${xmrrestoreheight}"; $nocolor
$red"\n\nMake note of your seed above\n\n"; $nocolor $red"\n\nMake note of your seed above\n\n"; $nocolor
enable_tor enable_tor
fi fi

View file

@ -1,41 +1,16 @@
#/bin/bash #/bin/bash
#set -x
export SWAP_DATADIR=$HOME/coinswaps export SWAP_DATADIR=$HOME/coinswaps
if [[ $USER == amnesia ]]; then
export SWAP_DATADIR=$HOME/Persistent/coinswaps
fi
# Colors # Colors
red="printf \e[31;1m" red="printf \e[31;1m"
green="printf \e[32;1m" green="printf \e[32;1m"
nocolor="printf \e[0m" 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 # Check if basicswap is running
if [[ -f ${SWAP_DATADIR}/particl/particl.pid ]]; then if [[ -f $SWAP_DATADIR/particl/particl.pid ]]; then
bsx_pid=$(cat ${SWAP_DATADIR}/particl/particl.pid) bsx_pid=$(cat $SWAP_DATADIR/particl/particl.pid)
if [[ $bsx_pid ]]; then if [[ $bsx_pid ]]; then
bsx_run=$(pgrep particld | grep $bsx_pid) bsx_run=$(pidof particld | grep $bsx_pid)
if [[ $bsx_run ]]; then if [[ $bsx_run ]]; then
$red"\nError: BasicSwapDEX is already installed.\n"; $nocolor $red"\nError: BasicSwapDEX is already installed.\n"; $nocolor
exit exit
@ -87,7 +62,7 @@ detect_os_arch() {
# Debian / Ubuntu / Mint # Debian / Ubuntu / Mint
INSTALL="sudo apt install" INSTALL="sudo apt install"
UPDATE="sudo apt update" 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 elif type -p dnf > /dev/null; then
# Fedora # Fedora
INSTALL="sudo dnf install" INSTALL="sudo dnf install"
@ -117,7 +92,7 @@ $INSTALL $DEPENDENCY automake libtool jq
# Enable tor # Enable tor
printf "\n[1] Tor ON (requires sudo)\n[2] Tor OFF\n" printf "\n[1] Tor ON (requires sudo)\n[2] Tor OFF\n"
until [[ "$tor_on" =~ ^[12]$ ]]; do 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 case $tor_on in
1) 1)
$green"BasicSwapDEX will use Tor\n";$nocolor $green"BasicSwapDEX will use Tor\n";$nocolor
@ -134,7 +109,7 @@ done
## Particl restore Seed ## Particl restore Seed
printf "\n[1] New Install (default)\n[2] Restore from Particl Seed\n" printf "\n[1] New Install (default)\n[2] Restore from Particl Seed\n"
until [[ "$restore" =~ ^[12]$ ]]; do until [[ "$restore" =~ ^[12]$ ]]; do
read -p 'Select an option: [1|2]: ' restore read -p 'Select an option: [1|2] ' restore
case $restore in case $restore in
1) 1)
$green"Installing BasicSwapDEX\n"; $nocolor $green"Installing BasicSwapDEX\n"; $nocolor
@ -192,17 +167,10 @@ read -p 'Select an option [1|2]: ' l
else else
$red"The node at $monerod_addr:$monerod_port is not accessible. Try again\n"; $nocolor $red"The node at $monerod_addr:$monerod_port is not accessible. Try again\n"; $nocolor
fi fi
done done
if [[ -z $xmrrestoreheight ]]; then
xmrrestoreheight="${checknode}"
fi
$green"Monero wallet Restore Height set to ${xmrrestoreheight}\n"; $nocolor
;; ;;
2) 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"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 $red"You must answer 1 or 2\n"; $nocolor
@ -246,12 +214,12 @@ fi
cp -r basicswap-bash bsx* $HOME/.local/bin/ cp -r basicswap-bash bsx* $HOME/.local/bin/
## Make venv and set variables for install ## Make venv and set variables for install
export monerod_addr="${monerod_addr}" export monerod_addr=$monerod_addr
export monerod_port="${monerod_port}" export monerod_port=$monerod_port
export particl_mnemonic="${particl_mnemonic}" export particl_mnemonic=$particl_mnemonic
export xmrrestoreheight="${xmrrestoreheight}" export xmrrestoreheight=$xmrrestoreheight
export tor_on="${tor_on}" export tor_on=$tor_on
export TAILS="${TAILS}" export TAILS=$TAILS
python3 -m venv "${SWAP_DATADIR}/venv" python3 -m venv "$SWAP_DATADIR/venv"
## Activate venv ## Activate venv
$HOME/.local/bin/bsx/activate_venv.sh $HOME/.local/bin/bsx/activate_venv.sh