basicswap-bash/bsx/tails_setup.sh

65 lines
2.7 KiB
Bash
Raw Normal View History

2024-06-04 02:20:34 +00:00
#!/bin/bash
# Colors
2024-11-09 03:03:53 +00:00
red="printf \e[31;1m"
green="printf \e[32;1m"
nocolor="printf \e[0m"
2024-06-04 02:20:34 +00:00
## Clone basicswap git
cd $SWAP_DATADIR
2024-11-09 20:39:55 +00:00
if [[ -d basicswap ]]; then
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
2024-10-18 23:12:49 +00:00
## Macos
if [[ $MACOS ]]; then
2024-11-09 03:03:53 +00:00
$SWAP_DATADIR/venv/bin/pip3 install certifi
2024-10-18 23:12:49 +00:00
fi
## Install basicswap, coincurve, and pip dependencies
2024-11-09 03:03:53 +00:00
torsocks $SWAP_DATADIR/venv/bin/pip3 install -r requirements.txt --require-hashes
torsocks $SWAP_DATADIR/venv/bin/pip3 install .
2024-06-04 02:20:34 +00:00
# Use Tor if we want
enable_tor() {
if [[ "$tor_on" = 1 ]]; then
2024-06-05 18:36:36 +00:00
$HOME/.local/bin/bsx-enabletor
2024-06-04 02:20:34 +00:00
fi
}
# Use the custom Monero node & add wownero because its a small chain
if [[ "$particl_mnemonic" && "$monerod_addr" ]]; then
# Restore seed
PARTICL_MNEMONIC=$particl_mnemonic
2024-10-18 23:12:49 +00:00
XMR_RPC_HOST=$monerod_addr XMR_RPC_PORT=$monerod_port \
2024-11-09 20:39:55 +00:00
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
2024-06-04 02:20:34 +00:00
enable_tor
elif [[ "$particl_mnemonic" ]]; then
# Restore seed
PARTICL_MNEMONIC=$particl_mnemonic
2024-11-09 20:39:55 +00:00
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
2024-06-04 02:20:34 +00:00
enable_tor
elif [[ "$monerod_addr" ]]; then
# Setup new install and use a remote monero node
2024-10-18 23:12:49 +00:00
XMR_RPC_HOST=$monerod_addr XMR_RPC_PORT=$monerod_port \
2024-11-09 20:39:55 +00:00
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
2024-11-09 03:03:53 +00:00
$red"\n\nMake note of your seed above\n\n"; $nocolor
2024-06-04 02:20:34 +00:00
enable_tor
else
# Setup new install using local nodes
2024-11-09 20:39:55 +00:00
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
2024-11-09 03:03:53 +00:00
$red"\n\nMake note of your seed above\n\n"; $nocolor
2024-06-04 02:20:34 +00:00
enable_tor
fi
2024-10-18 23:12:49 +00:00
$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