diff --git a/FAQ.dev.md b/FAQ.dev.md index cdce96fbe..d98d35e05 100644 --- a/FAQ.dev.md +++ b/FAQ.dev.md @@ -218,6 +218,10 @@ Now to sync your branch namend BRANCH on your forked repo with your RaspiBlitz, 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. +### How can I manual provision an image with updated code? + +To boot an already build sd card image with your updated raspiblitz code base you can use the `stop` file flag. This will make the `_bootstrap.sh` script stop basically before making any setup or recovery changes to the system. You can SSH in an use the `github` command to update the raspiblitz code and then use `release` command. To set the `stop` file flag. Insert a fresh written sd card into your PC and on the root of `bootfs` drive with a file manager place a empty file simply called `stop` (with no file extension). + ### How to add an app to the RaspiBlitz? To add your app you can fork the raspiblitz repo, follow the `/home.admin/config.scripts/bonus.template.sh` script [see code](https://github.com/raspiblitz/raspiblitz/blob/dev/home.admin/config.scripts/bonus.template.sh), copy/adapt it, test it on your RaspiBlitz and make a PR back to the main repo. diff --git a/home.admin/00infoLCD.sh b/home.admin/00infoLCD.sh index dca4e89f9..85ecb0fcf 100755 --- a/home.admin/00infoLCD.sh +++ b/home.admin/00infoLCD.sh @@ -86,7 +86,6 @@ while : # get config info if already available (with state value) source ${infoFile} - source <(/home/admin/_cache.sh get state message) configExists=$(ls "${configFile}" 2>/dev/null | grep -c '.conf') if [ ${configExists} -eq 1 ]; then diff --git a/home.admin/00raspiblitz.sh b/home.admin/00raspiblitz.sh index 9e26526ae..fa47a2bcc 100755 --- a/home.admin/00raspiblitz.sh +++ b/home.admin/00raspiblitz.sh @@ -13,7 +13,6 @@ source /mnt/hdd/raspiblitz.conf 2>/dev/null # INFOFILE - state data from bootstrap infoFile="/home/admin/raspiblitz.info" source ${infoFile} -source <(/home/admin/_cache.sh get state message) # check that basic system phase/state information is available if [ "${setupPhase}" == "" ] || [ "${state}" == "" ]; then diff --git a/home.admin/_background.sh b/home.admin/_background.sh index c1b7970d7..9def40a1b 100755 --- a/home.admin/_background.sh +++ b/home.admin/_background.sh @@ -43,7 +43,6 @@ do # source info & config file fresh on every loop source ${infoFile} 2>/dev/null source ${configFile} 2>/dev/null - source <(/home/admin/_cache.sh get state setupPhase) #################################################### # SKIP BACKGROUND TASK LOOP ON CERTAIN SYSTEM STATES diff --git a/home.admin/_bootstrap.sh b/home.admin/_bootstrap.sh index a50de0558..f0673561c 100755 --- a/home.admin/_bootstrap.sh +++ b/home.admin/_bootstrap.sh @@ -90,15 +90,16 @@ ln_cl_signet_sync_initial_done=0 source ${infoFile} 2>/dev/null # write fresh raspiblitz.info file -echo "baseimage=${baseimage}" > $infoFile +echo "state=starting" > $infoFile +echo "message=starting" >> $infoFile +echo "setupPhase=${setupPhase}" >> $infoFile +echo "setupStep=${setupStep}" >> $infoFile +echo "baseimage=${baseimage}" >> $infoFile echo "cpu=${cpu}" >> $infoFile echo "blitzapi=${blitzapi}" >> $infoFile echo "displayClass=${displayClass}" >> $infoFile echo "displayType=${displayType}" >> $infoFile -echo "setupPhase=${setupPhase}" >> $infoFile -echo "setupStep=${setupStep}" >> $infoFile echo "fsexpanded=${fsexpanded}" >> $infoFile -echo "state=starting" >> $infoFile echo "btc_mainnet_sync_initial_done=${btc_mainnet_sync_initial_done}" >> $infoFile echo "btc_testnet_sync_initial_done=${btc_testnet_sync_initial_done}" >> $infoFile echo "btc_signet_sync_initial_done=${btc_signet_sync_initial_done}" >> $infoFile @@ -114,6 +115,22 @@ chmod 664 ${infoFile} # write content of raspiblitz.info to logs cat $infoFile >> $logFile +###################################### +# STOP file flag - for manual provision + +# when a file 'stop' is on the sd card bootfs partition root - stop for manual provision +flagExists=$(ls /boot/firmware/stop | grep -c 'stop') +if [ "${flagExists}" == "1" ]; then + # remove flag + rm /boot/firmware/stop + # set state info + /home/admin/_cache.sh set state "stop" + /home/admin/_cache.sh set message "stopped for manual provision" + # log info + echo "INFO: 'bootstrap stopped - run release after manual provison'" >> ${logFile} + exit 0 +fi + ######################### # INIT RaspiBlitz Cache ######################### @@ -155,16 +172,6 @@ source ${configFile} 2>/dev/null ###################################### # CHECK SD CARD STATE -# when a file 'stop' is on the sd card bootfs partition root - stop for manual provision -flagExists=$(ls /boot/firmware/stop | grep -c 'stop') -if [ "${flagExists}" == "1" ]; then - # remove flag - rm /boot/firmware/stop - # log info - echo "INFO: 'bootstrap stopped - run release after manual provison'" >> ${logFile} - exit 0 -fi - # wifi config by file on sd card wifiFileExists=$(ls /boot/firmware/wifi | grep -c 'wifi') wpaFileExists=$(ls /boot/firmware/wpa_supplicant.conf | grep -c 'wpa_supplicant.conf') diff --git a/home.admin/_cache.sh b/home.admin/_cache.sh index 25e115291..7547afe72 100755 --- a/home.admin/_cache.sh +++ b/home.admin/_cache.sh @@ -148,6 +148,23 @@ elif [ "$1" = "set" ] || [ "$1" = "init" ]; then exit 1 fi + # update certain values also in raspiblitz.info + if [ "${keystr}" = "state" ]; then + # change value in raspiblitz.info + sudo sed -i "s/^state=.*/state='${valuestr}'/g" ${infoFile} + fi + if [ "${keystr}" = "message" ]; then + # change value in raspiblitz.info + sudo sed -i "s/^message=.*/message='${valuestr}'/g" ${infoFile} + fi + if [ "${keystr}" = "setupPhase" ]; then + # change value in raspiblitz.info + sudo sed -i "s/^setupPhase=.*/setupPhase='${valuestr}'/g" ${infoFile} + fi + if [ "${keystr}" = "setupStep" ]; then + # change value in raspiblitz.info + sudo sed -i "s/^setupStep=.*/setupStep='${valuestr}'/g" ${infoFile} + fi NX="" if [ "$1" = "init" ]; then diff --git a/home.admin/setup.scripts/controlSetupDialog.sh b/home.admin/setup.scripts/controlSetupDialog.sh index c42f4b879..bbd292e98 100755 --- a/home.admin/setup.scripts/controlSetupDialog.sh +++ b/home.admin/setup.scripts/controlSetupDialog.sh @@ -17,7 +17,7 @@ echo "# RASPIBLITZ SETUP STATE" > $SETUPFILE sudo chown admin:admin $SETUPFILE sudo chmod 777 $SETUPFILE -source <(/home/admin/_cache.sh get setupPhase dnsworking) +source <(/home/admin/_cache.sh get dnsworking) # remember original setupphase orgSetupPhase="${setupPhase}" @@ -90,7 +90,8 @@ if [ "${setupPhase}" == "migration" ]; then fi -source <(/home/admin/_cache.sh get setupPhase) +# fresh import setup values +source /home/admin/raspiblitz.info ############################################ # DEFAULT: Basic Setup menu