diff --git a/basicswap-bash b/basicswap-bash index 2e35e84..d9e785a 100755 --- a/basicswap-bash +++ b/basicswap-bash @@ -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 diff --git a/bsx-addcoin b/bsx-addcoin index e30278b..7fb16b8 100755 --- a/bsx-addcoin +++ b/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 diff --git a/bsx-disabletor b/bsx-disabletor index b891286..d1bd38f 100755 --- a/bsx-disabletor +++ b/bsx-disabletor @@ -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 diff --git a/bsx-enabletor b/bsx-enabletor index 2f201ab..7622993 100755 --- a/bsx-enabletor +++ b/bsx-enabletor @@ -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 diff --git a/bsx-removecoin b/bsx-removecoin index 608be08..2e871d9 100755 --- a/bsx-removecoin +++ b/bsx-removecoin @@ -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 diff --git a/bsx-update b/bsx-update index 431cd73..29254f4 100755 --- a/bsx-update +++ b/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 diff --git a/bsx-upgrade-coins b/bsx-upgrade-coins index b7807d9..ea982e5 100755 --- a/bsx-upgrade-coins +++ b/bsx-upgrade-coins @@ -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 diff --git a/install.sh b/install.sh index 9eee25a..abf071a 100755 --- a/install.sh +++ b/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" @@ -187,7 +200,6 @@ if [[ $xfce_chek ]]; then 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