mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-03-27 02:01:53 +01:00
* #2891 fix install blips * #2891 move wallet * add exit * #2891 move config over to `on` section
This commit is contained in:
parent
41c0aa5c66
commit
ba68541d2e
@ -25,7 +25,7 @@ fi
|
||||
|
||||
# check and load raspiblitz config to know which network is running
|
||||
source $RASPIBLITZ_INFO
|
||||
source $RASPIBLITZ_CONF
|
||||
source $RASPIBLITZ_CONF 2>/dev/null
|
||||
|
||||
# check if already installed & active
|
||||
isInstalled=$(compgen -u | grep -c ${USERNAME})
|
||||
|
@ -44,40 +44,12 @@ PGPsigner="openoms"
|
||||
PGPpubkeyLink="https://github.com/openoms.gpg"
|
||||
PGPpubkeyFingerprint="13C688DB5B9C745DE4D2E4545BFB77609B081B65"
|
||||
|
||||
source /mnt/hdd/raspiblitz.conf
|
||||
source /mnt/hdd/raspiblitz.conf 2>/dev/null
|
||||
|
||||
# switch on
|
||||
if [ "$1" = "install" ]; then
|
||||
echo "# INSTALL JOINMARKET"
|
||||
|
||||
# check if running Tor
|
||||
if [ ${runBehindTor} = on ]; then
|
||||
echo "# OK, running behind Tor"
|
||||
else
|
||||
echo "# Not running Tor"
|
||||
echo "# Activate Tor from the SERVICES menu before installing JoinMarket."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# make sure the Bitcoin Core wallet is on
|
||||
/home/admin/config.scripts/network.wallet.sh on
|
||||
if [ $(/usr/local/bin/bitcoin-cli -conf=/mnt/hdd/bitcoin/bitcoin.conf listwallets | grep -c wallet.dat) -eq 0 ];then
|
||||
echo "# Create a non-descriptor wallet.dat"
|
||||
/usr/local/bin/bitcoin-cli -conf=/mnt/hdd/bitcoin/bitcoin.conf -named createwallet wallet_name=wallet.dat descriptors=false
|
||||
else
|
||||
isDescriptor=$(/usr/local/bin/bitcoin-cli -conf=/mnt/hdd/bitcoin/bitcoin.conf -rpcwallet=wallet.dat getwalletinfo | grep -c '"descriptors": true,')
|
||||
if [ "$isDescriptor" -gt 0 ]; then
|
||||
# unload
|
||||
bitcoin-cli unloadwallet wallet.dat
|
||||
echo "# Move the wallet.dat with descriptors to /mnt/hdd/bitcoin/descriptors"
|
||||
sudo mv /mnt/hdd/bitcoin/wallet.dat /mnt/hdd/bitcoin/descriptors
|
||||
echo "# Create a non-descriptor wallet.dat"
|
||||
bitcoin-cli -conf=/mnt/hdd/bitcoin/bitcoin.conf -named createwallet wallet_name=wallet.dat descriptors=false
|
||||
else
|
||||
echo "# The non-descriptor wallet.dat is loaded in bitcoind."
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -f "/home/joinmarket/joinmarket-clientserver/jmvenv/bin/activate" ]; then
|
||||
echo "JoinMarket is already installed"
|
||||
else
|
||||
@ -87,11 +59,9 @@ if [ "$1" = "install" ]; then
|
||||
echo "# add the 'joinmarket' user"
|
||||
adduser --disabled-password --gecos "" joinmarket
|
||||
|
||||
echo "# setting PASSWORD_B as the password for the 'joinmarket' user"
|
||||
PASSWORD_B=$(sudo cat /mnt/hdd/${network}/${network}.conf | grep rpcpassword | cut -c 13-)
|
||||
echo "joinmarket:$PASSWORD_B" | sudo chpasswd
|
||||
# add to sudo group (required for installation)
|
||||
adduser joinmarket sudo
|
||||
adduser joinmarket sudo || exit 1
|
||||
|
||||
# configure sudo for usage without password entry for the joinmarket user
|
||||
echo 'joinmarket ALL=(ALL) NOPASSWD:ALL' | EDITOR='tee -a' visudo
|
||||
|
||||
@ -102,21 +72,6 @@ if [ "$1" = "install" ]; then
|
||||
# install the command-line fuzzy finder (https://github.com/junegunn/fzf)
|
||||
bash -c "echo 'source /usr/share/doc/fzf/examples/key-bindings.bash' >> /home/joinmarket/.bashrc"
|
||||
|
||||
# store JoinMarket data on HDD
|
||||
mkdir /mnt/hdd/app-data/.joinmarket 2>/dev/null
|
||||
|
||||
# copy old JoinMarket data to app-data
|
||||
cp -rf /home/admin/joinmarket-clientserver/scripts/wallets /mnt/hdd/app-data/.joinmarket/ 2>/dev/null
|
||||
chown -R joinmarket:joinmarket /mnt/hdd/app-data/.joinmarket
|
||||
ln -s /mnt/hdd/app-data/.joinmarket /home/joinmarket/ 2>/dev/null
|
||||
chown -R joinmarket:joinmarket /home/joinmarket/.joinmarket
|
||||
# specify wallet.dat in old config for multiwallet for multiwallet support
|
||||
if [ -f "/home/joinmarket/.joinmarket/joinmarket.cfg" ] ; then
|
||||
sudo -u joinmarket sed -i "s/^rpc_wallet_file =.*/rpc_wallet_file = wallet.dat/g" \
|
||||
/home/joinmarket/.joinmarket/joinmarket.cfg
|
||||
echo "# specified to use wallet.dat in the recovered joinmarket.cfg"
|
||||
fi
|
||||
|
||||
echo "# adding JoininBox"
|
||||
sudo rm -rf /home/joinmarket/joininbox
|
||||
sudo -u joinmarket git clone https://github.com/openoms/joininbox.git /home/joinmarket/joininbox
|
||||
@ -148,16 +103,10 @@ if [ "$1" = "install" ]; then
|
||||
echo "AllowOutboundLocalhost 1" | sudo tee -a /etc/tor/torsocks.conf
|
||||
sudo systemctl reload tor@default
|
||||
fi
|
||||
|
||||
# joinin.conf settings
|
||||
sudo -u joinmarket touch /home/joinmarket/joinin.conf
|
||||
# add default Tor value to joinin.conf if needed
|
||||
if ! grep -Eq "^runBehindTor" /home/joinmarket/joinin.conf; then
|
||||
echo "runBehindTor=off" | sudo -u joinmarket tee -a /home/joinmarket/joinin.conf
|
||||
fi
|
||||
# setting Tor value in joinin config
|
||||
if grep -Eq "^runBehindTor=on" /mnt/hdd/raspiblitz.conf; then
|
||||
sudo -u joinmarket sed -i "s/^runBehindTor=.*/runBehindTor=on/g" /home/joinmarket/joinin.conf
|
||||
fi
|
||||
sudo -u joinmarket sed -i "s/^runBehindTor=.*/runBehindTor=on/g" /home/joinmarket/joinin.conf
|
||||
|
||||
echo
|
||||
echo "##########"
|
||||
@ -172,25 +121,6 @@ if [ "$1" = "install" ]; then
|
||||
# install tmux
|
||||
apt -y install tmux
|
||||
|
||||
echo
|
||||
echo "#############"
|
||||
echo "# Autostart #"
|
||||
echo "#############"
|
||||
echo "
|
||||
if [ -f \"/home/joinmarket/joinmarket-clientserver/jmvenv/bin/activate\" ]; then
|
||||
. /home/joinmarket/joinmarket-clientserver/jmvenv/bin/activate
|
||||
/home/joinmarket/joinmarket-clientserver/jmvenv/bin/python -c \"import PySide2\"
|
||||
cd /home/joinmarket/joinmarket-clientserver/scripts/
|
||||
fi
|
||||
# shortcut commands
|
||||
source /home/joinmarket/_commands.sh
|
||||
# automatically start main menu for joinmarket unless
|
||||
# when running in a tmux session
|
||||
if [ -z \"\$TMUX\" ]; then
|
||||
/home/joinmarket/menu.sh
|
||||
fi
|
||||
" | sudo -u joinmarket tee -a /home/joinmarket/.bashrc
|
||||
|
||||
echo "##############################################"
|
||||
echo "# Install JoinMarket and configure JoininBox #"
|
||||
echo "##############################################"
|
||||
@ -209,12 +139,79 @@ fi
|
||||
# switch on
|
||||
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||
|
||||
# check if running Tor
|
||||
if [ "${runBehindTor}" = "on" ]; then
|
||||
echo "# OK, running behind Tor"
|
||||
else
|
||||
echo "# Not running Tor"
|
||||
echo "# Activate Tor from the SERVICES menu before installing JoinMarket."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# set password B
|
||||
echo "# setting PASSWORD_B as the password for the 'joinmarket' user"
|
||||
PASSWORD_B=$(sudo cat /mnt/hdd/${network}/${network}.conf | grep rpcpassword | cut -c 13-)
|
||||
echo "joinmarket:$PASSWORD_B" | sudo chpasswd
|
||||
|
||||
if [ -f /home/joinmarket/start.joininbox.sh ]; then
|
||||
echo "# Ok, Joininbox is present"
|
||||
else
|
||||
sudo /home/admin/config.scrips/bonus.joinmarket.sh install
|
||||
fi
|
||||
|
||||
# make sure the Bitcoin Core wallet is on
|
||||
/home/admin/config.scripts/network.wallet.sh on
|
||||
if [ $(/usr/local/bin/bitcoin-cli -conf=/mnt/hdd/bitcoin/bitcoin.conf listwallets | grep -c wallet.dat) -eq 0 ];then
|
||||
echo "# Create a non-descriptor wallet.dat"
|
||||
/usr/local/bin/bitcoin-cli -conf=/mnt/hdd/bitcoin/bitcoin.conf -named createwallet wallet_name=wallet.dat descriptors=false
|
||||
else
|
||||
isDescriptor=$(/usr/local/bin/bitcoin-cli -conf=/mnt/hdd/bitcoin/bitcoin.conf -rpcwallet=wallet.dat getwalletinfo | grep -c '"descriptors": true,')
|
||||
if [ "$isDescriptor" -gt 0 ]; then
|
||||
# unload
|
||||
bitcoin-cli unloadwallet wallet.dat
|
||||
echo "# Move the wallet.dat with descriptors to /mnt/hdd/bitcoin/descriptors"
|
||||
sudo mv /mnt/hdd/bitcoin/wallet.dat /mnt/hdd/bitcoin/descriptors
|
||||
echo "# Create a non-descriptor wallet.dat"
|
||||
bitcoin-cli -conf=/mnt/hdd/bitcoin/bitcoin.conf -named createwallet wallet_name=wallet.dat descriptors=false
|
||||
else
|
||||
echo "# The non-descriptor wallet.dat is loaded in bitcoind."
|
||||
fi
|
||||
fi
|
||||
|
||||
# store JoinMarket data on HDD
|
||||
mkdir /mnt/hdd/app-data/.joinmarket 2>/dev/null
|
||||
|
||||
# copy old JoinMarket data to app-data
|
||||
cp -rf /home/admin/joinmarket-clientserver/scripts/wallets /mnt/hdd/app-data/.joinmarket/ 2>/dev/null
|
||||
chown -R joinmarket:joinmarket /mnt/hdd/app-data/.joinmarket
|
||||
ln -s /mnt/hdd/app-data/.joinmarket /home/joinmarket/ 2>/dev/null
|
||||
chown -R joinmarket:joinmarket /home/joinmarket/.joinmarket
|
||||
# specify wallet.dat in old config for multiwallet for multiwallet support
|
||||
if [ -f "/home/joinmarket/.joinmarket/joinmarket.cfg" ] ; then
|
||||
sudo -u joinmarket sed -i "s/^rpc_wallet_file =.*/rpc_wallet_file = wallet.dat/g" \
|
||||
/home/joinmarket/.joinmarket/joinmarket.cfg
|
||||
echo "# specified to use wallet.dat in the recovered joinmarket.cfg"
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "#############"
|
||||
echo "# Autostart #"
|
||||
echo "#############"
|
||||
echo "
|
||||
if [ -f \"/home/joinmarket/joinmarket-clientserver/jmvenv/bin/activate\" ]; then
|
||||
. /home/joinmarket/joinmarket-clientserver/jmvenv/bin/activate
|
||||
/home/joinmarket/joinmarket-clientserver/jmvenv/bin/python -c \"import PySide2\"
|
||||
cd /home/joinmarket/joinmarket-clientserver/scripts/
|
||||
fi
|
||||
# shortcut commands
|
||||
source /home/joinmarket/_commands.sh
|
||||
# automatically start main menu for joinmarket unless
|
||||
# when running in a tmux session
|
||||
if [ -z \"\$TMUX\" ]; then
|
||||
/home/joinmarket/menu.sh
|
||||
fi
|
||||
" | sudo -u joinmarket tee -a /home/joinmarket/.bashrc
|
||||
|
||||
# configure joinmarket (includes a check if it is installed)
|
||||
if sudo -u joinmarket /home/joinmarket/start.joininbox.sh; then
|
||||
echo "# Start to use by logging in to the 'joinmarket' user with:"
|
||||
|
Loading…
x
Reference in New Issue
Block a user