fix lnbits update options (#3307)

This commit is contained in:
openoms
2022-09-13 18:16:28 +01:00
committed by GitHub
parent 886b8fd7e4
commit 36057e6f87

View File

@@ -2,16 +2,22 @@
# https://github.com/lnbits/lnbits-legend # https://github.com/lnbits/lnbits-legend
# https://github.com/lnbits/lnbits-legend/releases
tag="0.9.1"
# command info # command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo "small config script to switch LNbits on or off" echo "Config script to switch LNbits on or off."
echo "Installs the version ${tag} by default."
echo "Usage:"
echo "bonus.lnbits.sh on [lnd|tlnd|slnd|cl|tcl|scl] [?GITHUBUSER] [?BRANCH|?TAG]" echo "bonus.lnbits.sh on [lnd|tlnd|slnd|cl|tcl|scl] [?GITHUBUSER] [?BRANCH|?TAG]"
echo "bonus.lnbits.sh switch [lnd|tlnd|slnd|cl|tcl|scl]" echo "bonus.lnbits.sh switch [lnd|tlnd|slnd|cl|tcl|scl]"
echo "bonus.lnbits.sh off" echo "bonus.lnbits.sh off"
echo "bonus.lnbits.sh status" echo "bonus.lnbits.sh status"
echo "bonus.lnbits.sh menu" echo "bonus.lnbits.sh menu"
echo "bonus.lnbits.sh prestart" echo "bonus.lnbits.sh prestart"
echo "bonus.lnbits.sh githubsync" echo "bonus.lnbits.sh repo [githubuser] [branch]"
echo "bonus.lnbits.sh sync"
exit 1 exit 1
fi fi
@@ -157,7 +163,7 @@ Consider adding a IP2TOR Bridge under OPTIONS."
echo "Restarting LNbits ..." echo "Restarting LNbits ..."
sudo systemctl restart lnbits sudo systemctl restart lnbits
echo echo
echo "OK new funding source for LNbits active." echo "OK new funding source for LNbits active."
echo "PRESS ENTER to continue" echo "PRESS ENTER to continue"
read key read key
exit 0 exit 0
@@ -348,7 +354,7 @@ if [ "$1" = "repo" ]; then
# check if repo exists # check if repo exists
#githubRepo="https://github.com/${githubUser}/lnbits" #githubRepo="https://github.com/${githubUser}/lnbits"
githubRepo="https://github.com/${githubUser}/lnbits-legend" githubRepo="https://github.com/${githubUser}/lnbits-legend"
httpcode=$(curl -s -o /dev/null -w "%{http_code}" ${githubRepo}) httpcode=$(curl -s -o /dev/null -w "%{http_code}" ${githubRepo})
if [ "${httpcode}" != "200" ]; then if [ "${httpcode}" != "200" ]; then
echo "# tested github repo: ${githubRepo}" echo "# tested github repo: ${githubRepo}"
@@ -359,11 +365,11 @@ if [ "$1" = "repo" ]; then
# change origin repo of lnbits code # change origin repo of lnbits code
echo "# changing LNbits github repo(${githubUser}) branch(${githubBranch})" echo "# changing LNbits github repo(${githubUser}) branch(${githubBranch})"
cd /home/lnbits/lnbits cd /home/lnbits/lnbits
sudo git remote remove origin sudo -u lnbits git remote remove origin
sudo git remote add origin ${githubRepo} sudo -u lnbits git remote add origin ${githubRepo}
sudo git fetch sudo -u lnbits git fetch
sudo git checkout ${githubBranch} sudo -u lnbits git checkout ${githubBranch}
sudo git branch --set-upstream-to=origin/${githubBranch} ${githubBranch} sudo -u lnbits git branch --set-upstream-to=origin/${githubBranch} ${githubBranch}
fi fi
@@ -371,10 +377,20 @@ if [ "$1" = "sync" ] || [ "$1" = "repo" ]; then
echo "# pull all changes from github repo" echo "# pull all changes from github repo"
# output basic info # output basic info
cd /home/lnbits/lnbits cd /home/lnbits/lnbits
sudo git remote -v sudo -u lnbits git remote -v
sudo git branch -v sudo -u lnbits git branch -v
# pull latest code # pull latest code
sudo git pull sudo -u lnbits git pull
# install
sudo -u lnbits python3 -m venv venv
sudo -u lnbits ./venv/bin/pip install -r requirements.txt
sudo -u lnbits ./venv/bin/pip install pylightning
sudo -u lnbits ./venv/bin/pip install secp256k1
sudo -u lnbits ./venv/bin/pip install pyln-client
# build
sudo -u lnbits ./venv/bin/python build.py
# restart lnbits service # restart lnbits service
sudo systemctl restart lnbits sudo systemctl restart lnbits
echo "# server is restarting ... maybe takes some seconds until available" echo "# server is restarting ... maybe takes some seconds until available"
@@ -453,8 +469,6 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
if [ "$3" != "" ]; then if [ "$3" != "" ]; then
githubUser="$3" githubUser="$3"
fi fi
# https://github.com/lnbits/lnbits-legend/releases
tag="0.9.1"
if [ "$4" != "" ]; then if [ "$4" != "" ]; then
tag="$4" tag="$4"
fi fi
@@ -478,7 +492,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
sudo chown lnbits:lnbits -R /mnt/hdd/app-data/LNBits sudo chown lnbits:lnbits -R /mnt/hdd/app-data/LNBits
sudo bash -c "echo 'LNBITS_DATA_FOLDER=/mnt/hdd/app-data/LNBits' >> /home/lnbits/lnbits/.env" sudo bash -c "echo 'LNBITS_DATA_FOLDER=/mnt/hdd/app-data/LNBits' >> /home/lnbits/lnbits/.env"
# let switch command part do the detail config # let switch command part do the detail config
/home/admin/config.scripts/bonus.lnbits.sh switch ${fundingsource} /home/admin/config.scripts/bonus.lnbits.sh switch ${fundingsource}
# to the install # to the install
@@ -490,6 +504,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
sudo -u lnbits ./venv/bin/pip install -r requirements.txt sudo -u lnbits ./venv/bin/pip install -r requirements.txt
sudo -u lnbits ./venv/bin/pip install pylightning sudo -u lnbits ./venv/bin/pip install pylightning
sudo -u lnbits ./venv/bin/pip install secp256k1 sudo -u lnbits ./venv/bin/pip install secp256k1
sudo -u lnbits ./venv/bin/pip install pyln-client
# build # build
sudo -u lnbits ./venv/bin/python build.py sudo -u lnbits ./venv/bin/python build.py
@@ -570,8 +585,8 @@ EOF
fi fi
echo "# OK install done ... might need to restart or call: sudo systemctl start lnbits" echo "# OK install done ... might need to restart or call: sudo systemctl start lnbits"
# needed for API/WebUI as signal that install ran thru # needed for API/WebUI as signal that install ran thru
echo "result='OK'" echo "result='OK'"
exit 0 exit 0
fi fi
@@ -660,10 +675,10 @@ if [ "$1" = "switch" ]; then
sudo bash -c "echo 'LND_REST_INVOICE_MACAROON=' >> /home/lnbits/lnbits/.env" sudo bash -c "echo 'LND_REST_INVOICE_MACAROON=' >> /home/lnbits/lnbits/.env"
sudo bash -c "echo 'LND_REST_READ_MACAROON=' >> /home/lnbits/lnbits/.env" sudo bash -c "echo 'LND_REST_READ_MACAROON=' >> /home/lnbits/lnbits/.env"
fi fi
if [ "${fundingsource}" == "cl" ] || [ "${fundingsource}" == "tcl" ] || [ "${fundingsource}" == "scl" ]; then if [ "${fundingsource}" == "cl" ] || [ "${fundingsource}" == "tcl" ] || [ "${fundingsource}" == "scl" ]; then
echo "# add the 'lnbits' user to the 'bitcoin' group" echo "# add the 'lnbits' user to the 'bitcoin' group"
sudo /usr/sbin/usermod --append --groups bitcoin lnbits sudo /usr/sbin/usermod --append --groups bitcoin lnbits
echo "# check user" echo "# check user"
@@ -754,7 +769,7 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
# setting value in raspi blitz config # setting value in raspi blitz config
/home/admin/config.scripts/blitz.conf.sh set LNBits "off" /home/admin/config.scripts/blitz.conf.sh set LNBits "off"
# needed for API/WebUI as signal that install ran thru # needed for API/WebUI as signal that install ran thru
echo "result='OK'" echo "result='OK'"
exit 0 exit 0
fi fi