2021-09-27 11:12:06 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# command info
|
|
|
|
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ] || [ "$1" = "-help" ]; then
|
2021-10-12 01:09:46 +01:00
|
|
|
echo
|
2021-09-27 11:12:06 +01:00
|
|
|
echo "# script to check CL states"
|
|
|
|
echo "# cl.check.sh basic-setup"
|
|
|
|
echo "# cl.check.sh prestart [mainnet|testnet|signet]"
|
2021-10-12 01:09:46 +01:00
|
|
|
echo
|
2021-09-27 11:12:06 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# load variables
|
|
|
|
source /mnt/hdd/raspiblitz.conf
|
|
|
|
|
|
|
|
source <(/home/admin/config.scripts/network.aliases.sh getvars cl $2)
|
|
|
|
|
|
|
|
######################################################################
|
|
|
|
# PRESTART
|
|
|
|
# is executed by systemd cl services everytime before cl is started
|
|
|
|
# so it tries to make sure the config is in valid shape
|
|
|
|
######################################################################
|
|
|
|
|
2022-02-13 19:24:50 +00:00
|
|
|
# make sure plugins are loaded https://github.com/rootzoll/raspiblitz/issues/2953
|
|
|
|
if [ $(grep -c "^plugin-dir=/home/bitcoin/${netprefix}cl-plugins-enabled" < ${CLCONF}) -eq 0 ];then
|
|
|
|
echo "plugin-dir=/home/bitcoin/${netprefix}cl-plugins-enabled" | tee -a ${CLCONF}
|
|
|
|
fi
|
|
|
|
|
2021-10-17 10:13:57 +01:00
|
|
|
# do not announce 127.0.0.1 https://github.com/rootzoll/raspiblitz/issues/2634
|
|
|
|
if [ $(grep -c "^announce-addr=127.0.0.1" < ${CLCONF}) -gt 0 ];then
|
|
|
|
sed -i "/^announce-addr=127.0.0.1/d" ${CLCONF}
|
|
|
|
fi
|
|
|
|
|
2021-09-27 11:12:06 +01:00
|
|
|
if [ $(grep -c "^sparko" < ${CLCONF}) -gt 0 ];then
|
|
|
|
if [ ! -f /home/bitcoin/${netprefix}cl-plugins-enabled/sparko ]\
|
|
|
|
|| [ "$(eval echo \$${netprefix}sparko)" != "on" ]; then
|
|
|
|
echo "# The Sparko plugin is not present but in config"
|
|
|
|
sed -i "/^sparko/d" ${CLCONF}
|
|
|
|
rm -rf /home/bitcoin/${netprefix}cl-plugins-enabled/sparko
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2021-10-08 16:12:43 +01:00
|
|
|
if [ $(grep -c "^http-pass" < ${CLCONF}) -gt 0 ];then
|
|
|
|
if [ ! -f /home/bitcoin/cl-plugins-enabled/c-lightning-http-plugin ]\
|
|
|
|
|| [ "${clHTTPplugin}" != "on" ]; then
|
|
|
|
echo "# The clHTTPplugin is not present but in config"
|
|
|
|
sed -i "/^http-pass/d" ${CLCONF}
|
|
|
|
rm -rf /home/bitcoin/cl-plugins-enabled/c-lightning-http-plugin
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2021-09-27 11:12:06 +01:00
|
|
|
if [ $(grep -c "^feeadjuster" < ${CLCONF}) -gt 0 ];then
|
|
|
|
if [ ! -f /home/bitcoin/${netprefix}cl-plugins-enabled/feeadjuster.py ]\
|
|
|
|
|| [ "$(eval echo \$${netprefix}feeadjuster)" != "on" ]; then
|
|
|
|
echo "# The feeadjuster plugin is not present but in config"
|
|
|
|
sed -i "/^feeadjuster/d" ${CLCONF}
|
|
|
|
rm -rf /home/bitcoin/${netprefix}cl-plugins-enabled/feeadjuster.py
|
|
|
|
fi
|
2022-02-06 19:56:15 +00:00
|
|
|
fi
|
|
|
|
|
2022-03-08 18:22:40 +00:00
|
|
|
if [ "${LNBitsFunding}" = "${netprefix}cl" ]; then
|
2022-03-06 13:31:51 +00:00
|
|
|
# https://github.com/rootzoll/raspiblitz/issues/3007
|
|
|
|
if [ $(grep -c "^rpc-file-mode=0660" < ${CLCONF}) -eq 0 ]; then
|
|
|
|
echo "rpc-file-mode=0660" | tee -a ${CLCONF}
|
|
|
|
fi
|
2022-05-13 13:06:30 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $(grep -c "^grpc-port" < ${CLCONF}) -gt 0 ];then
|
|
|
|
if [ ! -f /home/bitcoin/${netprefix}cl-plugins-enabled/cln-grpc ]\
|
|
|
|
|| [ "$(eval echo \$${netprefix}cln-grpc-port)" = "off" ]; then
|
|
|
|
echo "# The cln-grpc plugin is not present but in config"
|
|
|
|
sed -i "/^grpc-port/d" ${CLCONF}
|
|
|
|
rm -rf /home/bitcoin/${netprefix}cl-plugins-enabled/cln-grpc
|
|
|
|
fi
|
|
|
|
fi
|