diff options
author | William Harrington <kb0iic@berzerkula.org> | 2021-03-26 17:17:43 -0500 |
---|---|---|
committer | William Harrington <kb0iic@berzerkula.org> | 2021-03-26 17:17:43 -0500 |
commit | 105789821259880e1eb035d9506eac3cab82e624 (patch) | |
tree | eb7c2e976617afeb8b13d6a5b1313a0f60f0fa60 /chapter7 | |
parent | 6df3121c554f485fc747feb0f348b50e08c3680f (diff) |
Direct all tar output to /dev/null and return FAILED and exit upon failure.
Diffstat (limited to 'chapter7')
-rw-r--r-- | chapter7/backup.sh | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/chapter7/backup.sh b/chapter7/backup.sh index 8cba32d..2e980c5 100644 --- a/chapter7/backup.sh +++ b/chapter7/backup.sh @@ -9,11 +9,12 @@ else echo -ne "${GRN}Backing up ${YLW}${LFS}${GRN} to ${YLW}${file}${RST}... " pushd "${LFS}" > /dev/null || exit 1 - sudo XZ_OPTS="-T${NUMPROCS} -e" tar cJpf "${HOME}"/"${file}" "${directories[@]}" & pid=$! + sudo XZ_OPTS="-T${NUMPROCS} -e" tar cJpf "${HOME}"/"${file}" "${directories[@]}" >/dev/null 2>&1 & pid=$! spinner "$pid" retval=$? - if [ "$retval" -ne 0 ]; then - echo -e "${RED}Backup FAILED!${RST}" + if [ "${retval}" -ne 0 ]; then + echo -e "${RED}FAILED!${RST}" + exit "${retval}" else echo -e "${GRN}OK${RST}" fi @@ -21,5 +22,3 @@ else touch "${LFS}/sources/chapter7/backup" fi - -unset file directories |