basicswap-bash/bsx-removecoin

50 lines
1.5 KiB
Text
Raw Permalink Normal View History

2024-02-12 22:57:48 +00:00
#!/bin/bash
2024-09-16 20:58:53 +00:00
export SWAP_DATADIR=$HOME/coinswaps
2024-11-09 20:42:32 +00:00
if [[ $USER == amnesia ]]; then
export SWAP_DATADIR=$HOME/Persistent/coinswaps
fi
2024-06-05 01:12:58 +00:00
# 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-05 01:12:58 +00:00
2024-09-16 20:58:53 +00:00
# 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
2024-11-09 03:03:53 +00:00
bsx_run=$(pgrep particld | grep $bsx_pid)
2024-09-16 20:58:53 +00:00
if [[ $bsx_run ]]; then
$red"\nError: BasicSwapDEX is running.\n"; $nocolor
exit
fi
fi
fi
2024-11-09 03:03:53 +00:00
printf "BasicSwapDEX is currently:\n[1] Password protected\n[2] NOT password protected\n\n"
2024-06-05 01:12:58 +00:00
until [[ "$l" =~ ^[12]$ ]]; do
read -p 'Select an option [1|2]: ' l
case $l in
1)
until [[ $pass1 ]] && [[ $pass1 == $pass2 ]]; do
read -sp 'Enter your BasicSwap password: ' pass1
read -sp $'\nRe-enter your BasicSwap password: ' pass2
if [[ $pass1 == $pass2 ]]; then
export WALLET_ENCRYPTION_PWD=$pass1
else
$red"\nThe passwords entered don't match. Try again\n\n"; $nocolor
fi
done
;;
2)
$nocolor"\nProceeding without a password\n"
;;
*)
$red"You must answer 1 or 2\n"; $nocolor
;;
esac
done
2024-09-16 20:58:53 +00:00
2024-10-17 17:28:56 +00:00
. $SWAP_DATADIR/venv/bin/activate
2024-06-05 18:36:36 +00:00
$HOME/.local/bin/bsx/removecoin.sh