Updated to v0.1.4
Fixed bugs and issues
- Fixed issue in common script with incorrect exit code capture of
subshells.
- Changed tar command for decompressing data.tar.gz file to only log
STDERR and void STDOUT.
- Log function was called without correct arguments @ln:239. Message
related to there being a new version available but wasn't logged.
This commit is contained in:
parent
0cc68dff4c
commit
a7bb0d2d80
10
updater
10
updater
|
|
@ -16,9 +16,9 @@
|
|||
# and potentially both. #
|
||||
# #
|
||||
# Author: Ethan Smith-Coss #
|
||||
# Version: 0.1.3 #
|
||||
# Version: 0.1.4 #
|
||||
# Created: 2021-05-20T16:47+0100 #
|
||||
# Last Modified: 2021-05-28T12:54+0100 #
|
||||
# Last Modified: 2021-06-05T16:45+0100 #
|
||||
# #
|
||||
# #################################### #
|
||||
# #
|
||||
|
|
@ -42,7 +42,7 @@
|
|||
## program name
|
||||
prog_name="Microsoft Edge Updater"
|
||||
## version
|
||||
version="0.1.3"
|
||||
version="0.1.4"
|
||||
## usage statement
|
||||
usage="Usage: $(basename $0) [OPTION]
|
||||
$prog_name ($version) - An updater program which can install the latest available version of Microsoft Edge to non-Debian-based Linux distros.
|
||||
|
|
@ -236,7 +236,7 @@ if [[ $upgradeable -eq 1 ]] ; then
|
|||
|
||||
exit 1
|
||||
fi
|
||||
log "DEBUG" "There is a more recent release of Microsoft Edge (Beta) available for download (v$release_version). Continuing with update."
|
||||
log "DEBUG" "There is a more recent release of Microsoft Edge (Beta) available for download (v$release_version). Continuing with update." "$log_file"
|
||||
echo "Identified a new release of Microsoft Edge (Beta) [Current: v$current_version. New: v$release_version]. Starting the download and installation process..."
|
||||
|
||||
## check if msedge process is already running
|
||||
|
|
@ -334,7 +334,7 @@ exit_code=$(ar vx "$tmp_path/$filename" --output "$tmp_path" >/dev/null 2>&1)
|
|||
log "ERROR" "There was an issue when unarchiving $filename. Exiting...(8)" "$log_file" ; exit 8 ; }
|
||||
log "DEBUG" "Successfully unarchived $filename, decompressing the data.tar.gz file..." "$log_file"
|
||||
## extract data from data.tar.gz
|
||||
exit_code=$(tar --overwrite -xvf "$tmp_path/data.tar.xz" --directory "$tmp_path" >>"$log_file" 2>&1)
|
||||
exit_code=$(tar --overwrite -xvf "$tmp_path/data.tar.xz" --directory "$tmp_path" 2>>"$log_file")
|
||||
[[ ! $exit_code -eq 0 ]] && { echo -e "incomplete.\nThere was an extracting data.tar.gz. Exiting updater...\n" ;
|
||||
log "ERROR" "There was an issue when decompressing data.tar.gz using tar -xvf. Exiting...(8)" "$tmp_path" ; exit 8 ; }
|
||||
log "DEBUG" "Successfully extracted files from data.tar.gz." "$log_file"
|
||||
|
|
|
|||
10
utils/common
10
utils/common
|
|
@ -7,9 +7,9 @@
|
|||
# #
|
||||
# #
|
||||
# Author: Ethan Smith-Coss #
|
||||
# Version: 0.1.3 #
|
||||
# Version: 0.1.4 #
|
||||
# Created: 2021-05-20T16:47+0100 #
|
||||
# Last Modified: 2021-05-27T15:34+0100 #
|
||||
# Last Modified: 2021-06-05T16:45+0100 #
|
||||
# #
|
||||
# #################################### #
|
||||
# #
|
||||
|
|
@ -48,7 +48,7 @@ function archive_system {
|
|||
local archive_output="/tmp/microsoft-edge-autoupdater/$(echo $1 | sed 's/\//_/').tar.gz"
|
||||
[[ -f "$archive_output" ]] && return 0
|
||||
|
||||
exit_code=$(grep 'usr/.*' "/tmp/microsoft-edge-autoupdater/Contents-amd64" | tar --overwrite -cvzf "$archive_output" "/opt/$1/" 2>>"$log_out")
|
||||
exit_code=$(grep 'usr/.*' "/tmp/microsoft-edge-autoupdater/Contents-amd64" | tar --overwrite -cvzf "$archive_output" "/opt/$1/" 2>>"$log_out" ; echo $?)
|
||||
[[ ! $exit_code -eq 0 ]] && { log "ERROR" "(Archive) There was an issue creating the archive file of system. Returning...(10)" "$log_out" ; return 10 ; }
|
||||
|
||||
return 0
|
||||
|
|
@ -59,7 +59,7 @@ function restore_files {
|
|||
[[ -e $1 ]] && log "ERROR" "Restore function was called without any arguments." "$log_out"
|
||||
local backup_file="/tmp/microsoft-edge-autoupdater/$(echo $1 | 's/\//_/').tar.gz"
|
||||
[[ -f "$backup_file" ]] && { log "ERROR" "There is no backup of Microsoft Edge (Beta) identified. Restoration not possible." "$log_out" ; return 12 ; }
|
||||
exit_code=$( tar -xvzf "$backup_file" "/" 2>>"$log_out")
|
||||
exit_code=$(tar -xvzf "$backup_file" "/" 2>>"$log_out" ; echo $?)
|
||||
[[ ! $exit_code -eq 0 ]] && { log "ERROR" "There was an issue restoring pervious files to system." \
|
||||
"The backup created will not be removed to allow for manual restoration. Returning...(12)" ; return 12 ; }
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ function notify {
|
|||
local log_out=$(realpath "${0%/*}/.log.1")
|
||||
[[ $# -eq 0 ]] && log "ERROR" "Notify function was called without any arguments. Returning 1." "$log_out" && return 1
|
||||
[[ ! $# -eq 2 ]] && log "ERROR" "Notify function expected at least 2 arguments, recieved $#. Returning 1." "$log_out" && return 1
|
||||
exit_code=$(notify-send "$1" "$2" >>"$log_out" 2>&1) && tput bel
|
||||
exit_code=$(notify-send "$1" "$2" >>"$log_out" 2>&1 ; echo $?) && tput bel
|
||||
[[ ! $exit_code -eq 0 ]] && log "ERROR" "There was an issue send a notification to the system." "$log_out"
|
||||
|
||||
return 0
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user