Updated updater and fixed bugs
Fixed minor bugs that do not cause major issues for updating.
Changed the behaviour of killing the msedge process
- enter a loop if process is still identified as running.
- attempted to kill process 3 times and wait 2 seconds between each
attempt.
- if failed 3 times, log and exit 253.
This commit is contained in:
parent
05ef201cff
commit
2d00ffeda4
27
updater
27
updater
|
|
@ -310,10 +310,27 @@ if [[ $is_running -gt 1 ]] ; then
|
|||
[[ $(echo $choice | awk '{print tolower($0)}') == "n" ]] && { log "DEBUG" "User opted against allowing the script to close Microsoft Edge ($edge_channel) by default. Exiting...(1)" "$log_file" ; exit 1 ; }
|
||||
fi
|
||||
log "DEBUG" "Confirmation has been given to proceed with killing Microsoft Edge ($edge_channel) processes. Killing msedge..." "$log_file"
|
||||
killall msedge
|
||||
exit_code=$?
|
||||
[[ ! $exit_code -eq 0 ]] && { log "ERROR" "Process is refusing to exit. Sending SIGKILL signal." "$log_file" ;
|
||||
pkill -9 msedge ; }
|
||||
|
||||
kill_attempts=0
|
||||
while [[ -n $(pidof msedge) ]] ; do
|
||||
[[ $? -eq 0 && $kill_attempts -ge 1 ]] && {
|
||||
log "WARNING" "Process is refusing to exit. Attempting to kill process again after 2 seconds..." "$log_file" ;
|
||||
sleep 2 ; }
|
||||
[[ $kill_attempts -eq 3 ]] && {
|
||||
echo "There was an issue trying to close Microsoft Edge ($edge_channel). Please close the browser and restart the updater." ;
|
||||
log "ERROR" "Process has refused to close $kill_attempts time(s). Update cannot continue in current state, exiting...(253)" "$log_file" ;
|
||||
exit 253 ; }
|
||||
pkill msedge
|
||||
done
|
||||
# killall_stdout="$(killall msedge 2>&1)"
|
||||
# exit_code=$?
|
||||
# [[ ! $exit_code -eq 0 ]] && {
|
||||
## :@TODO: employ a similar mechanism to that created by Rob in autostart script (https://robmc.duckdns.org/git/robert/dotfiles/src/branch/master/.local/share/dwm/autostart.sh) to keep attempting to end msedge process if it refuses.
|
||||
# if [[ "$killall_stdout" == "msedge: no process found" ]] ; then
|
||||
# log "DEBUG" "Process has already been closed by another means, either by an external process or user."
|
||||
# else
|
||||
# pkill -9 msedge
|
||||
# fi ; }
|
||||
fi
|
||||
log "DEBUG" "Microsoft Edge ($edge_channel) has been closed, either by yes flag enabled or by user decision. Process may not have been running thus never killed." "$log_file"
|
||||
|
||||
|
|
@ -408,7 +425,7 @@ exit_code=$?
|
|||
log "DEBUG" "Successfully extracted files from data.tar.gz." "$log_file"
|
||||
[[ ! $quiet -eq 0 ]] && echo "completed."
|
||||
## etc/ directory only contains a cron daily directory, remove it
|
||||
[[ ! $quiet -eq 0 ]] && m -r "$tmp_path/etc/"
|
||||
[[ ! $quiet -eq 0 ]] && rm -r "$tmp_path/etc/"
|
||||
## add data.tar.xz to the garbage list
|
||||
echo "$tmp_path/data.tar.xz" >> "$garbage"
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user