aboutsummaryrefslogtreecommitdiffstats
path: root/chapter6/backup.sh
diff options
context:
space:
mode:
authorWilliam Harrington <kb0iic@berzerkula.org>2021-03-25 11:15:34 -0500
committerWilliam Harrington <kb0iic@berzerkula.org>2021-03-25 11:15:34 -0500
commit89a12d1e4dc4fddf6ea4f3be84310cb789d0bc09 (patch)
treed11192eb9e13daf2188ca143b51cb3139b28ad38 /chapter6/backup.sh
parent3129e0fd3f2928862974902fb06e7258ec122b5e (diff)
parent41b1fa5813a7e7dd1df52ea8a9afc5062dff9d7d (diff)
Merge branch 'master' into chapter7
Diffstat (limited to 'chapter6/backup.sh')
-rw-r--r--chapter6/backup.sh12
1 files changed, 7 insertions, 5 deletions
diff --git a/chapter6/backup.sh b/chapter6/backup.sh
index c763d8c..f2f0d64 100644
--- a/chapter6/backup.sh
+++ b/chapter6/backup.sh
@@ -1,25 +1,27 @@
#!/bin/bash
-FILE="${LFS_VER}-ch6-backup.tar.xz"
-DIRS=(bin etc lib lib64 sbin tools usr var)
+file="${LFS_VER}-ch6-backup.tar.xz"
+directories=(bin etc lib lib64 sbin tools usr var)
if [ -f "${LFS}/sources/chapter6/backup" ]; then
printf "%b" "${YLW}Chapter 6 ${GRN}Backup found. Remove manually to backup again.${RST}"
else
- echo -ne "${GRN}Backing up ${YLW}${LFS}${GRN} to ${YLW}${FILE}${RST}... "
+ 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}" "${DIRS[@]}" & pid=$!
+ sudo XZ_OPTS="-T${NUMPROCS} -e" tar cJpf "${HOME}"/"${file}" "${directories[@]}" & pid=$!
spinner "$pid"
retval=$?
if [ "$retval" -ne 0 ]; then
printf "%b" "${RED}Backup FAILED!${RST}\n"
exit 1
else
- sudo chown "${USER}" "${HOME}"/"${FILE}"
+ sudo chown "${USER}" "${HOME}"/"${file}"
printf "%b" "${GRN}OK${RST}\n"
fi
popd > /dev/null || exit 1
touch "${LFS}/sources/chapter6/backup"
fi
+
+unset file directories