mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-11-20 02:47:34 +01:00
* #5015 refactor delete all but blockchain * #5015 improve delete * #5015 make sure to delete app-data * #5015 deac use old blockchain for now on boot nvme * #5013 set bitcoin wallets dir to app-data * make sure bitcoin wallets exists * fix wallet repair * moving wallet directory * change bitcoin conf path * #5029 mark for repair
66 lines
1.7 KiB
Bash
Executable File
66 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# command info
|
|
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
|
echo "config script to switch the Bitcoin Core wallet on or off"
|
|
echo "network.wallet.sh [status|on|off]"
|
|
exit 1
|
|
fi
|
|
|
|
source /mnt/hdd/app-data/raspiblitz.conf
|
|
source /home/admin/raspiblitz.info
|
|
|
|
# add disablewallet with default value (0) to bitcoin.conf if missing
|
|
if ! grep -Eq "^disablewallet=.*" /mnt/hdd/app-data/${network}/${network}.conf; then
|
|
echo "disablewallet=0" | sudo tee -a /mnt/hdd/app-data/${network}/${network}.conf >/dev/null
|
|
fi
|
|
|
|
# set variable ${disablewallet}
|
|
source <(grep -E "^disablewallet=.*" /mnt/hdd/app-data/${network}/${network}.conf)
|
|
|
|
|
|
###################
|
|
# STATUS
|
|
###################
|
|
if [ "$1" = "status" ]; then
|
|
|
|
echo "##### STATUS disablewallet"
|
|
echo "disablewallet=${disablewallet}"
|
|
|
|
exit 0
|
|
fi
|
|
|
|
|
|
###################
|
|
# switch on
|
|
###################
|
|
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
|
|
|
# bitcoin config for wallet name & dir will be done by bitcoin.check.sh prestart
|
|
|
|
if [ ${disablewallet} == 1 ]; then
|
|
sudo sed -i "s/^disablewallet=.*/disablewallet=0/g" /mnt/hdd/app-data/${network}/${network}.conf
|
|
echo "# Switching the ${network} core wallet on"
|
|
else
|
|
echo "# The ${network} core wallet is already on"
|
|
fi
|
|
source <(/home/admin/_cache.sh get state)
|
|
if [ ${state} != "recovering" ]; then
|
|
echo "# Restarting ${network}d"
|
|
sudo systemctl restart ${network}d
|
|
fi
|
|
exit 0
|
|
fi
|
|
|
|
###################
|
|
# switch off
|
|
###################
|
|
if [ "$1" = "0" ] || [ "$1" = "off" ]; then
|
|
sudo sed -i "s/^disablewallet=.*/disablewallet=1/g" /mnt/hdd/app-data/${network}/${network}.conf
|
|
sudo systemctl restart ${network}d
|
|
exit 0
|
|
fi
|
|
|
|
echo "FAIL - Unknown Parameter $1"
|
|
exit 1
|