mirror of
https://github.com/nahuhh/basicswap-bash.git
synced 2024-12-22 19:49:21 +00:00
Support for Fedora, Arch, and Mac OS
This commit is contained in:
parent
c0e76d235a
commit
dfe212471d
7 changed files with 119 additions and 22 deletions
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
## Prompt for user input
|
## Prompt for user input
|
||||||
echo -e "\n\nThe following coins can be added (case sensitive)\nbitcoin\ndash\nfiro\nlitecoin\nparticl\npivx\n"
|
echo -e "\n\nThe following coins can be added (case sensitive)\nbitcoin\ndash\nfiro\nlitecoin\npivx\n"
|
||||||
read -p 'Full name of coin to add [example: litecoin] ' addcoin
|
read -p 'Full name of coin to add [example: litecoin] ' addcoin
|
||||||
## Confirm
|
## Confirm
|
||||||
echo -e "\nAdd $addcoin to your BasicSwap install, correct? Press any key to continue. CTRL-C to exit"
|
echo -e "\nAdd $addcoin to your BasicSwap install, correct? Press any key to continue. CTRL-C to exit"
|
||||||
|
|
|
@ -1,13 +1,50 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Colors
|
||||||
|
red="echo -e -n \e[31;1m"
|
||||||
|
green="echo -e -n \e[32;1m"
|
||||||
|
nocolor="echo -e -n \e[0m"
|
||||||
|
|
||||||
|
# Detect Operating system
|
||||||
|
INSTALL=""
|
||||||
|
UPDATE=""
|
||||||
|
INIT_TOR="sudo systemctl restart tor"
|
||||||
|
detect_os_arch() {
|
||||||
|
if type -P apt > /dev/null; then
|
||||||
|
# Debian / Ubuntu / Mint
|
||||||
|
INSTALL="sudo apt install -y"
|
||||||
|
UPDATE="sudo apt update"
|
||||||
|
$green"\nDetected Debian\n";$nocolor
|
||||||
|
elif type -P dnf > /dev/null; then
|
||||||
|
# Fedora
|
||||||
|
INSTALL="sudo dnf install -y"
|
||||||
|
UPDATE="sudo dnf check-update"
|
||||||
|
$green"\nDetected Fedora\n";$nocolor
|
||||||
|
elif type -P pacman > /dev/null; then
|
||||||
|
# Arch Linux
|
||||||
|
INSTALL="sudo pacman -S"
|
||||||
|
UPDATE="sudo pacman -Syu"
|
||||||
|
$green"\nDetected Arch Linux\n";$nocolor
|
||||||
|
elif type -P brew > /dev/null; then
|
||||||
|
# MacOS
|
||||||
|
INSTALL="brew install"
|
||||||
|
$green"\nDetected MacOS\n";$nocolor
|
||||||
|
else
|
||||||
|
$red"Failed to detect OS. Unsupported or unknown distribution.\nInstall Failed.";$nocolor
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
detect_os_arch
|
||||||
|
|
||||||
# Check for Tor installation
|
# Check for Tor installation
|
||||||
torinstall=$(apt-cache policy tor | grep "Installed:" | grep -E -o "[0-9]\w+")
|
if type -P tor > /dev/null; then
|
||||||
if [[ "$torinstall" ]]; then
|
|
||||||
echo -e "\nTor is already installed :)"
|
echo -e "\nTor is already installed :)"
|
||||||
else
|
else
|
||||||
# Install and configure tor
|
# Install and configure tor
|
||||||
echo "Installing Tor..."
|
echo "Installing Tor..."
|
||||||
sudo apt install tor -y
|
$UPDATE
|
||||||
|
$INSTALL tor
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create HashesControlPassword
|
# Create HashesControlPassword
|
||||||
|
@ -25,7 +62,7 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Restart tor to apply
|
# Restart tor to apply
|
||||||
sudo systemctl restart tor
|
$INIT_TOR
|
||||||
echo "Waiting for Tor... 5sec" && sleep 5
|
echo "Waiting for Tor... 5sec" && sleep 5
|
||||||
|
|
||||||
# lol are we there yet?
|
# lol are we there yet?
|
||||||
|
|
16
bsx/setup.sh
16
bsx/setup.sh
|
@ -5,15 +5,16 @@ red="echo -e -n \e[31;1m"
|
||||||
green="echo -e -n \e[32;1m"
|
green="echo -e -n \e[32;1m"
|
||||||
nocolor="echo -e -n \e[0m"
|
nocolor="echo -e -n \e[0m"
|
||||||
|
|
||||||
|
## UBUNTU 22.04 FIX upgrade protobuf inside of venv
|
||||||
|
python -m pip install --upgrade "protobuf<=3.20.1"
|
||||||
|
|
||||||
## Download & Install coincurve stuff
|
## Download & Install coincurve stuff
|
||||||
cd $SWAP_DATADIR
|
cd $SWAP_DATADIR
|
||||||
wget -O coincurve-anonswap.zip https://github.com/tecnovert/coincurve/archive/refs/tags/anonswap_v0.2.zip
|
wget -O coincurve-anonswap.zip https://github.com/tecnovert/coincurve/archive/refs/tags/anonswap_v0.2.zip
|
||||||
unzip -d coincurve-anonswap coincurve-anonswap.zip
|
unzip -d coincurve-anonswap coincurve-anonswap.zip
|
||||||
mv ./coincurve-anonswap/*/{.,}* ./coincurve-anonswap || true
|
mv -f ./coincurve-anonswap/*/{.,}* ./coincurve-anonswap || true
|
||||||
cd $SWAP_DATADIR/coincurve-anonswap
|
cd $SWAP_DATADIR/coincurve-anonswap
|
||||||
pip3 install .
|
$SWAP_DATADIR/venv/bin/pip install .
|
||||||
## UBUNTU 22.04 FIX upgrade protobuf inside of venv
|
|
||||||
python3 -m pip install --upgrade "protobuf<=3.20.1"
|
|
||||||
|
|
||||||
## Clone basicswap git
|
## Clone basicswap git
|
||||||
cd $SWAP_DATADIR
|
cd $SWAP_DATADIR
|
||||||
|
@ -21,7 +22,7 @@ git clone https://github.com/tecnovert/basicswap.git
|
||||||
cd $SWAP_DATADIR/basicswap
|
cd $SWAP_DATADIR/basicswap
|
||||||
## Install basicswap
|
## Install basicswap
|
||||||
protoc -I=basicswap --python_out=basicswap basicswap/messages.proto
|
protoc -I=basicswap --python_out=basicswap basicswap/messages.proto
|
||||||
pip3 install .
|
$SWAP_DATADIR/venv/bin/pip install .
|
||||||
|
|
||||||
## Decide a source for Monero's restore height
|
## Decide a source for Monero's restore height
|
||||||
if [[ "$xmrrestoreheight" ]]; then
|
if [[ "$xmrrestoreheight" ]]; then
|
||||||
|
@ -34,6 +35,11 @@ else
|
||||||
CURRENT_XMR_HEIGHT=$(curl https://localmonero.co/blocks/api/get_stats | jq .height)
|
CURRENT_XMR_HEIGHT=$(curl https://localmonero.co/blocks/api/get_stats | jq .height)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Use Tor if we want
|
||||||
|
if [[ "$tor_on" = 1 ]]; then
|
||||||
|
/usr/local/bin/bsx-enabletor
|
||||||
|
fi
|
||||||
|
|
||||||
# Use the custom Monero node
|
# Use the custom Monero node
|
||||||
if [[ "$monerod_addr" && "$particl_mnemonic" ]]; then
|
if [[ "$monerod_addr" && "$particl_mnemonic" ]]; then
|
||||||
PARTICL_MNEMONIC=$particl_mnemonic
|
PARTICL_MNEMONIC=$particl_mnemonic
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
cd $SWAP_DATADIR/basicswap
|
cd $SWAP_DATADIR/basicswap
|
||||||
git pull
|
git pull
|
||||||
pip3 install .
|
$SWAT_DATADIR/venv/bin/pip install .
|
||||||
|
|
60
install.sh
60
install.sh
|
@ -16,6 +16,59 @@ printf "%${span}s\n" "$title"
|
||||||
printf "%${COLUMNS}s" " " | tr " " "*"
|
printf "%${COLUMNS}s" " " | tr " " "*"
|
||||||
$nocolor
|
$nocolor
|
||||||
|
|
||||||
|
# Detect Operating system
|
||||||
|
INSTALL=""
|
||||||
|
UPDATE=""
|
||||||
|
DEPENDENCY=""
|
||||||
|
detect_os_arch() {
|
||||||
|
if type -P apt > /dev/null; then
|
||||||
|
# Debian / Ubuntu / Mint
|
||||||
|
INSTALL="sudo apt install"
|
||||||
|
UPDATE="sudo apt update"
|
||||||
|
DEPENDENCY="python-is-python3 python3-pip python3-venv gnupg pkg-config protobuf-compiler"
|
||||||
|
$green"\nDetected Debian\n";$nocolor
|
||||||
|
elif type -P dnf > /dev/null; then
|
||||||
|
# Fedora
|
||||||
|
INSTALL="sudo dnf install"
|
||||||
|
UPDATE="sudo dnf check-update"
|
||||||
|
DEPENDENCY="python3-virtualenv python3-pip gnupg2 pkgconf protobuf-compiler"
|
||||||
|
$green"\nDetected Fedora\n";$nocolor
|
||||||
|
elif type -P pacman > /dev/null; then
|
||||||
|
# Arch Linux
|
||||||
|
INSTALL="sudo pacman -S"
|
||||||
|
UPDATE="sudo pacman -Syu"
|
||||||
|
DEPENDENCY="python-pipenv gnupg protobuf pkgconf base-devel"
|
||||||
|
$green"\nDetected Arch Linux\n";$nocolor
|
||||||
|
elif type -P brew > /dev/null; then
|
||||||
|
# MacOS
|
||||||
|
INSTALL="brew install"
|
||||||
|
DEPENDENCY="wget unzip python git protobuf gnupg automake libtool pkg-config curl jq"
|
||||||
|
$green"\nDetected MacOS\n";$nocolor
|
||||||
|
else
|
||||||
|
$red"Failed to detect OS. Unsupported or unknown distribution.\nInstall Failed.";$nocolor
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
detect_os_arch
|
||||||
|
|
||||||
|
# Enable tor
|
||||||
|
echo -e "\n\n[1] Tor ON\n[2] Tor OFF\n"
|
||||||
|
until [[ "$tor_on" =~ ^[12]$ ]]; do
|
||||||
|
read -p 'Select an option: [1|2] ' tor_on
|
||||||
|
case $tor_on in
|
||||||
|
1)
|
||||||
|
$green"\nBasicSwapDEX will use Tor\n";$nocolor
|
||||||
|
;;
|
||||||
|
2)
|
||||||
|
$red"\nBasicSwapDEX will NOT use Tor\n";$nocolor
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
$red"You must answer 1 or 2\n";$nocolor
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
## Particl restore Seed
|
## Particl restore Seed
|
||||||
echo -e "\n\n[1] New Install (default)\n[2] Restore from Particl Seed\n"
|
echo -e "\n\n[1] New Install (default)\n[2] Restore from Particl Seed\n"
|
||||||
until [[ "$restore" =~ ^[12]$ ]]; do
|
until [[ "$restore" =~ ^[12]$ ]]; do
|
||||||
|
@ -85,8 +138,8 @@ done
|
||||||
echo -e "\n\nInstalling dependencies"
|
echo -e "\n\nInstalling dependencies"
|
||||||
read -p 'Press Enter to continue, or CTRL-C to exit.'
|
read -p 'Press Enter to continue, or CTRL-C to exit.'
|
||||||
## Update & Install dependencies
|
## Update & Install dependencies
|
||||||
sudo apt update # python-is-python3 for ubuntu
|
$UPDATE
|
||||||
sudo apt install -y git wget python-is-python3 python3-venv python3-pip gnupg unzip protobuf-compiler automake libtool pkg-config curl jq
|
$INSTALL $DEPENDENCY git wget unzip automake libtool jq
|
||||||
# Move scripts to /usr/local/bin
|
# Move scripts to /usr/local/bin
|
||||||
sudo rm -r /usr/local/bin/bsx* /usr/local/bin/basicswap-bash
|
sudo rm -r /usr/local/bin/bsx* /usr/local/bin/basicswap-bash
|
||||||
sudo mv -f -t /usr/local/bin/ basicswap-bash bsx*
|
sudo mv -f -t /usr/local/bin/ basicswap-bash bsx*
|
||||||
|
@ -96,7 +149,8 @@ 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
|
||||||
mkdir -p "$SWAP_DATADIR/venv"
|
mkdir -p "$SWAP_DATADIR/venv"
|
||||||
python3 -m venv "$SWAP_DATADIR/venv"
|
python -m venv "$SWAP_DATADIR/venv"
|
||||||
## Activate venv
|
## Activate venv
|
||||||
/usr/local/bin/bsx/activate_venv.sh
|
/usr/local/bin/bsx/activate_venv.sh
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#/bin/bash
|
#/bin/bash
|
||||||
# Download Scripts
|
# Download Scripts
|
||||||
wget -O basicswap-bash.tar.gz https://github.com/nahuhh/basicswap-bash/releases/latest/download/basicswap-bash.tar.gz
|
curl -LO https://github.com/nahuhh/basicswap-bash/releases/download/beta/basicswap-beta.tar.gz
|
||||||
tar xvf basicswap-bash.tar.gz
|
tar xvf basicswap-beta.tar.gz
|
||||||
cd basicswap-bash
|
cd basicswap-beta
|
||||||
# Install BasicSwapDEX
|
# Install BasicSwapDEX
|
||||||
./install.sh
|
./install.sh
|
||||||
# Cleanup
|
# Cleanup
|
||||||
cd ..
|
cd ..
|
||||||
rm -rf basicswap-bash
|
rm -rf basicswap-beta
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
#/bin/bash
|
#/bin/bash
|
||||||
# Download updated scripts
|
# Download updated scripts
|
||||||
wget -O basicswap-bash.tar.gz https://github.com/nahuhh/basicswap-bash/releases/latest/download/basicswap-bash.tar.gz
|
curl -LO https://github.com/nahuhh/basicswap-bash/releases/download/beta/basicswap-beta.tar.gz
|
||||||
tar xvf basicswap-bash.tar.gz
|
tar xvf basicswap-beta.tar.gz
|
||||||
cd basicswap-bash
|
cd basicswap-beta
|
||||||
# Move scripts
|
# Move scripts
|
||||||
sudo rm -rf /usr/local/bin/bsx
|
sudo rm -rf /usr/local/bin/bsx
|
||||||
sudo mv -f basic* bsx* /usr/local/bin/
|
sudo mv -f basic* bsx* /usr/local/bin/
|
||||||
# Cleanup install
|
# Cleanup install
|
||||||
cd ..
|
cd ..
|
||||||
rm -rf basicswap-bash
|
rm -rf basicswap-beta
|
||||||
|
|
Loading…
Reference in a new issue