Skip to content

Commit

Permalink
v6.26
Browse files Browse the repository at this point in the history
+ DietPi-Update | Log update output to file by redirecting to subshell instead of piping, else G_ERROR_HANDLER cannot exit the script via "kill -INT $$": #3127
+ DietPi-Update | Minor coding and adding some info comments
  • Loading branch information
MichaIng authored Sep 26, 2019
1 parent 7e98440 commit 1e52d13
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions dietpi/dietpi-update
Original file line number Diff line number Diff line change
Expand Up @@ -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 --------------------------------------------------------------
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 1e52d13

Please sign in to comment.