From 7eaf68cd41e9d48ae4319fc28ff08ca90dd0ac71 Mon Sep 17 00:00:00 2001 From: rootzoll Date: Fri, 5 Apr 2024 14:30:10 +0200 Subject: [PATCH 1/8] simplify packer --- ci/packer.sh | 3 +-- home.admin/_bootstrap.sh | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/packer.sh b/ci/packer.sh index 525fa2f09..3a2f46b21 100644 --- a/ci/packer.sh +++ b/ci/packer.sh @@ -241,8 +241,7 @@ fi echo "# clean up" -cd .. -rm -rf raspiblitz 2>/dev/null +rm -rf ./../raspiblitz 2>/dev/null echo "# SIGN & SECURE IMAGE ###########################################" echo diff --git a/home.admin/_bootstrap.sh b/home.admin/_bootstrap.sh index d95e6a723..75312cb3d 100755 --- a/home.admin/_bootstrap.sh +++ b/home.admin/_bootstrap.sh @@ -980,6 +980,7 @@ if [ ${isMounted} -eq 0 ]; then # system has to wait before reboot to present like seed words and other info/options to user echo "BOOTSTRAP EXIT ... waiting for final setup controller to initiate final reboot." >> $logFile + echo "------------> You may login thru web browser to continue setup." >> $logFile exit 1 else From f0ccc61b05a21a9f66fabf83c7bd81724d5362b8 Mon Sep 17 00:00:00 2001 From: rootzoll Date: Fri, 5 Apr 2024 15:42:33 +0200 Subject: [PATCH 2/8] #4523 get value to check against --- home.admin/_background.scan.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/home.admin/_background.scan.sh b/home.admin/_background.scan.sh index c49996d2a..fd3cb5d6d 100755 --- a/home.admin/_background.scan.sh +++ b/home.admin/_background.scan.sh @@ -275,6 +275,8 @@ do ################### # HARDDRIVE + # info on storage medium + source <(/home/admin/_cache.sh valid hdd_mounted) if [ "${stillvalid}" == "0" ] || [ ${age} -gt ${MINUTE2} ]; then echo "updating: /home/admin/config.scripts/blitz.datadrive.sh status" source <(/home/admin/config.scripts/blitz.datadrive.sh status) From 8f7f08cea9b209bd23d3cb59522ffeedb1d983d2 Mon Sep 17 00:00:00 2001 From: openoms <43343391+openoms@users.noreply.github.com> Date: Sat, 6 Apr 2024 09:51:44 +0200 Subject: [PATCH 3/8] check kernel8 image in /boot/firmware/ (#4528) --- build_sdcard.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_sdcard.sh b/build_sdcard.sh index 13ccda356..f8973a214 100644 --- a/build_sdcard.sh +++ b/build_sdcard.sh @@ -448,7 +448,7 @@ if [ "${baseimage}" = "raspios_arm64" ]; then echo "# Raspiblitz" | tee -a $configFile # ensure that kernel8.img is used to set PAGE_SIZE to 4K # https://github.com/raspiblitz/raspiblitz/issues/4346 - if [ -f /boot/kernel8.img ]; then + if [ -f /boot/firmware/kernel8.img ]; then echo 'kernel=kernel8.img' | tee -a $configFile fi echo "max_usb_current=1" | tee -a $configFile From 3aa0bb42a743aaef108ee6f78511d727cd477dd9 Mon Sep 17 00:00:00 2001 From: openoms <43343391+openoms@users.noreply.github.com> Date: Sat, 6 Apr 2024 10:23:39 +0200 Subject: [PATCH 4/8] fix postgresql 13 recovery (#4521) * postgres: add comments, backup and remove unused databases * bats: remove output, use --verbose-run locally * always drop empty pg 15 cluster * check cluster correctly, fix port after upgrade * always restart postgresql.service to fix port --- home.admin/config.scripts/bonus.postgresql.sh | 33 +++++++++++++---- test/README.md | 4 +-- test/bonus.postgresql-13.bats | 35 ++++++++++--------- test/bonus.postgresql-15.bats | 16 --------- 4 files changed, 47 insertions(+), 41 deletions(-) diff --git a/home.admin/config.scripts/bonus.postgresql.sh b/home.admin/config.scripts/bonus.postgresql.sh index f34d7e44c..796f93ee4 100755 --- a/home.admin/config.scripts/bonus.postgresql.sh +++ b/home.admin/config.scripts/bonus.postgresql.sh @@ -36,8 +36,7 @@ if [ "$command" = "1" ] || [ "$command" = "on" ]; then sudo systemctl stop postgresql@$PG_VERSION-main if [ ! -d /mnt/hdd/app-data/postgresql ]; then - # there is no old data - + echo "# There is no old pg data" # symlink conf dir sudo mkdir -p /mnt/hdd/app-data/postgresql-conf/postgresql sudo chown -R postgres:postgres /mnt/hdd/app-data/postgresql-conf # fix ownership @@ -52,7 +51,7 @@ if [ "$command" = "1" ] || [ "$command" = "on" ]; then sudo rm -rf $postgres_datadir # not a symlink.. delete it silently sudo ln -s /mnt/hdd/app-data/postgresql /var/lib/ # create symlink - echo "# Create PostgreSQL data" + echo "# Create PostgreSQL $PG_VERSION data" sudo mkdir -p $postgres_datadir/$PG_VERSION/main sudo chown -R postgres:postgres $postgres_datadir @@ -61,6 +60,7 @@ if [ "$command" = "1" ] || [ "$command" = "on" ]; then sudo pg_ctlcluster $PG_VERSION main start elif [ -d /mnt/hdd/app-data/postgresql/$PG_VERSION/main ]; then + echo "# There is old data for $PG_VERSION, restoring ..." if [ -d /mnt/hdd/app-data/postgresql-conf ]; then # symlink conf dir sudo mkdir -p /mnt/hdd/app-data/postgresql-conf/postgresql @@ -70,7 +70,7 @@ if [ "$command" = "1" ] || [ "$command" = "on" ]; then sudo ln -s /mnt/hdd/app-data/postgresql-conf/postgresql /etc/ # create symlink else # generate new cluster and use default config - echo "# Create PostgreSQL data" + echo "# Create $PG_VERSION config" sudo mkdir -p $postgres_datadir/$PG_VERSION/main sudo chown -R postgres:postgres $postgres_datadir sudo pg_createcluster $PG_VERSION main @@ -106,7 +106,7 @@ if [ "$command" = "1" ] || [ "$command" = "on" ]; then sudo pg_ctlcluster $PG_VERSION main start elif [ -d /mnt/hdd/app-data/postgresql/13/main ]; then - # if there is old data for pg 13 start and upgrade cluster + echo "# There is old data for pg 13, start and upgrade cluster ..." sudo apt install -y postgresql-13 || exit 1 sudo systemctl stop postgresql sudo systemctl stop postgresql@13-main @@ -119,7 +119,7 @@ if [ "$command" = "1" ] || [ "$command" = "on" ]; then sudo ln -s /mnt/hdd/app-data/postgresql-conf/postgresql /etc/ # create symlink else # generate new cluster and use default config - echo "# Create PostgreSQL data" + echo "# Create pg 13 config" sudo mkdir -p $postgres_datadir/13/main sudo chown -R postgres:postgres $postgres_datadir # start cluster temporarily @@ -150,10 +150,31 @@ if [ "$command" = "1" ] || [ "$command" = "on" ]; then sudo systemctl start postgresql@13-main sudo pg_createcluster 13 main sudo pg_ctlcluster 13 main start + + if [ -d /mnt/hdd/app-data/postgresql/$PG_VERSION ] || pg_lsclusters | grep -q "$PG_VERSION main"; then + echo "# backup /mnt/hdd/app-data/postgresql/$PG_VERSION" + now=$(date +"%Y_%m_%d_%H%M%S") + sudo mv /mnt/hdd/app-data/postgresql/$PG_VERSION /mnt/hdd/app-data/postgresql/$PG_VERSION-backup-$now + echo "# Drop empty pg 15 cluster" + sudo pg_dropcluster $PG_VERSION main + fi + # /usr/bin/pg_upgradecluster [OPTIONS] [] sudo pg_upgradecluster 13 main $postgres_datadir/$PG_VERSION/main || exit 1 + sudo chown -R postgres:postgres /mnt/hdd/app-data/postgresql/$PG_VERSION + echo "# backup /mnt/hdd/app-data/postgresql/13" + now=$(date +"%Y_%m_%d_%H%M%S") + sudo mv /mnt/hdd/app-data/postgresql/13 /mnt/hdd/app-data/postgresql/13-backup-$now + sudo pg_dropcluster 13 main sudo systemctl disable --now postgresql@13-main sudo apt remove -y postgresql-13 + + if sudo cat /etc/postgresql/$PG_VERSION/main/postgresql.conf | grep 5433; then + echo "# Switch port back to 5432" + sudo sed -i 's/port = 5433/port = 5432/' /etc/postgresql/$PG_VERSION/main/postgresql.conf + echo "# Restart posgresql.service" + sudo systemctl restart postgresql + fi fi # start cluster diff --git a/test/README.md b/test/README.md index 8ce1710e8..fc2b64cfd 100644 --- a/test/README.md +++ b/test/README.md @@ -7,6 +7,6 @@ sudo apt install bats ## Run tests manually ``` -bats ./bonus.postgresql-13.bats -bats ./bonus.postgresql-15.bats +bats --verbose-run ./bonus.postgresql-13.bats +bats --verbose-run ./bonus.postgresql-15.bats ``` diff --git a/test/bonus.postgresql-13.bats b/test/bonus.postgresql-13.bats index 7fa3d6f65..5b472f40a 100644 --- a/test/bonus.postgresql-13.bats +++ b/test/bonus.postgresql-13.bats @@ -23,9 +23,7 @@ sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE testdb13 TO testuser13;" run pg_lsclusters [ "$status" -eq 0 ] - echo "$output" run sudo -u postgres psql -l - echo "$output" echo "$output" | grep -q "testdb13" [ "$?" -eq 0 ] echo "$output" | grep -q "testuser13" @@ -34,16 +32,15 @@ @test "Switch cluster 13 off and move" { sudo apt-get remove -y postgresql-13 + sudo apt-get remove -y postgresql-15 + sudo apt-get remove -y postgresql run ../home.admin/config.scripts/bonus.postgresql.sh off - echo "$output" [ "$status" -eq 0 ] sudo mkdir -p /mnt/hdd/app-data/ sudo mv /var/lib/postgresql /mnt/hdd/app-data/ - sudo rm -rf /mnt/hdd/app-data/postgresql/15 run sudo ls /mnt/hdd/app-data/postgresql/13 [ "$status" -eq 0 ] sudo mv /mnt/hdd/app-data/postgresql /mnt/hdd/app-data/postgresql.bak - sudo pg_dropcluster 15 main --stop || true run sudo pg_dropcluster 13 main --stop [ "$status" -eq 0 ] } @@ -54,10 +51,14 @@ sudo rm -rf /mnt/hdd/app-data/postgresql-conf.bak # run the script run ../home.admin/config.scripts/bonus.postgresql.sh on - echo "$output" [ "$status" -eq 0 ] + run pg_lsclusters + # check that no 13 cluster is present + [ $(echo "$output" | grep -c "13 main") -eq 0 ] + # check that no 13 cluster is present + echo "$output" | grep -q "15 main" + [ "$?" -eq 0 ] run sudo -u postgres psql -l - echo "$output" echo "$output" | grep -q "testdb13" [ "$?" -eq 0 ] echo "$output" | grep -q "testuser13" @@ -65,17 +66,15 @@ } @test "Create test database (2)" { - sudo -u postgres psql -c "CREATE DATABASE testdb TEMPLATE template0 LC_CTYPE 'C' LC_COLLATE 'C' ENCODING 'UTF8';" - sudo -u postgres psql -c "CREATE USER testuser WITH ENCRYPTED PASSWORD 'raspiblitz';" - sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE testdb TO testuser;" + sudo -u postgres psql -c "CREATE DATABASE testdb15 TEMPLATE template0 LC_CTYPE 'C' LC_COLLATE 'C' ENCODING 'UTF8';" + sudo -u postgres psql -c "CREATE USER testuser15 WITH ENCRYPTED PASSWORD 'raspiblitz';" + sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE testdb15 TO testuser15;" run pg_lsclusters [ "$status" -eq 0 ] - echo "$output" run sudo -u postgres psql -l - echo "$output" - echo "$output" | grep -q "testdb" + echo "$output" | grep -q "testdb15" [ "$?" -eq 0 ] - echo "$output" | grep -q "testuser" + echo "$output" | grep -q "testuser15" [ "$?" -eq 0 ] } @@ -84,8 +83,10 @@ [ "$status" -eq 0 ] run pg_lsclusters [ "$status" -eq 0 ] - echo "$output" - sudo pg_dropcluster 15 main --stop || true - sudo pg_dropcluster 13 main --stop || true + sudo pg_dropcluster 15 main --stop || true + sudo pg_dropcluster 13 main --stop || true sudo rm -rf /mnt/hdd/app-data/postgresql* + sudo apt-get remove -y postgresql-13 + sudo apt-get remove -y postgresql-15 + sudo apt-get remove -y postgresql } diff --git a/test/bonus.postgresql-15.bats b/test/bonus.postgresql-15.bats index a5b4f2140..0ab863b1f 100644 --- a/test/bonus.postgresql-15.bats +++ b/test/bonus.postgresql-15.bats @@ -3,12 +3,10 @@ @test "Start PostgreSQL cluster" { # run the script run ../home.admin/config.scripts/bonus.postgresql.sh on - echo "$output" [ "$status" -eq 0 ] # check if PostgreSQL cluster is running run pg_lsclusters [ "$status" -eq 0 ] - echo "$output" } @test "Create test database" { @@ -18,9 +16,7 @@ # check if PostgreSQL cluster is running run pg_lsclusters [ "$status" -eq 0 ] - echo "$output" run sudo -u postgres psql -l - echo "$output" echo "$output" | grep -q "testdb" [ "$?" -eq 0 ] echo "$output" | grep -q "testuser" @@ -32,7 +28,6 @@ run ../home.admin/config.scripts/bonus.postgresql.sh off # check if PostgreSQL cluster is running run pg_lsclusters - echo "$output" [ "$status" -eq 0 ] sudo mv /mnt/hdd/app-data/postgresql /mnt/hdd/app-data/postgresql.bak sudo mv /mnt/hdd/app-data/postgresql-conf /mnt/hdd/app-data/postgresql-conf.bak @@ -47,15 +42,11 @@ sudo mv /mnt/hdd/app-data/postgresql-conf.bak /mnt/hdd/app-data/postgresql-conf # run the script run ../home.admin/config.scripts/bonus.postgresql.sh on - echo "$output" [ "$status" -eq 0 ] # check the database run pg_lsclusters - echo "$output" [ "$status" -eq 0 ] - echo "$output" run sudo -u postgres psql -l - echo "$output" echo "$output" | grep -q "testdb" [ "$?" -eq 0 ] echo "$output" | grep -q "testuser" @@ -64,10 +55,8 @@ @test "Switch cluster off and move (2)" { run ../home.admin/config.scripts/bonus.postgresql.sh off - echo "$output" [ "$status" -eq 0 ] run pg_lsclusters - echo "$output" [ "$status" -eq 0 ] sudo mv /mnt/hdd/app-data/postgresql /mnt/hdd/app-data/postgresql.bak sudo mv /mnt/hdd/app-data/postgresql-conf /mnt/hdd/app-data/postgresql-conf.bak @@ -83,13 +72,10 @@ sudo rm -rf /etc/postgresql sudo rm -rf /mnt/hdd/app-data/postgresql-conf.bak run ../home.admin/config.scripts/bonus.postgresql.sh on - echo "$output" [ "$status" -eq 0 ] run pg_lsclusters [ "$status" -eq 0 ] - echo "$output" run sudo -u postgres psql -l - echo "$output" echo "$output" | grep -q "testdb" [ "$?" -eq 0 ] echo "$output" | grep -q "testuser" @@ -98,11 +84,9 @@ @test "Cleanup" { run ../home.admin/config.scripts/bonus.postgresql.sh off - echo "$output" [ "$status" -eq 0 ] run pg_lsclusters [ "$status" -eq 0 ] - echo "$output" sudo pg_dropcluster 15 main --stop || true sudo pg_dropcluster 13 main --stop || true sudo rm -rf /mnt/hdd/app-data/postgresql* From c2c710a9d1c6ac5a3d7ec044ec2d1a94582528cf Mon Sep 17 00:00:00 2001 From: openoms <43343391+openoms@users.noreply.github.com> Date: Sat, 6 Apr 2024 21:19:39 +0200 Subject: [PATCH 5/8] check for /boot/firmware dir during build (#4529) --- build_sdcard.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/build_sdcard.sh b/build_sdcard.sh index f8973a214..d644b2333 100644 --- a/build_sdcard.sh +++ b/build_sdcard.sh @@ -441,14 +441,18 @@ if [ "${baseimage}" = "raspios_arm64" ]; then [ "${wifi_region}" != "off" ] && raspi-config nonint do_wifi_country $wifi_region # see https://github.com/rootzoll/raspiblitz/issues/428#issuecomment-472822840 - configFile="/boot/firmware/config.txt" + if [ -d /boot/firmware ];then + configFile="/boot/firmware/config.txt" + else + configFile="/boot/config.txt" + fi if ! grep "Raspiblitz" $configFile; then echo "# Adding Raspiblitz Edits to $configFile" echo | tee -a $configFile echo "# Raspiblitz" | tee -a $configFile # ensure that kernel8.img is used to set PAGE_SIZE to 4K # https://github.com/raspiblitz/raspiblitz/issues/4346 - if [ -f /boot/firmware/kernel8.img ]; then + if [ -f /boot/kernel8.img ] || [ -f /boot/firmware/kernel8.img ]; then echo 'kernel=kernel8.img' | tee -a $configFile fi echo "max_usb_current=1" | tee -a $configFile From 2eed08965c5e4ba2ee94148a2615ba10cac9c528 Mon Sep 17 00:00:00 2001 From: /rootzoll Date: Mon, 8 Apr 2024 11:48:12 +0200 Subject: [PATCH 6/8] fix moved config.txt (#4530) --- build_sdcard.sh | 61 +++++++------ home.admin/_background.sh | 43 ++++++++-- home.admin/_bootstrap.sh | 46 ++++++---- home.admin/config.scripts/blitz.datadrive.sh | 21 +++-- home.admin/config.scripts/blitz.display.sh | 85 +++++++++++-------- home.admin/config.scripts/blitz.fatpack.sh | 11 ++- .../config.scripts/blitz.preparerelease.sh | 13 ++- .../config.scripts/blitz.touchscreen.sh | 6 +- .../setup.scripts/controlSetupDialog.sh | 2 +- 9 files changed, 187 insertions(+), 101 deletions(-) diff --git a/build_sdcard.sh b/build_sdcard.sh index d644b2333..df84ba3a8 100644 --- a/build_sdcard.sh +++ b/build_sdcard.sh @@ -270,6 +270,17 @@ else fi echo "baseimage=${baseimage}" +# AUTO-DETECTION: CONFIGFILES +# --------------------------------------- +raspi_configfile="/boot/config.txt" +raspi_commandfile="/boot/cmdline.txt" +if [ -d /boot/firmware ];then + raspi_configfile="/boot/firmware/config.txt" + raspi_commandfile="/boot/firmware/cmdline.txt" +fi +echo "raspi_configfile=${raspi_configfile}" +echo "raspi_commandfile=${raspi_commandfile}" + # USER-CONFIRMATION if [ "${interaction}" = "true" ]; then echo -n "# Do you agree with all parameters above? (yes/no) " @@ -441,27 +452,22 @@ if [ "${baseimage}" = "raspios_arm64" ]; then [ "${wifi_region}" != "off" ] && raspi-config nonint do_wifi_country $wifi_region # see https://github.com/rootzoll/raspiblitz/issues/428#issuecomment-472822840 - if [ -d /boot/firmware ];then - configFile="/boot/firmware/config.txt" - else - configFile="/boot/config.txt" - fi - if ! grep "Raspiblitz" $configFile; then - echo "# Adding Raspiblitz Edits to $configFile" - echo | tee -a $configFile - echo "# Raspiblitz" | tee -a $configFile + if ! grep "Raspiblitz" $raspi_configfile; then + echo "# Adding Raspiblitz Edits to $raspi_configfile" + echo | tee -a $raspi_configfile + echo "# Raspiblitz" | tee -a $raspi_configfile # ensure that kernel8.img is used to set PAGE_SIZE to 4K # https://github.com/raspiblitz/raspiblitz/issues/4346 if [ -f /boot/kernel8.img ] || [ -f /boot/firmware/kernel8.img ]; then - echo 'kernel=kernel8.img' | tee -a $configFile + echo 'kernel=kernel8.img' | tee -a $raspi_configfile fi - echo "max_usb_current=1" | tee -a $configFile - echo "dtparam=nvme" | tee -a $configFile - echo "dtparam=watchdog=on" | tee -a $configFile - echo 'dtoverlay=pi3-disable-bt' | tee -a $configFile - echo 'dtoverlay=disable-bt' | tee -a $configFile + echo "max_usb_current=1" | tee -a $raspi_configfile + echo "dtparam=nvme" | tee -a $raspi_configfile + echo "dtparam=watchdog=on" | tee -a $raspi_configfile + echo 'dtoverlay=pi3-disable-bt' | tee -a $raspi_configfile + echo 'dtoverlay=disable-bt' | tee -a $raspi_configfile else - echo "# Raspiblitz Edits are already in $configFile" + echo "# Raspiblitz Edits are already in $raspi_configfile" fi # run fsck on sd root partition on every startup to prevent "maintenance login" screen @@ -476,23 +482,22 @@ if [ "${baseimage}" = "raspios_arm64" ]; then fi # edit kernel parameters - kernelOptionsFile=/boot/cmdline.txt fsOption1="fsck.mode=force" fsOption2="fsck.repair=yes" - fsOption1InFile=$(grep -c ${fsOption1} ${kernelOptionsFile}) - fsOption2InFile=$(grep -c ${fsOption2} ${kernelOptionsFile}) + fsOption1InFile=$(grep -c ${fsOption1} ${raspi_commandfile}) + fsOption2InFile=$(grep -c ${fsOption2} ${raspi_commandfile}) if [ ${fsOption1InFile} -eq 0 ]; then - sed -i "s/^/$fsOption1 /g" "$kernelOptionsFile" - echo "$fsOption1 added to $kernelOptionsFile" + sed -i "s/^/$fsOption1 /g" "${raspi_commandfile}" + echo "$fsOption1 added to ${raspi_commandfile}" else - echo "$fsOption1 already in $kernelOptionsFile" + echo "$fsOption1 already in ${raspi_commandfile}" fi if [ ${fsOption2InFile} -eq 0 ]; then - sed -i "s/^/$fsOption2 /g" "$kernelOptionsFile" - echo "$fsOption2 added to $kernelOptionsFile" + sed -i "s/^/$fsOption2 /g" "${raspi_commandfile}" + echo "$fsOption2 added to ${raspi_commandfile}" else - echo "$fsOption2 already in $kernelOptionsFile" + echo "$fsOption2 already in ${raspi_commandfile}" fi # *** SAFE SHUTDOWN *** @@ -783,16 +788,16 @@ if [ "${baseimage}" = "raspios_arm64" ] || [ "${baseimage}" = "debian" ]; then # disable audio echo -e "\n*** DISABLE AUDIO (snd_bcm2835) ***" - sed -i "s/^dtparam=audio=on/# dtparam=audio=on/g" /boot/config.txt + sed -i "s/^dtparam=audio=on/# dtparam=audio=on/g" ${raspi_configfile} # disable DRM VC4 V3D echo -e "\n*** DISABLE DRM VC4 V3D driver ***" dtoverlay=vc4-fkms-v3d - sed -i "s/^dtoverlay=${dtoverlay}/# dtoverlay=${dtoverlay}/g" /boot/config.txt + sed -i "s/^dtoverlay=${dtoverlay}/# dtoverlay=${dtoverlay}/g" ${raspi_configfile} # I2C fix (make sure dtparam=i2c_arm is not on) # see: https://github.com/rootzoll/raspiblitz/issues/1058#issuecomment-739517713 - sed -i "s/^dtparam=i2c_arm=.*//g" /boot/config.txt + sed -i "s/^dtparam=i2c_arm=.*//g" ${raspi_configfile} fi # *** BOOTSTRAP *** diff --git a/home.admin/_background.sh b/home.admin/_background.sh index 9def40a1b..9de0e4182 100755 --- a/home.admin/_background.sh +++ b/home.admin/_background.sh @@ -19,6 +19,15 @@ echo "INFO: _background.sh loop started - sudo journalctl -f -u background" >> / blitzTUIHeartBeatLine="" /home/admin/_cache.sh set blitzTUIRestarts "0" +# determine correct raspberrypi boot drive path (that easy to access when sd card is insert into laptop) +raspi_bootdir="" +if [ -d /boot/firmware ]; then + raspi_bootdir="/boot/firmware" +elif [ -d /boot ]; then + raspi_bootdir="/boot" +fi +echo "# raspi_bootdir(${raspi_bootdir})" + counter=0 while [ 1 ] do @@ -481,11 +490,35 @@ do echo "--> Channel Backup File changed" # make copy to sd card (as local basic backup) - mkdir -p /home/admin/backups/scb/ 2>/dev/null + mkdir -p ${localBackupDir} 2>/dev/null cp $scbPath $localBackupPath + if [ $? -eq 0 ]; then + echo "OK channel.backup copied to '${localBackupPath}'" + else + logger -p daemon.err "_background.sh FAIL channel.backup copy to '${localBackupPath}'" + echo "FAIL channel.backup copy to '${localBackupPath}'" + fi + cp $scbPath $localTimestampedPath - cp $scbPath /boot/firmware/channel.backup - echo "OK channel.backup copied to '${localBackupPath}' and '${localTimestampedPath}' and '/boot/firmware/channel.backup'" + if [ $? -eq 0 ]; then + echo "OK channel.backup copied to '${localTimestampedPath}'" + else + logger -p daemon.err "_background.sh FAIL channel.backup copy to '${localTimestampedPath}'" + echo "FAIL channel.backup copy to '${localTimestampedPath}'" + fi + + # copy to boot drive (for easy recovery) + if [ "${raspi_bootdir}" != "" ]; then + cp $scbPath ${raspi_bootdir}/channel.backup + if [ $? -eq 0 ]; then + echo "OK channel.backup copied to '${raspi_bootdir}/channel.backup'" + else + logger -p daemon.err "_background.sh FAIL channel.backup copy to '${raspi_bootdir}/channel.backup'" + echo "FAIL channel.backup copy to '${raspi_bootdir}/channel.backup'" + fi + else + echo "No boot drive found - skip copy to boot" + fi # check if a additional local backup target is set # see ./config.scripts/blitz.backupdevice.sh @@ -590,8 +623,8 @@ do mkdir -p /home/admin/backups/er/ 2>/dev/null cp $erPath $localBackupPath cp $erPath $localTimestampedPath - cp $erPath /boot/firmware/${netprefix}emergency.recover - echo "OK emergency.recover copied to '${localBackupPath}' and '${localTimestampedPath}' and '/boot/firmware/${netprefix}emergency.recover'" + cp $erPath ${raspi_bootdir}/${netprefix}emergency.recover + echo "OK emergency.recover copied to '${localBackupPath}' and '${localTimestampedPath}' and '${raspi_bootdir}/${netprefix}emergency.recover'" # check if a additional local backup target is set # see ./config.scripts/blitz.backupdevice.sh diff --git a/home.admin/_bootstrap.sh b/home.admin/_bootstrap.sh index 75312cb3d..f848d471e 100755 --- a/home.admin/_bootstrap.sh +++ b/home.admin/_bootstrap.sh @@ -115,11 +115,20 @@ chmod 664 ${infoFile} # write content of raspiblitz.info to logs cat $infoFile >> $logFile +# determine correct raspberrypi boot drive path (that easy to access when sd card is insert into laptop) +raspi_bootdir="" +if [ -d /boot/firmware ]; then + raspi_bootdir="/boot/firmware" +elif [ -d /boot ]; then + raspi_bootdir="/boot" +fi +echo "# raspi_bootdir(${raspi_bootdir})" >> $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') +flagExists=$(ls ${raspi_bootdir}/stop 2>/dev/null | grep -c 'stop') if [ "${flagExists}" == "1" ]; then # set state info /home/admin/_cache.sh set state "stop" @@ -173,8 +182,8 @@ source ${configFile} 2>/dev/null # CHECK SD CARD STATE # 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') +wifiFileExists=$(ls ${raspi_bootdir}/wifi 2>/dev/null | grep -c 'wifi') +wpaFileExists=$(ls ${raspi_bootdir}/wpa_supplicant.conf 2>/dev/null | grep -c 'wpa_supplicant.conf') if [ "${wifiFileExists}" == "1" ] || [ "${wpaFileExists}" == "1" ]; then # set info @@ -185,17 +194,17 @@ if [ "${wifiFileExists}" == "1" ] || [ "${wpaFileExists}" == "1" ]; then # get first line as string from wifi file (NAME OF WIFI) # get second line as string from wifi file (PASSWORD OF WIFI) if [ "${wifiFileExists}" == "1" ]; then - echo "Getting data from file: /boot/firmware/wifi" >> ${logFile} - ssid=$(sed -n '1p' /boot/firmware/wifi | tr -d '[:space:]') - password=$(sed -n '2p' /boot/firmware/wifi | tr -d '[:space:]') + echo "Getting data from file: ${raspi_bootdir}/wifi" >> ${logFile} + ssid=$(sed -n '1p' ${raspi_bootdir}/wifi | tr -d '[:space:]') + password=$(sed -n '2p' ${raspi_bootdir}/wifi | tr -d '[:space:]') fi # File: wpa_supplicant.conf (legacy way to set wifi) # see: https://github.com/raspibolt/raspibolt/blob/a21788c0518618d17093e3f447f68a53e4efa6e7/raspibolt/raspibolt_20_pi.md#prepare-wifi if [ "${wpaFileExists}" == "1" ]; then - echo "Getting data from file: /boot/firmware/wpa_supplicant.conf" >> ${logFile} - ssid=$(grep ssid "/boot/firmware/wpa_supplicant.conf" | awk -F'=' '{print $2}' | tr -d '"') - password=$(grep psk "/boot/firmware/wpa_supplicant.conf" | awk -F'=' '{print $2}' | tr -d '"') + echo "Getting data from file: ${raspi_bootdir}/wpa_supplicant.conf" >> ${logFile} + ssid=$(grep ssid "${raspi_bootdir}/wpa_supplicant.conf" | awk -F'=' '{print $2}' | tr -d '"') + password=$(grep psk "${raspi_bootdir}/wpa_supplicant.conf" | awk -F'=' '{print $2}' | tr -d '"') fi # set wifi @@ -203,7 +212,7 @@ if [ "${wifiFileExists}" == "1" ] || [ "${wpaFileExists}" == "1" ]; then echo "Setting Wifi SSID(${ssid}) Password(${password})" >> ${logFile} source <(/home/admin/config.scripts/internet.wifi.sh on ${ssid} ${password}) if [ "${err}" != "" ]; then - echo "Setting Wifi failed - edit or remove file /boot/firmware/wifi" >> ${logFile} + echo "Setting Wifi failed - edit or remove file ${raspi_bootdir}/wifi" >> ${logFile} echo "error(${err})" >> ${logFile} echo "Will shutdown in 1min ..." >> ${logFile} /home/admin/_cache.sh set state "errorWIFI" @@ -215,8 +224,8 @@ if [ "${wifiFileExists}" == "1" ] || [ "${wpaFileExists}" == "1" ]; then # remove file echo "Setting Wifi worked - removing file" >> ${logFile} - rm /boot/firmware/wifi 2>/dev/null - rm /boot/firmware/wpa_supplicant.conf 2>/dev/null + rm ${raspi_bootdir}/wifi 2>/dev/null + rm ${raspi_bootdir}/wpa_supplicant.conf 2>/dev/null else echo "No Wifi config by file on sd card." >> ${logFile} fi @@ -315,10 +324,10 @@ systemInitReboot=0 # the sd card - switch to hdmi ################################ -forceHDMIoutput=$(ls /boot/firmware/hdmi* 2>/dev/null | grep -c hdmi) +forceHDMIoutput=$(ls ${raspi_bootdir}/hdmi* 2>/dev/null | grep -c hdmi) if [ ${forceHDMIoutput} -eq 1 ]; then # delete that file (to prevent loop) - rm /boot/hdmi* + rm ${raspi_bootdir}/hdmi* # switch to HDMI what will trigger reboot echo "HDMI switch found ... activating HDMI display output & reboot" >> $logFile /home/admin/config.scripts/blitz.display.sh set-display hdmi >> $logFile @@ -391,10 +400,10 @@ fi # the sd card - delete old ssh data ################################ -sshReset=$(ls /boot/firmware/ssh.reset* 2>/dev/null | grep -c reset) +sshReset=$(ls ${raspi_bootdir}/ssh.reset* 2>/dev/null | grep -c reset) if [ ${sshReset} -eq 1 ]; then # delete that file (to prevent loop) - rm /boot/firmware/ssh.reset* >> $logFile + rm ${raspi_bootdir}/ssh.reset* >> $logFile # delete ssh certs echo "SSHRESET switch found ... stopping SSH and deleting old certs" >> $logFile /home/admin/config.scripts/blitz.ssh.sh renew >> $logFile @@ -668,7 +677,7 @@ if [ ${isMounted} -eq 0 ]; then # check if there is a flag set on sd card boot section to format as btrfs (experimental) filesystem="ext4" - flagBTRFS=$(ls /boot/firmware/btrfs* 2>/dev/null | grep -c btrfs) + flagBTRFS=$(ls ${raspi_bootdir}/btrfs* 2>/dev/null | grep -c btrfs) if [ "${flagBTRFS}" != "0" ]; then echo "Found BTRFS flag ---> formatting with experimental BTRFS filesystem" >> ${logFile} filesystem="btrfs" @@ -1099,8 +1108,9 @@ fi # FORCE UASP FLAG #################### # if uasp.force flag was set on sd card - now move into raspiblitz.conf -if [ -f "/boot/firmware/uasp.force" ]; then +if [ -f "${raspi_bootdir}/uasp.force" ]; then /home/admin/config.scripts/blitz.conf.sh set forceUasp "on" + rm ${raspi_bootdir}/uasp.force* >> $logFile echo "DONE forceUasp=on recorded in raspiblitz.conf" >> $logFile fi diff --git a/home.admin/config.scripts/blitz.datadrive.sh b/home.admin/config.scripts/blitz.datadrive.sh index 7971a8231..030a054a5 100755 --- a/home.admin/config.scripts/blitz.datadrive.sh +++ b/home.admin/config.scripts/blitz.datadrive.sh @@ -26,6 +26,15 @@ if [ "$EUID" -ne 0 ]; then exit 1 fi +# determine correct raspberrypi boot drive path (that easy to access when sd card is insert into laptop) +raspi_bootdir="" +if [ -d /boot/firmware ]; then + raspi_bootdir="/boot/firmware" +elif [ -d /boot ]; then + raspi_bootdir="/boot" +fi +echo "# raspi_bootdir(${raspi_bootdir})" + # install BTRFS if needed btrfsInstalled=$(btrfs --version 2>/dev/null | grep -c "btrfs-progs") if [ ${btrfsInstalled} -eq 0 ]; then @@ -561,7 +570,7 @@ if [ "$1" = "status" ]; then hddAdapterUSAP=0 # check if force UASP flag is set on sd card - if [ -f "/boot/firmware/uasp.force" ]; then + if [ -f "${raspi_bootdir}/uasp.force" ]; then hddAdapterUSAP=1 fi # or UASP is set by config file @@ -1881,18 +1890,18 @@ if [ "$1" = "uasp-fix" ]; then # check if UASP is already deactivated (on RaspiOS) # https://www.pragmaticlinux.com/2021/03/fix-for-getting-your-ssd-working-via-usb-3-on-your-raspberry-pi/ - cmdlineExists=$(ls /boot/cmdline.txt 2>/dev/null | grep -c "cmdline.txt") + cmdlineExists=$(ls ${raspi_bootdir}/cmdline.txt 2>/dev/null | grep -c "cmdline.txt") if [ ${cmdlineExists} -eq 1 ] && [ ${#hddAdapterUSB} -gt 0 ] && [ ${hddAdapterUSAP} -eq 0 ]; then echo "# Checking for UASP deactivation ..." - usbQuirkActive=$(cat /boot/cmdline.txt | grep -c "usb-storage.quirks=") - usbQuirkDone=$(cat /boot/cmdline.txt | grep -c "usb-storage.quirks=${hddAdapterUSB}:u") + usbQuirkActive=$(cat ${raspi_bootdir}/cmdline.txt | grep -c "usb-storage.quirks=") + usbQuirkDone=$(cat ${raspi_bootdir}/cmdline.txt | grep -c "usb-storage.quirks=${hddAdapterUSB}:u") if [ ${usbQuirkActive} -gt 0 ] && [ ${usbQuirkDone} -eq 0 ]; then # remove old usb-storage.quirks - sed -i "s/usb-storage.quirks=[^ ]* //g" /boot/cmdline.txt + sed -i "s/usb-storage.quirks=[^ ]* //g" ${raspi_bootdir}/cmdline.txt fi if [ ${usbQuirkDone} -eq 0 ]; then # add new usb-storage.quirks - sed -i "s/^/usb-storage.quirks=${hddAdapterUSB}:u /" /boot/cmdline.txt + sed -i "s/^/usb-storage.quirks=${hddAdapterUSB}:u /" ${raspi_bootdir}/cmdline.txt # go into reboot to activate new setting echo "# DONE deactivating UASP for ${hddAdapterUSB} ... reboot needed" echo "neededReboot=1" diff --git a/home.admin/config.scripts/blitz.display.sh b/home.admin/config.scripts/blitz.display.sh index 021fb2a53..0abdc16f2 100644 --- a/home.admin/config.scripts/blitz.display.sh +++ b/home.admin/config.scripts/blitz.display.sh @@ -19,6 +19,7 @@ fi # 1. Parameter: lcd command command=$1 +echo "### blitz.display.sh $command" # its OK if its not exist yet source /home/admin/raspiblitz.info @@ -29,6 +30,16 @@ source /mnt/hdd/raspiblitz.conf 2>/dev/null # but basically this just says if the driver for GPIO LCD is installed - not if connected fb1Exists=$(ls /dev/fb1 2>/dev/null | grep -c "/dev/fb1") +# determine correct raspberrypi config files +raspi_configfile="/boot/config.txt" +raspi_commandfile="/boot/cmdline.txt" +if [ -d /boot/firmware ];then + raspi_configfile="/boot/firmware/config.txt" + raspi_commandfile="/boot/firmware/cmdline.txt" +fi +echo "# raspi_configfile(${raspi_configfile})" +echo "# raspi_commandfile(${raspi_commandfile})" + ################### # QR CODE KONSOLE # fallback if no LCD is available @@ -137,7 +148,7 @@ if [ "${command}" == "rotate" ]; then # change rotation config echo "# Turn ON: LCD ROTATE" - sed -i "s/^dtoverlay=.*/dtoverlay=waveshare35a:rotate=90/g" /boot/config.txt + sed -i "s/^dtoverlay=.*/dtoverlay=waveshare35a:rotate=90/g" ${raspi_configfile} rm /etc/X11/xorg.conf.d/40-libinput.conf 2>/dev/null /home/admin/config.scripts/blitz.conf.sh set lcdrotate 1 1>/dev/null 2>/dev/null @@ -148,7 +159,7 @@ if [ "${command}" == "rotate" ]; then # change rotation config echo "#Turn OFF: LCD ROTATE" - sed -i "s/^dtoverlay=.*/dtoverlay=waveshare35a:rotate=270/g" /boot/config.txt + sed -i "s/^dtoverlay=.*/dtoverlay=waveshare35a:rotate=270/g" ${raspi_configfile} # if touchscreen is on if [ "${touchscreen}" = "1" ]; then @@ -219,14 +230,14 @@ function prepareinstall() { function install_hdmi() { echo "# hdmi install ... set framebuffer width/height" - #sed -i "s/^#framebuffer_width=.*/framebuffer_width=480/g" /boot/config.txt - #sed -i "s/^#framebuffer_height=.*/framebuffer_height=320/g" /boot/config.txt + #sed -i "s/^#framebuffer_width=.*/framebuffer_width=480/g" ${raspi_configfile} + #sed -i "s/^#framebuffer_height=.*/framebuffer_height=320/g" ${raspi_configfile} } function uninstall_hdmi() { echo "# hdmi uninstall ... reset framebuffer width/height" - #sed -i "s/^framebuffer_width=.*/#framebuffer_width=480/g" /boot/config.txt - #sed -i "s/^framebuffer_height=.*/#framebuffer_height=320/g" /boot/config.txt + #sed -i "s/^framebuffer_width=.*/#framebuffer_width=480/g" ${raspi_configfile} + #sed -i "s/^framebuffer_height=.*/#framebuffer_height=320/g" ${raspi_configfile} } function install_lcd() { @@ -261,35 +272,35 @@ function install_lcd() { # add waveshare mod cp ./waveshare35a.dtbo /boot/overlays/ - # modify /boot/config.txt - sed -i "s/^hdmi_force_hotplug=.*//g" /boot/firmware/config.txt - sed -i '/^hdmi_group=/d' /boot/firmware/config.txt 2>/dev/null - sed -i "/^hdmi_mode=/d" /boot/firmware/config.txt 2>/dev/null + # modify config file + sed -i "s/^hdmi_force_hotplug=.*//g" ${raspi_configfile} + sed -i '/^hdmi_group=/d' ${raspi_configfile} 2>/dev/null + sed -i "/^hdmi_mode=/d" ${raspi_configfile} 2>/dev/null - #sed -i "s/^#framebuffer_width=.*/framebuffer_width=480/g" /boot/config.txt - #sed -i "s/^#framebuffer_height=.*/framebuffer_height=320/g" /boot/config.txt - #echo "hdmi_force_hotplug=1" >> /boot/firmware/config.txt - sed -i "s/^dtparam=i2c_arm=.*//g" /boot/firmware/config.txt - # echo "dtparam=i2c_arm=on" >> /boot/config.txt --> this is to be called I2C errors - see: https://github.com/rootzoll/raspiblitz/issues/1058#issuecomment-739517713 + #sed -i "s/^#framebuffer_width=.*/framebuffer_width=480/g" ${raspi_configfile} + #sed -i "s/^#framebuffer_height=.*/framebuffer_height=320/g" ${raspi_configfile} + #echo "hdmi_force_hotplug=1" >> ${raspi_configfile} + sed -i "s/^dtparam=i2c_arm=.*//g" ${raspi_configfile} + # echo "dtparam=i2c_arm=on" >> ${raspi_configfile} --> this is to be called I2C errors - see: https://github.com/rootzoll/raspiblitz/issues/1058#issuecomment-739517713 # don't enable SPI and UART ports by default - # echo "dtparam=spi=on" >> /boot/firmware/config.txt - # echo "enable_uart=1" >> /boot/firmware/config.txt - sed -i "s/^dtoverlay=.*//g" /boot/firmware/config.txt - echo "dtoverlay=waveshare35a:rotate=90" >> /boot/firmware/config.txt + # echo "dtparam=spi=on" >> ${raspi_configfile} + # echo "enable_uart=1" >> ${raspi_configfile} + sed -i "s/^dtoverlay=.*//g" ${raspi_configfile} + echo "dtoverlay=waveshare35a:rotate=90" >> ${raspi_configfile} # modify cmdline.txt modification="dwc_otg.lpm_enable=0 quiet fbcon=map:10 fbcon=font:ProFont6x11 logo.nologo" - containsModification=$(grep -c "${modification}" /boot/cmdline.txt) + containsModification=$(grep -c "${modification}" ${raspi_commandfile}) if [ ${containsModification} -eq 0 ]; then - echo "# adding modification to /boot/cmdline.txt" - cmdlineContent=$(cat /boot/cmdline.txt) - echo "${cmdlineContent} ${modification}" > /boot/cmdline.txt + echo "# adding modification to ${raspi_commandfile}" + cmdlineContent=$(cat ${raspi_commandfile}) + echo "${cmdlineContent} ${modification}" > ${raspi_commandfile} else - echo "# /boot/cmdline.txt already contains modification" + echo "# ${raspi_commandfile} already contains modification" fi - containsModification=$(grep -c "${modification}" /boot/cmdline.txt) + containsModification=$(grep -c "${modification}" ${raspi_commandfile}) if [ ${containsModification} -eq 0 ]; then - echo "# FAIL: was not able to modify /boot/cmdline.txt" + echo "# FAIL: was not able to modify ${raspi_commandfile}" echo "err='ended unclear state'" exit 1 fi @@ -327,19 +338,19 @@ function uninstall_lcd() { apt-get install -y xinput-calibrator # remove modifications of config.txt - sed -i '/^hdmi_force_hotplug=/d' /boot/config.txt 2>/dev/null - sed -i '/^hdmi_group=/d' /boot/config.txt 2>/dev/null - sed -i "/^hdmi_mode=/d" /boot/config.txt 2>/dev/null - sed -i "s/^dtoverlay=.*//g" /boot/config.txt 2>/dev/null - #sed -i "s/^framebuffer_width=.*/#framebuffer_width=480/g" /boot/config.txt - #sed -i "s/^framebuffer_height=.*/#framebuffer_height=320/g" /boot/config.txt - echo "hdmi_group=1" >> /boot/config.txt - echo "hdmi_mode=3" >> /boot/config.txt - echo "dtoverlay=pi3-disable-bt" >> /boot/config.txt - echo "dtoverlay=disable-bt" >> /boot/config.txt + sed -i '/^hdmi_force_hotplug=/d' ${raspi_configfile} 2>/dev/null + sed -i '/^hdmi_group=/d' ${raspi_configfile} 2>/dev/null + sed -i "/^hdmi_mode=/d" ${raspi_configfile} 2>/dev/null + sed -i "s/^dtoverlay=.*//g" ${raspi_configfile} 2>/dev/null + #sed -i "s/^framebuffer_width=.*/#framebuffer_width=480/g" ${raspi_configfile} + #sed -i "s/^framebuffer_height=.*/#framebuffer_height=320/g" ${raspi_configfile} + echo "hdmi_group=1" >> ${raspi_configfile} + echo "hdmi_mode=3" >> ${raspi_configfile} + echo "dtoverlay=pi3-disable-bt" >> ${raspi_configfile} + echo "dtoverlay=disable-bt" >> ${raspi_configfile} # remove modification of cmdline.txt - sed -i "s/ dwc_otg.lpm_enable=0 quiet fbcon=map:10 fbcon=font:ProFont6x11 logo.nologo//g" /boot/cmdline.txt + sed -i "s/ dwc_otg.lpm_enable=0 quiet fbcon=map:10 fbcon=font:ProFont6x11 logo.nologo//g" ${raspi_commandfile} # un-prepare X11 mv /home/admin/wavesharelcd-64bit-rpi/40-libinput.conf /etc/X11/xorg.conf.d/40-libinput.conf 2>/dev/null diff --git a/home.admin/config.scripts/blitz.fatpack.sh b/home.admin/config.scripts/blitz.fatpack.sh index 56d1891f6..09d5d962a 100755 --- a/home.admin/config.scripts/blitz.fatpack.sh +++ b/home.admin/config.scripts/blitz.fatpack.sh @@ -9,6 +9,15 @@ if [ "$EUID" -ne 0 ] exit 1 fi +# determine correct raspberrypi boot drive path (that easy to access when sd card is insert into laptop) +raspi_bootdir="" +if [ -d /boot/firmware ]; then + raspi_bootdir="/boot/firmware" +elif [ -d /boot ]; then + raspi_bootdir="/boot" +fi +echo "# raspi_bootdir(${raspi_bootdir})" + # make sure LCD is on (default for fatpack) /home/admin/config.scripts/blitz.display.sh set-display lcd @@ -24,7 +33,7 @@ if [ "${needsExpansion}" == "1" ]; then # write a stop file to prevent full bootstrap # after fsexpand reboot - touch /boot/firmware/stop + touch ${raspi_bootdir}/stop # trigger fsexpand /home/admin/config.scripts/blitz.bootdrive.sh fsexpand diff --git a/home.admin/config.scripts/blitz.preparerelease.sh b/home.admin/config.scripts/blitz.preparerelease.sh index b81194517..54b497dad 100755 --- a/home.admin/config.scripts/blitz.preparerelease.sh +++ b/home.admin/config.scripts/blitz.preparerelease.sh @@ -3,13 +3,22 @@ # Just run this script once after a fresh sd card build # to prepare the image for release as a downloadable sd card image +# determine correct raspberrypi boot drive path (that easy to access when sd card is insert into laptop) +raspi_bootdir="" +if [ -d /boot/firmware ]; then + raspi_bootdir="/boot/firmware" +elif [ -d /boot ]; then + raspi_bootdir="/boot" +fi +echo "# raspi_bootdir(${raspi_bootdir})" + # stop background services sudo systemctl stop background.service sudo systemctl stop background.scan.service # remove stop flag (if exists) echo "deleting stop flag .." -sudo rm /boot/firmware/stop 2>/dev/null +sudo rm ${raspi_bootdir}/stop 2>/dev/null # cleaning logs echo "deleting raspiblitz & system logs .." @@ -68,7 +77,7 @@ echo "keys will get recreated and sshd reactivated on fresh bootup, by _bootstra sudo systemctl stop sshd sudo systemctl disable sshd sudo rm /etc/ssh/ssh_host_* -sudo touch /boot/firmware/ssh +sudo touch ${raspi_bootdir}/ssh echo "OK" echo diff --git a/home.admin/config.scripts/blitz.touchscreen.sh b/home.admin/config.scripts/blitz.touchscreen.sh index 322f3f1d7..f7eaebeab 100755 --- a/home.admin/config.scripts/blitz.touchscreen.sh +++ b/home.admin/config.scripts/blitz.touchscreen.sh @@ -30,7 +30,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then fi echo "# make sure hdmi_force_hotplug is deactivated" - sudo sed -i '/^hdmi_force_hotplug=/d' /boot/config.txt 2>/dev/null + sudo sed -i '/^hdmi_force_hotplug=/d' /boot/firmware/config.txt 2>/dev/null # update install sources echo "making sure system dependencies are installed" @@ -207,8 +207,8 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then sudo raspi-config nonint do_boot_behaviour B2 >/dev/null 2>&1 # make sure hdmi_force_hotplug=1 is added again to config.txt - sudo sed -i '/^hdmi_force_hotplug=/d' /boot/config.txt 2>/dev/null - #echo "hdmi_force_hotplug=1" >> /boot/config.txt + sudo sed -i '/^hdmi_force_hotplug=/d' /boot/firmware/config.txt 2>/dev/null + #echo "hdmi_force_hotplug=1" >> /boot/firmware/config.txt # set user pi user for autostart # TODO(frennkie/rootzoll) what should happen here? This does the same as "on". diff --git a/home.admin/setup.scripts/controlSetupDialog.sh b/home.admin/setup.scripts/controlSetupDialog.sh index bbd292e98..fd634de78 100755 --- a/home.admin/setup.scripts/controlSetupDialog.sh +++ b/home.admin/setup.scripts/controlSetupDialog.sh @@ -157,7 +157,7 @@ if [ "${setupPhase}" == "setup" ]; then filesystem="ext4" # check if there is a flag set on sd card boot section to format as btrfs (experimental) - flagBTRFS=$(sudo ls /boot/btrfs* 2>/dev/null | grep -c btrfs) + flagBTRFS=$(sudo ls /boot/firmware/btrfs* 2>/dev/null | grep -c btrfs) if [ "${flagBTRFS}" != "0" ]; then echo "Found BTRFS flag ---> formatting with experimental BTRFS filesystem" filesystem="btrfs" From e4761966f32d32599c6b40db59ed2703f5557591 Mon Sep 17 00:00:00 2001 From: /rootzoll Date: Mon, 8 Apr 2024 12:17:33 +0200 Subject: [PATCH 7/8] #4534 activating watchdog reboot on halt (#4536) --- build_sdcard.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/build_sdcard.sh b/build_sdcard.sh index df84ba3a8..40fc911c0 100644 --- a/build_sdcard.sh +++ b/build_sdcard.sh @@ -442,6 +442,19 @@ if ! compgen -u pi; then adduser pi sudo fi +# activate watchdog if ls /dev/watchdog exists - see #4534 +if [ -e /dev/watchdog ]; then + echo "Activating watchdog ..." + if [ "${baseimage}" = "raspios_arm64" ]; then + echo "dtparam=watchdog=on" | tee -a $raspi_configfile + fi + sed -i "s/^#RuntimeWatchdogSec=.*/RuntimeWatchdogSec=600s/g" /etc/systemd/system.conf + sed -i "s/^#RebootWatchdogSec=.*/RebootWatchdogSec=3min/g" /etc/systemd/system.conf + sed -i "s/^#WatchdogDevice=.*/WatchdogDevice=\/dev\/watchdog/g" /etc/systemd/system.conf +else + echo "No watchdog device /dev/watchdog found - keep watchdog like default" +fi + # special prepare when RaspberryPi OS if [ "${baseimage}" = "raspios_arm64" ]; then @@ -463,7 +476,6 @@ if [ "${baseimage}" = "raspios_arm64" ]; then fi echo "max_usb_current=1" | tee -a $raspi_configfile echo "dtparam=nvme" | tee -a $raspi_configfile - echo "dtparam=watchdog=on" | tee -a $raspi_configfile echo 'dtoverlay=pi3-disable-bt' | tee -a $raspi_configfile echo 'dtoverlay=disable-bt' | tee -a $raspi_configfile else From c8e555c9b35393550884426f60ca961aaffe7d95 Mon Sep 17 00:00:00 2001 From: rootzoll Date: Mon, 8 Apr 2024 12:18:36 +0200 Subject: [PATCH 8/8] v1.11.0rc7 --- home.admin/_version.info | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home.admin/_version.info b/home.admin/_version.info index 9fa33ba02..3fcc3a9d6 100644 --- a/home.admin/_version.info +++ b/home.admin/_version.info @@ -1,3 +1,3 @@ # RaspiBlitz Version - always [major].[main].[sub] (sub can be a string like '2rc1') -codeVersion="1.11.0rc6" +codeVersion="1.11.0rc7" # keep last line with comment ---> IF YOU HAVE A NEW VERSION BRANCH > EDIT ALSO build_sdcard.sh \ No newline at end of file