diff --git a/dietpi/dietpi-update b/dietpi/dietpi-update index 815b20ff85..616e86a391 100644 --- a/dietpi/dietpi-update +++ b/dietpi/dietpi-update @@ -10,15 +10,16 @@ #//////////////////////////////////// # # Info: + # - Location: /{DietPi,boot}/dietpi/dietpi-update # - Updates DietPi from Git or dietpi.com repo # - Uses patch_file for incremental online patching # - Uses pre-patch_file for critical fixes and update related changes # # Usage: - # - dietpi-update = Normal - # - dietpi-update 1 = noninteractive update - # - dietpi-update 2 = Check for updates. print server_version to /DietPi/dietpi/.update_available (-1=new image required) - # - dietpi-update -1 = Include reapplying the current subversion patch, e.g. to update dev branch + # - dietpi-update = Normal + # - dietpi-update 1 = noninteractive update + # - dietpi-update 2 = Check for updates. print server_version to /DietPi/dietpi/.update_available (-1=new image required) + # - dietpi-update -1 = Include reapplying the current subversion patch, e.g. to update dev branch #//////////////////////////////////// # Import DietPi-Globals -------------------------------------------------------------- @@ -48,9 +49,9 @@ UPDATE_REQUIRESNEWIMAGE=0 RUN_UPDATE=0 - GITOWNER_TARGET=$(grep -m1 '^[[:blank:]]*DEV_GITOWNER=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') + GITOWNER_TARGET=$(sed -n '/^[[:blank:]]*DEV_GITOWNER=/{s/^[^=]*=//p;q}' /DietPi/dietpi.txt) GITOWNER_TARGET=${GITOWNER_TARGET:-MichaIng} - GITBRANCH_TARGET=$(grep -m1 '^[[:blank:]]*DEV_GITBRANCH=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') + GITBRANCH_TARGET=$(sed -n '/^[[:blank:]]*DEV_GITBRANCH=/{s/^[^=]*=//p;q}' /DietPi/dietpi.txt) GITBRANCH_TARGET=${GITBRANCH_TARGET:-master} COREVERSION_SERVER=0 @@ -466,7 +467,8 @@ When DietPi applies updates, all system services will be temporarily stopped. Do # - Pre-estimate and override terminal size variables, since they cannot be estimated, if STOUT and STERR are redirected: https://github.com/MichaIng/DietPi/issues/2105 export G_WHIP_SIZE_X_OVERRIDE=$(tput cols) export G_WHIP_SIZE_Y_OVERRIDE=$(tput lines) - Run_Update 2>&1 | tee $FP_TMP_LOG + # - Log to file by redirecting to subshell instead of piping, else G_ERROR_HANDLER cannot exit the script via "kill -INT $$": https://github.com/MichaIng/DietPi/issues/3127 + Run_Update &> >(tee $FP_TMP_LOG); wait $! unset G_WHIP_SIZE_X_OVERRIDE G_WHIP_SIZE_Y_OVERRIDE # Mark 1st run update as completed @@ -488,6 +490,7 @@ When DietPi applies updates, all system services will be temporarily stopped. Do l_message='Syncing new DietPi scripts to disk' G_RUN_CMD /DietPi/dietpi/func/dietpi-ramdisk 1 > /DietPi/.ramdisk + # Start services only on finished install state, else dietpi-software will follow immediately (( $G_DIETPI_INSTALL_STAGE == 2 )) && /DietPi/dietpi/dietpi-services restart fi