Fixed bug

Logic error identifying if a backup file exists.
This commit is contained in:
Ethan Smith-Coss 2021-06-15 23:51:25 +01:00
parent 0fb16f178d
commit 9ec3bacc9d

View File

@ -59,7 +59,7 @@ function restore_files {
local log_out=$(realpath "${0%/*}/.log.1") local log_out=$(realpath "${0%/*}/.log.1")
[[ -e $1 ]] && log "ERROR" "Restore function was called without any arguments." "$log_out" [[ -e $1 ]] && log "ERROR" "Restore function was called without any arguments." "$log_out"
local backup_file="/tmp/microsoft-edge-autoupdater/$(echo $1 | sed 's/\//_/').tar.gz" local backup_file="/tmp/microsoft-edge-autoupdater/$(echo $1 | sed 's/\//_/').tar.gz"
[[ -f "$backup_file" ]] && { log "ERROR" "There is no backup of Microsoft Edge (Beta) identified. Restoration not possible." "$log_out" ; return 12 ; } [[ ! -f "$backup_file" ]] && { log "ERROR" "There is no backup of Microsoft Edge (Beta) identified. Restoration not possible." "$log_out" ; return 12 ; }
tar -xzf "$backup_file" "/" > "/tmp/microsoft-edge-autoupdater/tar_dump.log" 2>>"$log_out" tar -xzf "$backup_file" "/" > "/tmp/microsoft-edge-autoupdater/tar_dump.log" 2>>"$log_out"
exit_code=$? exit_code=$?
[[ ! $exit_code -eq 0 ]] && { log "ERROR" "There was an issue restoring pervious files to system." \ [[ ! $exit_code -eq 0 ]] && { log "ERROR" "There was an issue restoring pervious files to system." \