mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-10-09 12:23:11 +02:00
cl-plugin.standard-python: add persist option
This commit is contained in:
@@ -5,10 +5,10 @@ if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ];then
|
|||||||
echo
|
echo
|
||||||
echo "Install and show the output of the chosen plugin for C-lightning"
|
echo "Install and show the output of the chosen plugin for C-lightning"
|
||||||
echo "Usage:"
|
echo "Usage:"
|
||||||
echo "cl-plugin.standard-python.sh on [plugin-name] [testnet|mainnet|signet] [runonce]"
|
echo "cl-plugin.standard-python.sh on [plugin-name] <testnet|mainnet|signet> <persist|runonce>"
|
||||||
echo
|
echo
|
||||||
echo "tested plugins:"
|
echo "tested plugins:"
|
||||||
echo "summary | helpme | feeadjuster"
|
echo "summary | helpme | feeadjuster | paytest"
|
||||||
echo
|
echo
|
||||||
echo "find more at:"
|
echo "find more at:"
|
||||||
echo "https://github.com/lightningd/plugins"
|
echo "https://github.com/lightningd/plugins"
|
||||||
@@ -22,17 +22,34 @@ if [ "$1" = "on" ];then
|
|||||||
|
|
||||||
plugin=$2
|
plugin=$2
|
||||||
|
|
||||||
|
# download
|
||||||
if [ ! -f "/home/bitcoin/cl-plugins-available/plugins/${plugin}/${plugin}.py" ]; then
|
if [ ! -f "/home/bitcoin/cl-plugins-available/plugins/${plugin}/${plugin}.py" ]; then
|
||||||
cd /home/bitcoin/cl-plugins-available || exit 1
|
cd /home/bitcoin/cl-plugins-available || exit 1
|
||||||
sudo -u bitcoin git clone https://github.com/lightningd/plugins.git
|
sudo -u bitcoin git clone https://github.com/lightningd/plugins.git
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $($lightningcli_alias | grep -c "${plugin}") -eq 0 ];then
|
# enable
|
||||||
echo "# Starting the ${plugin} plugin"
|
if [ "$(echo "$@" | grep -c "persist")" -gt 0 ];then
|
||||||
sudo -u bitcoin pip install -r /home/bitcoin/cl-plugins-available/plugins/${plugin}/requirements.txt
|
if [ ! -L /home/bitcoin/${netprefix}cl-plugins-enabled/${plugin}.py ];then
|
||||||
$lightningcli_alias plugin start /home/bitcoin/cl-plugins-available/plugins/${plugin}/${plugin}.py
|
echo "# Symlink to /home/bitcoin/${netprefix}cl-plugins-enabled"
|
||||||
|
sudo ln -s /home/bitcoin/cl-plugins-available/plugins/${plugin}/${plugin}.py \
|
||||||
|
/home/bitcoin/${netprefix}cl-plugins-enabled
|
||||||
|
|
||||||
|
source /home/admin/raspiblitz.info
|
||||||
|
if [ "${state}" == "ready" ]; then
|
||||||
|
echo "# Restart the ${netprefix}lightningd.service to activate the ${plugin} plugin"
|
||||||
|
sudo systemctl restart ${netprefix}lightningd
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
else
|
||||||
|
if [ $($lightningcli_alias | grep -c "${plugin}") -eq 0 ];then
|
||||||
|
echo "# Just start the ${plugin} plugin"
|
||||||
|
sudo -u bitcoin pip install -r /home/bitcoin/cl-plugins-available/plugins/${plugin}/requirements.txt
|
||||||
|
$lightningcli_alias plugin start /home/bitcoin/cl-plugins-available/plugins/${plugin}/${plugin}.py
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "Node URI:"
|
echo "Node URI:"
|
||||||
ln_getinfo=$($lightningcli_alias -H getinfo 2>/dev/null)
|
ln_getinfo=$($lightningcli_alias -H getinfo 2>/dev/null)
|
||||||
|
Reference in New Issue
Block a user