mirror of
https://github.com/nahuhh/basicswap-bash.git
synced 2024-12-22 19:49:21 +00:00
Compare commits
6 commits
ad4aef7a49
...
cb9b58be99
Author | SHA1 | Date | |
---|---|---|---|
|
cb9b58be99 | ||
|
62137e7512 | ||
|
facb79dee2 | ||
|
11c373aab1 | ||
|
4f6a58c29a | ||
|
5a3e24441d |
11 changed files with 142 additions and 25 deletions
|
@ -4,14 +4,14 @@ BasicSwapDEX on Windows(WSL)/Debian/Ubuntu/Arch/Fedora
|
|||
|
||||
### New Installation
|
||||
```bash
|
||||
git clone https://github.com/nahuhh/basicswap-bash
|
||||
git clone https://github.com/nahuhh/basicswap-bash -b dev
|
||||
cd basicswap-bash && ./install.sh
|
||||
cd .. && rm -rf basicswap-bash
|
||||
```
|
||||
### Update scripts from older versions
|
||||
``` bash
|
||||
cd ~/coinswaps/basicswap
|
||||
git clone https://github.com/nahuhh/basicswap-bash
|
||||
git clone https://github.com/nahuhh/basicswap-bash -b dev
|
||||
cd basicswap-bash
|
||||
mkdir -p $HOME/.local/bin
|
||||
rm -r $HOME/.local/bin/bsx
|
||||
|
|
|
@ -1,5 +1,21 @@
|
|||
#!/bin/bash
|
||||
export SWAP_DATADIR=$HOME/coinswaps
|
||||
python3 -m venv "$SWAP_DATADIR/venv"
|
||||
|
||||
# Colors
|
||||
red="echo -e -n \e[31;1m"
|
||||
green="echo -e -n \e[32;1m"
|
||||
nocolor="echo -e -n \e[0m"
|
||||
|
||||
if [[ -f $SWAP_DATADIR/particl/particl.pid ]]; then
|
||||
bsx_pid=$(cat $SWAP_DATADIR/particl/particl.pid)
|
||||
if [[ $bsx_pid ]]; then
|
||||
bsx_run=$(pidof particld | grep $bsx_pid)
|
||||
if [[ $bsx_run ]]; then
|
||||
$red"\nError: BasicSwapDEX is already running.\n"; $nocolor
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
. $SWAP_DATADIR/venv/bin/activate && python -V
|
||||
$HOME/.local/bin/bsx/startup.sh
|
||||
|
|
15
bsx-addcoin
15
bsx-addcoin
|
@ -1,10 +1,23 @@
|
|||
#!/bin/bash
|
||||
export SWAP_DATADIR=$HOME/coinswaps
|
||||
|
||||
# Colors
|
||||
red="echo -e -n \e[31;1m"
|
||||
green="echo -e -n \e[32;1m"
|
||||
nocolor="echo -e -n \e[0m"
|
||||
|
||||
# Check if basicswap is running
|
||||
if [[ -f $SWAP_DATADIR/particl/particl.pid ]]; then
|
||||
bsx_pid=$(cat $SWAP_DATADIR/particl/particl.pid)
|
||||
if [[ $bsx_pid ]]; then
|
||||
bsx_run=$(pidof particld | grep $bsx_pid)
|
||||
if [[ $bsx_run ]]; then
|
||||
$red"\nError: BasicSwapDEX is running.\n"; $nocolor
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
echo -e "BasicSwapDEX is currently:\n[1] Password protected\n[2] NOT password protected\n"
|
||||
until [[ "$l" =~ ^[12]$ ]]; do
|
||||
read -p 'Select an option [1|2]: ' l
|
||||
|
@ -28,6 +41,6 @@ read -p 'Select an option [1|2]: ' l
|
|||
;;
|
||||
esac
|
||||
done
|
||||
export SWAP_DATADIR=$HOME/coinswaps
|
||||
|
||||
. $SWAP_DATADIR/venv/bin/activate && python -V
|
||||
$HOME/.local/bin/bsx/addcoin.sh
|
||||
|
|
|
@ -1,10 +1,23 @@
|
|||
#!/bin/bash
|
||||
export SWAP_DATADIR=$HOME/coinswaps
|
||||
|
||||
# Colors
|
||||
red="echo -e -n \e[31;1m"
|
||||
green="echo -e -n \e[32;1m"
|
||||
nocolor="echo -e -n \e[0m"
|
||||
|
||||
# Check if basicswap is running
|
||||
if [[ -f $SWAP_DATADIR/particl/particl.pid ]]; then
|
||||
bsx_pid=$(cat $SWAP_DATADIR/particl/particl.pid)
|
||||
if [[ $bsx_pid ]]; then
|
||||
bsx_run=$(pidof particld | grep $bsx_pid)
|
||||
if [[ $bsx_run ]]; then
|
||||
$red"\nError: BasicSwapDEX is running.\n"; $nocolor
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
echo -e "BasicSwapDEX is currently:\n[1] Password protected\n[2] NOT password protected\n"
|
||||
until [[ "$l" =~ ^[12]$ ]]; do
|
||||
read -p 'Select an option [1|2]: ' l
|
||||
|
@ -28,6 +41,6 @@ read -p 'Select an option [1|2]: ' l
|
|||
;;
|
||||
esac
|
||||
done
|
||||
export SWAP_DATADIR=$HOME/coinswaps
|
||||
|
||||
. $SWAP_DATADIR/venv/bin/activate && python -V
|
||||
$HOME/.local/bin/bsx/disabletor.sh
|
||||
|
|
|
@ -1,10 +1,23 @@
|
|||
#!/bin/bash
|
||||
export SWAP_DATADIR=$HOME/coinswaps
|
||||
|
||||
# Colors
|
||||
red="echo -e -n \e[31;1m"
|
||||
green="echo -e -n \e[32;1m"
|
||||
nocolor="echo -e -n \e[0m"
|
||||
|
||||
# Check if basicswap is running
|
||||
if [[ -f $SWAP_DATADIR/particl/particl.pid ]]; then
|
||||
bsx_pid=$(cat $SWAP_DATADIR/particl/particl.pid)
|
||||
if [[ $bsx_pid ]]; then
|
||||
bsx_run=$(pidof particld | grep $bsx_pid)
|
||||
if [[ $bsx_run ]]; then
|
||||
$red"\nError: BasicSwapDEX is running.\n"; $nocolor
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
echo -e "BasicSwapDEX is currently:\n[1] Password protected\n[2] NOT password protected\n"
|
||||
until [[ "$l" =~ ^[12]$ ]]; do
|
||||
read -p 'Select an option [1|2]: ' l
|
||||
|
@ -28,6 +41,6 @@ read -p 'Select an option [1|2]: ' l
|
|||
;;
|
||||
esac
|
||||
done
|
||||
export SWAP_DATADIR=$HOME/coinswaps
|
||||
|
||||
. $SWAP_DATADIR/venv/bin/activate && python -V
|
||||
$HOME/.local/bin/bsx/enabletor.sh
|
||||
|
|
|
@ -1,10 +1,23 @@
|
|||
#!/bin/bash
|
||||
export SWAP_DATADIR=$HOME/coinswaps
|
||||
|
||||
# Colors
|
||||
red="echo -e -n \e[31;1m"
|
||||
green="echo -e -n \e[32;1m"
|
||||
nocolor="echo -e -n \e[0m"
|
||||
|
||||
# Check if basicswap is running
|
||||
if [[ -f $SWAP_DATADIR/particl/particl.pid ]]; then
|
||||
bsx_pid=$(cat $SWAP_DATADIR/particl/particl.pid)
|
||||
if [[ $bsx_pid ]]; then
|
||||
bsx_run=$(pidof particld | grep $bsx_pid)
|
||||
if [[ $bsx_run ]]; then
|
||||
$red"\nError: BasicSwapDEX is running.\n"; $nocolor
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
echo -e "BasicSwapDEX is currently:\n[1] Password protected\n[2] NOT password protected\n"
|
||||
until [[ "$l" =~ ^[12]$ ]]; do
|
||||
read -p 'Select an option [1|2]: ' l
|
||||
|
@ -28,6 +41,6 @@ read -p 'Select an option [1|2]: ' l
|
|||
;;
|
||||
esac
|
||||
done
|
||||
export SWAP_DATADIR=$HOME/coinswaps
|
||||
|
||||
. $SWAP_DATADIR/venv/bin/activate && python -V
|
||||
$HOME/.local/bin/bsx/removecoin.sh
|
||||
|
|
18
bsx-update
18
bsx-update
|
@ -1,5 +1,23 @@
|
|||
#!/bin/bash
|
||||
export SWAP_DATADIR=$HOME/coinswaps
|
||||
|
||||
# Colors
|
||||
red="echo -e -n \e[31;1m"
|
||||
green="echo -e -n \e[32;1m"
|
||||
nocolor="echo -e -n \e[0m"
|
||||
|
||||
# Check if basicswap is running
|
||||
if [[ -f $SWAP_DATADIR/particl/particl.pid ]]; then
|
||||
bsx_pid=$(cat $SWAP_DATADIR/particl/particl.pid)
|
||||
if [[ $bsx_pid ]]; then
|
||||
bsx_run=$(pidof particld | grep $bsx_pid)
|
||||
if [[ $bsx_run ]]; then
|
||||
$red"\nError: BasicSwapDEX is running.\n"; $nocolor
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
. $SWAP_DATADIR/venv/bin/activate && python -V
|
||||
|
||||
if [ -f /usr/local/bin/bsx/update.sh ]; then
|
||||
|
|
|
@ -1,10 +1,23 @@
|
|||
#!/bin/bash
|
||||
export SWAP_DATADIR=$HOME/coinswaps
|
||||
|
||||
# Colors
|
||||
red="echo -e -n \e[31;1m"
|
||||
green="echo -e -n \e[32;1m"
|
||||
nocolor="echo -e -n \e[0m"
|
||||
|
||||
# Check if basicswap is running
|
||||
if [[ -f $SWAP_DATADIR/particl/particl.pid ]]; then
|
||||
bsx_pid=$(cat $SWAP_DATADIR/particl/particl.pid)
|
||||
if [[ $bsx_pid ]]; then
|
||||
bsx_run=$(pidof particld | grep $bsx_pid)
|
||||
if [[ $bsx_run ]]; then
|
||||
$red"\nError: BasicSwapDEX is running.\n"; $nocolor
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
echo -e "BasicSwapDEX is currently:\n[1] Password protected\n[2] NOT password protected\n"
|
||||
until [[ "$l" =~ ^[12]$ ]]; do
|
||||
read -p 'Select an option [1|2]: ' l
|
||||
|
@ -28,6 +41,6 @@ read -p 'Select an option [1|2]: ' l
|
|||
;;
|
||||
esac
|
||||
done
|
||||
export SWAP_DATADIR=$HOME/coinswaps
|
||||
|
||||
. $SWAP_DATADIR/venv/bin/activate && python -V
|
||||
$HOME/.local/bin/bsx/upgradecoins.sh
|
||||
|
|
16
bsx/setup.sh
16
bsx/setup.sh
|
@ -7,17 +7,16 @@ 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
|
||||
git clone https://github.com/basicswap/coincurve -b basicswap_v0.2 coincurve-basicswap
|
||||
cd $SWAP_DATADIR/coincurve-basicswap
|
||||
$SWAP_DATADIR/venv/bin/pip install .
|
||||
|
||||
## Clone basicswap git
|
||||
cd $SWAP_DATADIR
|
||||
git clone https://github.com/basicswap/basicswap
|
||||
git clone https://github.com/basicswap/basicswap -b dev
|
||||
cd $SWAP_DATADIR/basicswap
|
||||
## Install basicswap
|
||||
$SWAP_DATADIR/venv/bin/pip install wheel
|
||||
$SWAP_DATADIR/venv/bin/pip install .
|
||||
|
||||
## Decide a source for Monero's restore height
|
||||
|
@ -42,7 +41,7 @@ enable_tor() {
|
|||
if [[ "$particl_mnemonic" && "$monerod_addr" ]]; then
|
||||
# Restore seed
|
||||
PARTICL_MNEMONIC=$particl_mnemonic
|
||||
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 --particl_mnemonic="$PARTICL_MNEMONIC"
|
||||
enable_tor
|
||||
elif [[ "$particl_mnemonic" ]]; then
|
||||
|
@ -52,7 +51,7 @@ elif [[ "$particl_mnemonic" ]]; then
|
|||
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
|
||||
|
@ -63,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\nYou'll need to open a new login shell (a new terminal window) for the start scripts to be recognized.\n";$nocolor
|
||||
$red"XFCE will require you to logout / login";$nocolor
|
||||
|
|
|
@ -3,7 +3,7 @@ cd $SWAP_DATADIR/basicswap
|
|||
|
||||
# Download updated scripts
|
||||
echo "Updating basicswap-bash scripts" && sleep 1
|
||||
git clone https://github.com/nahuhh/basicswap-bash
|
||||
git clone https://github.com/nahuhh/basicswap-bash -b dev
|
||||
cd basicswap-bash
|
||||
|
||||
# Move scripts
|
||||
|
@ -30,4 +30,4 @@ $SWAP_DATADIR/venv/bin/pip install .
|
|||
$HOME/.local/bin/bsx/auto_coinupd8.sh
|
||||
|
||||
# Cleanup
|
||||
rm -rf basicswap-bash core_versions
|
||||
rm -rf basicswap-bash
|
||||
|
|
30
install.sh
30
install.sh
|
@ -1,10 +1,23 @@
|
|||
#/bin/bash
|
||||
export SWAP_DATADIR=$HOME/coinswaps
|
||||
|
||||
# Colors
|
||||
red="echo -e -n \e[31;1m"
|
||||
green="echo -e -n \e[32;1m"
|
||||
nocolor="echo -e -n \e[0m"
|
||||
|
||||
# Check if basicswap is running
|
||||
if [[ -f $SWAP_DATADIR/particl/particl.pid ]]; then
|
||||
bsx_pid=$(cat $SWAP_DATADIR/particl/particl.pid)
|
||||
if [[ $bsx_pid ]]; then
|
||||
bsx_run=$(pidof particld | grep $bsx_pid)
|
||||
if [[ $bsx_run ]]; then
|
||||
$red"\nError: BasicSwapDEX is already installed.\n"; $nocolor
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Title Bar
|
||||
$green "\n"
|
||||
title="BasicSwapDEX Installer"
|
||||
|
@ -66,9 +79,9 @@ detect_os_arch
|
|||
|
||||
## Update & Install dependencies
|
||||
echo -e "\n\nInstalling dependencies\nPress CTRL-C at password prompt(s) to skip. If skipped, you must install the dependencies manually before proceeding"
|
||||
$green"$UPDATE\n$INSTALL $DEPENDENCY git curl wget unzip automake libtool jq\n"; $nocolor
|
||||
$green"$UPDATE\n$INSTALL $DEPENDENCY curl automake libtool jq\n"; $nocolor
|
||||
$UPDATE
|
||||
$INSTALL $DEPENDENCY git curl wget unzip automake libtool jq
|
||||
$INSTALL $DEPENDENCY curl automake libtool jq
|
||||
|
||||
# Enable tor
|
||||
echo -e "\n\n[1] Tor ON (requires sudo)\n[2] Tor OFF\n"
|
||||
|
@ -169,19 +182,24 @@ if ! [[ $trasherdk ]]; then
|
|||
mkdir -p $HOME/.local/bin
|
||||
fi
|
||||
# Move scripts to .local/bin
|
||||
if [ -d $HOME/.local/bin/bsx ]; then
|
||||
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*
|
||||
# Enable .profile detection on XFCE
|
||||
xfce_check=$(echo $XDG_CURRENT_DESKTOP | grep XFCE)
|
||||
xsessionrc_check=$(cat ~/.xsessionrc | grep '. ~/.profile')
|
||||
if [[ $xfce_chek ]] && [[ -z $xsessionrc_check ]]; then
|
||||
if [[ $xfce_chek ]]; then
|
||||
if [[ -f $HOME/.xsessionrc ]]; then
|
||||
xsessionrc_check=$(cat ~/.xsessionrc | grep '. ~/.profile')
|
||||
if [[ -z $xsessionrc_check ]]; then
|
||||
echo '. ~/.profile' | tee -a ~/.xsessionrc
|
||||
fi
|
||||
else
|
||||
echo '. ~/.profile' | tee -a ~/.xsessionrc
|
||||
fi
|
||||
fi
|
||||
|
||||
## Make venv and set variables for install
|
||||
export SWAP_DATADIR=$HOME/coinswaps
|
||||
export monerod_addr=$monerod_addr
|
||||
export monerod_port=$monerod_port
|
||||
export particl_mnemonic=$particl_mnemonic
|
||||
|
|
Loading…
Reference in a new issue