mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2025-02-25 07:07:46 +01:00
Merge branch '1126-provision' into pre-1.7.1
This commit is contained in:
commit
34bdd3256b
9 changed files with 117 additions and 70 deletions
12
FAQ.md
12
FAQ.md
|
@ -415,13 +415,13 @@ For example if you want to make a build from the 'dev' branch you execute the fo
|
|||
|
||||
If you fork the RaspiBlitz repo (much welcome) and you want to run that code on your RaspiBlitz, there are two ways to do that:
|
||||
|
||||
* The quick way: For small changes in scripts, go to `/home/admin` on your running RaspiBlitz, delete the old git with `sudo rm -r raspiblitz` then replace it with your code `git clone [YOURREPO]` and `/home/admin/XXsyncScripts.sh`
|
||||
* The quick way: For small changes in scripts, go to `/home/admin` on your running RaspiBlitz, delete the old git with `sudo rm -r raspiblitz` then replace it with your code `git clone [YOURREPO]` and `patch`
|
||||
|
||||
* The long way: If you like to install/remove/change services and system configurations you need to build a SD card from your own code. Prepare like in [Build the SD Card Image](README.md#build-the-sd-card-image) from the README but in the end run the command:
|
||||
|
||||
`wget --no-cache https://raw.githubusercontent.com/[GITHUB-USERNAME]/raspiblitz/[BRANCH]/build_sdcard.sh && sudo bash build_sdcard.sh false false [GITHUB-USERNAME] [BRANCH] lcd true true`
|
||||
|
||||
If you are then working in your forked repo and want to update the scripts on your RaspiBlitz with your latest repo changes, run `/home/admin/XXsyncScripts.sh` - That's OK as long as you don't make changes to the SD card build script - for that you would need to build a fresh SD card again from your repo.
|
||||
If you are then working in your forked repo and want to update the scripts on your RaspiBlitz with your latest repo changes, run `patch` - That's OK as long as you don't make changes to the SD card build script - for that you would need to build a fresh SD card again from your repo.
|
||||
|
||||
## How can I checkout a new branch from the RaspiBlitz repo to my forked repo?
|
||||
|
||||
|
@ -452,7 +452,7 @@ git remote set-url origin [THE-URL-OF-YOUR-FORKED-REPO]
|
|||
|
||||
Now to sync your branch namend BRANCH on your forked repo with your RaspiBlitz, you always just run:
|
||||
```
|
||||
/home/admin/XXsyncScripts.sh BRANCH
|
||||
/home/admin/config.scripts/blitz.github.sh BRANCH
|
||||
```
|
||||
|
||||
So your workflow can go like this: You write code on your local computer. Commit to your local repo, push it to your forked repo and use the sync-script above to get the code to your RaspiBlitz.
|
||||
|
@ -473,14 +473,14 @@ cd /home/admin/raspiblitz
|
|||
git fetch origin pull/[PRNUMBER]/head:pr[PRNUMBER]
|
||||
git checkout pr[PRNUMBER]
|
||||
cd /home/admin
|
||||
./XXsyncScripts.sh -justinstall
|
||||
/home/admin/config.scripts/blitz.github.sh -justinstall
|
||||
```
|
||||
|
||||
Now you have the code of the PR active - depending on what scripts are changed you might need to reboot.
|
||||
|
||||
To change back to the code:
|
||||
```
|
||||
./XXsyncScripts.sh master
|
||||
/home/admin/config.scripts/blitz.github.sh master
|
||||
```
|
||||
|
||||
## How to attach the RaspberryPi to the HDD?
|
||||
|
@ -839,7 +839,7 @@ https://seravo.fi/2015/using-raid-btrfs-recovering-broken-disks
|
|||
## How do I fix a displayed Error in my Config?
|
||||
|
||||
When the LCD display is telling you to do a config check:
|
||||
- go to the RaspiBlitz terminal (X on main menu) and run './XXsyncScripts.sh'
|
||||
- go to the RaspiBlitz terminal (X on main menu) and run 'patch'
|
||||
- start reboot with command: 'restart'
|
||||
- go to the RaspiBlitz terminal run the command: 'check'
|
||||
- now edit the RaspiBlitz config and get rid of the errors: 'nano /mnt/hdd/raspiblitz.conf'
|
||||
|
|
|
@ -5,10 +5,10 @@ echo "************* Vagrant Provisioning ********************"
|
|||
echo 'Syncing local code with RaspiBlitzVM'
|
||||
|
||||
# make sure the lastest sync script is in place
|
||||
cp /vagrant/home.admin/XXsyncScripts.sh /home/admin/XXsyncScripts.sh
|
||||
cp /vagrant/home.admin/config.scripts/blitz.github.sh /home/admin/config.scripts/blitz.github.sh
|
||||
|
||||
# execute 'patch' command to sync laptop with VM
|
||||
/home/admin/XXsyncScripts.sh -run
|
||||
/home/admin/config.scripts/blitz.github.sh -run
|
||||
|
||||
source <(/home/admin/config.scripts/internet.sh status)
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ patch()
|
|||
{
|
||||
|
||||
# get sync info
|
||||
source <(sudo /home/admin/XXsyncScripts.sh info)
|
||||
source <(sudo /home/admin/config.scripts/blitz.github.sh info)
|
||||
|
||||
# Patch Options
|
||||
OPTIONS=(PATCH "Patch/Sync RaspiBlitz with GitHub Repo" \
|
||||
|
@ -115,7 +115,7 @@ patch()
|
|||
clear
|
||||
case $CHOICE in
|
||||
PATCH)
|
||||
sudo -u admin /home/admin/XXsyncScripts.sh -run
|
||||
sudo -u admin /home/admin/config.scripts/blitz.github.sh -run
|
||||
sleep 4
|
||||
whiptail --title " Patching/Syncing " --yes-button "Reboot" --no-button "Skip Reboot" --yesno " OK patching/syncing done.
|
||||
|
||||
|
@ -142,7 +142,7 @@ patch()
|
|||
newGitHubUser=$(echo "${newGitHubUser}" | cut -d " " -f1)
|
||||
echo "--> " ${newGitHubUser}
|
||||
error=""
|
||||
source <(sudo -u admin /home/admin/XXsyncScripts.sh -clean ${activeBranch} ${newGitHubUser})
|
||||
source <(sudo -u admin /home/admin/config.scripts/blitz.github.sh -clean ${activeBranch} ${newGitHubUser})
|
||||
if [ ${#error} -gt 0 ]; then
|
||||
whiptail --title "ERROR" --msgbox "${error}" 8 30
|
||||
fi
|
||||
|
@ -159,7 +159,7 @@ patch()
|
|||
newGitHubBranch=$(echo "${newGitHubBranch}" | cut -d " " -f1)
|
||||
echo "--> " $newGitHubBranch
|
||||
error=""
|
||||
source <(sudo -u admin /home/admin/XXsyncScripts.sh ${newGitHubBranch})
|
||||
source <(sudo -u admin /home/admin/config.scripts/blitz.github.sh ${newGitHubBranch})
|
||||
if [ ${#error} -gt 0 ]; then
|
||||
whiptail --title "ERROR" --msgbox "${error}" 8 30
|
||||
fi
|
||||
|
@ -178,12 +178,12 @@ patch()
|
|||
cd /home/admin/raspiblitz
|
||||
git fetch origin pull/${pullRequestID}/head:pr${pullRequestID}
|
||||
error=""
|
||||
source <(sudo -u admin /home/admin/XXsyncScripts.sh pr${pullRequestID})
|
||||
source <(sudo -u admin /home/admin/config.scripts/blitz.github.sh pr${pullRequestID})
|
||||
if [ ${#error} -gt 0 ]; then
|
||||
whiptail --title "ERROR" --msgbox "${error}" 8 30
|
||||
else
|
||||
echo "# update installs .."
|
||||
/home/admin/XXsyncScripts.sh -justinstall
|
||||
/home/admin/config.scripts/blitz.github.sh -justinstall
|
||||
fi
|
||||
fi
|
||||
exit 1
|
||||
|
|
|
@ -20,9 +20,52 @@ alias bitcoincli_alias="$bitcoincli_alias"
|
|||
alias lncli_alias="$lncli_alias"
|
||||
alias lightningcli_alias="$lightningcli_alias"
|
||||
|
||||
# Check if ready (chain in sync and channels open)
|
||||
./XXchainInSync.sh $network $chain $LNTYPE
|
||||
if [ $? != 0 ]; then
|
||||
source <(/home/admin/config.scripts/network.aliases.sh getvars $LNTYPE ${chain}net)
|
||||
shopt -s expand_aliases
|
||||
alias bitcoincli_alias="$bitcoincli_alias"
|
||||
alias lncli_alias="$lncli_alias"
|
||||
alias lightningcli_alias="$lightningcli_alias"
|
||||
|
||||
# check if chain is in sync
|
||||
if [ $LNTYPE = cln ];then
|
||||
lncommand="lightning-cli"
|
||||
BLOCKHEIGHT=$($bitcoincli_alias getblockchaininfo|grep blocks|awk '{print $2}'|cut -d, -f1)
|
||||
CLHEIGHT=$($lightningcli_alias getinfo | jq .blockheight)
|
||||
if [ $BLOCKHEIGHT -eq $CLHEIGHT ];then
|
||||
cmdChainInSync=1
|
||||
else
|
||||
cmdChainInSync=0
|
||||
fi
|
||||
elif [ $LNTYPE = lnd ];then
|
||||
lncommand="lncli"
|
||||
cmdChainInSync="lncli_alias getinfo | grep '"synced_to_chain": true' -c"
|
||||
fi
|
||||
chainInSync=${cmdChainInSync}
|
||||
while [ "${chainInSync}" == "0" ]; do
|
||||
dialog --title "Fail: not in sync" \
|
||||
--ok-label "Try now" \
|
||||
--cancel-label "Give up" \
|
||||
--pause "\n\n'$lncommand getinfo' shows 'synced_to_chain': false\n\nTry again in a few seconds." 15 60 5
|
||||
|
||||
if [ $? -gt 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
chainInSync=${cmdChainInSync}
|
||||
done
|
||||
|
||||
# check number of connected peers
|
||||
echo "check for open channels"
|
||||
if [ $LNTYPE = cln ];then
|
||||
openChannels=$($lightningcli_alias listpeers | grep -c "CHANNELD_NORMAL")
|
||||
elif [ $LNTYPE = lnd ];then
|
||||
openChannels=$($lncli_alias listchannels 2>/dev/null | grep chan_id -c)
|
||||
fi
|
||||
if [ ${openChannels} -eq 0 ]; then
|
||||
echo
|
||||
echo "!!!!!!!!!!!!!!!!!!!"
|
||||
echo "FAIL - You have NO ESTABLISHED CHANNELS .. open a channel first."
|
||||
echo "!!!!!!!!!!!!!!!!!!!"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
|
@ -20,10 +20,53 @@ alias bitcoincli_alias="$bitcoincli_alias"
|
|||
alias lncli_alias="$lncli_alias"
|
||||
alias lightningcli_alias="$lightningcli_alias"
|
||||
|
||||
# Check if ready (chain in sync and channels open)
|
||||
./XXchainInSync.sh $network $chain $LNTYPE
|
||||
if [ $? != 0 ]; then
|
||||
exit 1
|
||||
source <(/home/admin/config.scripts/network.aliases.sh getvars $LNTYPE ${chain}net)
|
||||
shopt -s expand_aliases
|
||||
alias bitcoincli_alias="$bitcoincli_alias"
|
||||
alias lncli_alias="$lncli_alias"
|
||||
alias lightningcli_alias="$lightningcli_alias"
|
||||
|
||||
# check if chain is in sync
|
||||
if [ $LNTYPE = cln ];then
|
||||
lncommand="lightning-cli"
|
||||
BLOCKHEIGHT=$($bitcoincli_alias getblockchaininfo|grep blocks|awk '{print $2}'|cut -d, -f1)
|
||||
CLHEIGHT=$($lightningcli_alias getinfo | jq .blockheight)
|
||||
if [ $BLOCKHEIGHT -eq $CLHEIGHT ];then
|
||||
cmdChainInSync=1
|
||||
else
|
||||
cmdChainInSync=0
|
||||
fi
|
||||
elif [ $LNTYPE = lnd ];then
|
||||
lncommand="lncli"
|
||||
cmdChainInSync="lncli_alias getinfo | grep '"synced_to_chain": true' -c"
|
||||
fi
|
||||
chainInSync=${cmdChainInSync}
|
||||
while [ "${chainInSync}" == "0" ]; do
|
||||
dialog --title "Fail: not in sync" \
|
||||
--ok-label "Try now" \
|
||||
--cancel-label "Give up" \
|
||||
--pause "\n\n'$lncommand getinfo' shows 'synced_to_chain': false\n\nTry again in a few seconds." 15 60 5
|
||||
|
||||
if [ $? -gt 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
chainInSync=${cmdChainInSync}
|
||||
done
|
||||
|
||||
# check number of connected peers
|
||||
echo "check for open channels"
|
||||
if [ $LNTYPE = cln ];then
|
||||
openChannels=$($lightningcli_alias listpeers | grep -c "CHANNELD_NORMAL")
|
||||
elif [ $LNTYPE = lnd ];then
|
||||
openChannels=$($lncli_alias listchannels 2>/dev/null | grep chan_id -c)
|
||||
fi
|
||||
if [ ${openChannels} -eq 0 ]; then
|
||||
echo
|
||||
echo "!!!!!!!!!!!!!!!!!!!"
|
||||
echo "FAIL - You have NO ESTABLISHED CHANNELS .. open a channel first."
|
||||
echo "!!!!!!!!!!!!!!!!!!!"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
paymentRequestStart="???"
|
||||
|
|
47
home.admin/XXchainInSync.sh
Executable file → Normal file
47
home.admin/XXchainInSync.sh
Executable file → Normal file
|
@ -14,53 +14,6 @@ else
|
|||
LNTYPE=lnd
|
||||
fi
|
||||
|
||||
source <(/home/admin/config.scripts/network.aliases.sh getvars $LNTYPE ${chain}net)
|
||||
shopt -s expand_aliases
|
||||
alias bitcoincli_alias="$bitcoincli_alias"
|
||||
alias lncli_alias="$lncli_alias"
|
||||
alias lightningcli_alias="$lightningcli_alias"
|
||||
|
||||
# check if chain is in sync
|
||||
if [ $LNTYPE = cln ];then
|
||||
lncommand="lightning-cli"
|
||||
BLOCKHEIGHT=$($bitcoincli_alias getblockchaininfo|grep blocks|awk '{print $2}'|cut -d, -f1)
|
||||
CLHEIGHT=$($lightningcli_alias getinfo | jq .blockheight)
|
||||
if [ $BLOCKHEIGHT -eq $CLHEIGHT ];then
|
||||
cmdChainInSync=1
|
||||
else
|
||||
cmdChainInSync=0
|
||||
fi
|
||||
elif [ $LNTYPE = lnd ];then
|
||||
lncommand="lncli"
|
||||
cmdChainInSync="lncli_alias getinfo | grep '"synced_to_chain": true' -c"
|
||||
fi
|
||||
chainInSync=${cmdChainInSync}
|
||||
while [ "${chainInSync}" == "0" ]; do
|
||||
dialog --title "Fail: not in sync" \
|
||||
--ok-label "Try now" \
|
||||
--cancel-label "Give up" \
|
||||
--pause "\n\n'$lncommand getinfo' shows 'synced_to_chain': false\n\nTry again in a few seconds." 15 60 5
|
||||
|
||||
if [ $? -gt 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
chainInSync=${cmdChainInSync}
|
||||
done
|
||||
|
||||
# check number of connected peers
|
||||
echo "check for open channels"
|
||||
if [ $LNTYPE = cln ];then
|
||||
openChannels=$($lightningcli_alias listpeers | grep -c "CHANNELD_NORMAL")
|
||||
elif [ $LNTYPE = lnd ];then
|
||||
openChannels=$($lncli_alias listchannels 2>/dev/null | grep chan_id -c)
|
||||
fi
|
||||
if [ ${openChannels} -eq 0 ]; then
|
||||
echo
|
||||
echo "!!!!!!!!!!!!!!!!!!!"
|
||||
echo "FAIL - You have NO ESTABLISHED CHANNELS .. open a channel first."
|
||||
echo "!!!!!!!!!!!!!!!!!!!"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -465,7 +465,7 @@ if [ ${isMounted} -eq 0 ]; then
|
|||
|
||||
# refresh data from info file
|
||||
source ${infoFile}
|
||||
echo "# PROVISION PROCESS with setupPhase(${setupPhase})"
|
||||
echo "# PROVISION PROCESS with setupPhase(${setupPhase})" >> $logFile
|
||||
|
||||
# mark system on sd card as in setup process
|
||||
echo "the provision process was started but did not finish yet" > /home/admin/provision.flag
|
||||
|
@ -492,6 +492,7 @@ if [ ${isMounted} -eq 0 ]; then
|
|||
# if setup - run provision setup first
|
||||
if [ "${setupPhase}" == "setup" ]; then
|
||||
echo "Calling _provision.setup.sh for basic setup tasks .." >> $logFile
|
||||
sed -i "s/^message=.*/message='Provision Setup'/g" ${infoFile}
|
||||
sudo /home/admin/_provision.setup.sh
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "EXIT BECAUSE OF ERROR STATE ($?)" >> $logFile
|
||||
|
@ -503,6 +504,7 @@ if [ ${isMounted} -eq 0 ]; then
|
|||
# if migration - run the migration provision first
|
||||
if [ "${setupPhase}" == "migration" ]; then
|
||||
echo "Calling _provision.migration.sh for possible migrations .." >> $logFile
|
||||
sed -i "s/^message=.*/message='Provision migration'/g" ${infoFile}
|
||||
sudo /home/admin/_provision.migration.sh
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "EXIT BECAUSE OF ERROR STATE ($?)" >> $logFile
|
||||
|
@ -514,6 +516,7 @@ if [ ${isMounted} -eq 0 ]; then
|
|||
# if update/recovery/migration
|
||||
if [ "${setupPhase}" == "update" ] || [ "${setupPhase}" == "recovery" ] || [ "${setupPhase}" == "migration" ]; then
|
||||
echo "Calling _provision.update.sh .." >> $logFile
|
||||
sed -i "s/^message=.*/message='Provision Update/Recovery/Migration'/g" ${infoFile}
|
||||
sudo /home/admin/_provision.update.sh
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "EXIT BECAUSE OF ERROR STATE ($?)" >> $logFile
|
||||
|
@ -522,13 +525,18 @@ if [ ${isMounted} -eq 0 ]; then
|
|||
fi
|
||||
fi
|
||||
|
||||
# finalize provisioning
|
||||
echo "Calling _bootstrap.provision.sh for general system provisioning (${setupPhase}) .." >> $logFile
|
||||
sed -i "s/^message=.*/message='Provision Basics'/g" ${infoFile}
|
||||
sudo /home/admin/_provision_.sh
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "EXIT BECAUSE OF ERROR STATE" >> $logFile
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# mark provision process done
|
||||
sed -i "s/^message=.*/message='Provision Done'/g" ${infoFile}
|
||||
|
||||
###################################################
|
||||
# WAIT LOOP: AFTER FRESH SETUP, MIGRATION
|
||||
# successfull update & recover can skip this
|
||||
|
|
|
@ -63,7 +63,7 @@ function debug() {
|
|||
# syncs script with latest set github and branch
|
||||
function patch() {
|
||||
cd /home/admin
|
||||
./XXsyncScripts.sh -run
|
||||
/home/admin/config.scripts/blitz.github.sh
|
||||
}
|
||||
|
||||
# command: off
|
||||
|
|
Loading…
Add table
Reference in a new issue