From 105789821259880e1eb035d9506eac3cab82e624 Mon Sep 17 00:00:00 2001 From: William Harrington Date: Fri, 26 Mar 2021 17:17:43 -0500 Subject: Direct all tar output to /dev/null and return FAILED and exit upon failure. --- chapter7/backup.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'chapter7') 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 -- cgit v1.2.3-54-g00ecf