From d450edca731467a61cd662da70876dba40cbc335 Mon Sep 17 00:00:00 2001 From: rootzoll Date: Fri, 14 Feb 2025 22:37:14 +0100 Subject: [PATCH] scenarioSystemCopy also on migration --- home.admin/_bootstrap.sh | 17 +++++++++-------- home.admin/config.scripts/blitz.data.sh | 13 +++++++++++-- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/home.admin/_bootstrap.sh b/home.admin/_bootstrap.sh index a7ec9b963..d8dcbb19d 100755 --- a/home.admin/_bootstrap.sh +++ b/home.admin/_bootstrap.sh @@ -647,7 +647,7 @@ if [ "${scenario}" != "ready" ] ; then # map scenario to setupPhase /home/admin/_cache.sh set "system_setup_askSystemCopy" "0" - if [ "${scenario}" = "setup:system" ]; then + if [ "${scenario}" = "setup" ] && [ "${scenarioSystemCopy}" = "1" ]; then setupPhase="setup" infoMessage="Please start Setup" /home/admin/_cache.sh set "system_setup_askSystemCopy" "1" @@ -656,7 +656,7 @@ if [ "${scenario}" != "ready" ] ; then setupPhase="setup" infoMessage="Please start Setup" - elif [ "${scenario}" = "recover" ] || [ "${scenario}" = "recover:system" ]; then + elif [ "${scenario}" = "recover" ]; then setupPhase="recovery" infoMessage="Please start Recovery" @@ -715,14 +715,14 @@ if [ "${scenario}" != "ready" ] ; then setupCommand="skip" bootFromStorage=0 - # system recommended setup:system but user decided against - downgrade to simple setup - elif [ "${scenario}" = "setup:system" ] && [ "${systemCopy}" = "0" ] && [ "${deleteData}" = "all" ]; then + # system recommended setup & system but user decided against - downgrade to simple setup + elif [ "${scenario}" = "setup" ] && [ "${scenarioSystemCopy}" = "1" ] && [ "${systemCopy}" = "0" ] && [ "${deleteData}" = "all" ]; then scenario="setup" setupCommand="setup" bootFromStorage=0 # user agreed to system copy & delete all data - elif [ "${scenario}" = "setup:system" ] && [ "${systemCopy}" = "1" ] && [ "${deleteData}" = "all" ]; then + elif [ "${scenario}" = "setup" ]&& [ "${scenarioSystemCopy}" = "1" ] && [ "${systemCopy}" = "1" ] && [ "${deleteData}" = "all" ]; then setupCommand="setup" # user agreed to run system from install medium and delete all data @@ -731,7 +731,7 @@ if [ "${scenario}" != "ready" ] ; then bootFromStorage=0 # run recovery - elif [ "${scenario}" = "recover:system" ] || [ "${scenario}" = "recover" ]; then + elif [ "${scenario}" = "recover" ]; then setupCommand="recover" else @@ -797,7 +797,8 @@ if [ "${scenario}" != "ready" ] ; then # when system was installed on new boot drive echo "scenario(${scenario})" >> ${logFile} - if [ "${scenario}" = "setup:system" ] || [ "${scenario}" = "recover:system" ]; then + echo "scenarioSystemCopy(${scenarioSystemCopy})" >> ${logFile} + if [ "${scenarioSystemCopy}" = "1" ]; then # mark systemCopy as done in raspiblitz.setup if ! sed -i "s/^systemCopy=.*/systemCopy=done/" "${setupFile}"; then @@ -846,7 +847,7 @@ if [ "${scenario}" != "ready" ] ; then exit 0 else # continue with setup - echo "NOT setup:system or recover:system" >> ${logFile} + echo "NOT scenarioSystemCopy" >> ${logFile} fi else diff --git a/home.admin/config.scripts/blitz.data.sh b/home.admin/config.scripts/blitz.data.sh index 5b4e117e9..8a7baebcc 100644 --- a/home.admin/config.scripts/blitz.data.sh +++ b/home.admin/config.scripts/blitz.data.sh @@ -539,12 +539,18 @@ if [ "$action" = "status" ] || [ "$action" = "mount" ] || [ "$action" = "unmount ################# # Define Scenario + # Initialize systemCopy flag to default 0 + systemCopy=0 + # migration: detected data from another node implementation if [ ${#scenario} -gt 0 ]; then echo "# scenario already set by analysis above to: ${scenario}" elif [ ${#storageMigration} -gt 0 ]; then scenario="migration" + if [ "${systemMountedPath}" != "/" ] && [ ${bootFromSD} -eq 0 ]; then + systemCopy=1 + fi # nodata: no drives >64GB connected elif [ ${#storageDevice} -eq 0 ]; then @@ -560,7 +566,8 @@ if [ "$action" = "status" ] || [ "$action" = "mount" ] || [ "$action" = "unmount # recover: drives there but unmounted & blitz config exists (check raspiblitz.conf with -inspect if its update) elif [ ${#storageDevice} -gt 0 ] && [ ${#storageMountedPath} -eq 0 ] && [ ${dataConfigFound} -eq 1 ] && [ "${systemMountedPath}" != "/" ] && [ ${bootFromSD} -eq 0 ]; then - scenario="recover:system" # auto update system before recover + scenario="recover" + systemCopy=1 # recover: drives there but unmounted & blitz config exists (check raspiblitz.conf with -inspect if its update) elif [ ${#storageDevice} -gt 0 ] && [ ${#storageMountedPath} -eq 0 ] && [ ${dataConfigFound} -eq 1 ]; then @@ -568,7 +575,8 @@ if [ "$action" = "status" ] || [ "$action" = "mount" ] || [ "$action" = "unmount # setup: drives there but unmounted & no blitz config exists & booted from install media elif [ ${#storageDevice} -gt 0 ] && [ ${#storageMountedPath} -eq 0 ] && [ ${dataConfigFound} -eq 0 ] && [ "${systemMountedPath}" != "/" ] && [ ${bootFromSD} -eq 0 ]; then - scenario="setup:system" # ask user to change bootdrive before setup + scenario="setup" + systemCopy=1 # setup: drives there but unmounted & no blitz config exists elif [ ${#storageDevice} -gt 0 ] && [ ${#storageMountedPath} -eq 0 ] && [ ${dataConfigFound} -eq 0 ]; then @@ -581,6 +589,7 @@ if [ "$action" = "status" ] || [ "$action" = "mount" ] || [ "$action" = "unmount # output the result echo "scenario='${scenario}'" + echo "scenarioSystemCopy='${systemCopy}'" echo "storageDevice='${storageDevice}'" echo "storageDeviceName='${storageDeviceName}'" echo "storageSizeGB='${storageSizeGB}'"