aboutsummaryrefslogtreecommitdiffstats
path: root/chapter6/backup.sh
diff options
context:
space:
mode:
authorWilliam Harrington <kb0iic@berzerkula.org>2021-03-23 13:17:02 -0500
committerWilliam Harrington <kb0iic@berzerkula.org>2021-03-23 13:17:02 -0500
commit66d4171655e0b93766c82f50ce06521f85b58222 (patch)
tree1b6d1cbcbc169e5cbb4e6ea6698ed91d82d7cc88 /chapter6/backup.sh
parent9d68d5da4115353816ab4f6b1c7a4f5db43576f9 (diff)
parent887bf450c01c511a3f6d048d3db78e8edfb21e8a (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 92a176d..0f474d6 100644
--- a/chapter6/backup.sh
+++ b/chapter6/backup.sh
@@ -1,3 +1,5 @@
+#!/bin/bash
+
FILE="${LFS_VER}-ch6-backup.tar.xz"
DIRS="bin etc lib lib64 sbin tools usr var"
@@ -6,17 +8,17 @@ if [ -f "${LFS}/sources/chapter6/backup" ]; then
else
echo -ne "${GRN}Backing up ${YLW}${LFS}${GRN} to ${YLW}${FILE}${RST}... "
- pushd ${LFS} > /dev/null
- sudo XZ_OPTS="${NUMPROCS} -e" tar -cJpf /home/${USER}/${FILE} ${DIRS} & pid=$!
- spinner "$!"
+ pushd "${LFS}" > /dev/null || exit 1
+ sudo XZ_OPTS="${NUMPROCS} -e" tar -cJpf /home/"${USER}"/"${FILE}" "${DIRS}" & pid=$!
+ spinner "$pid"
retval=$?
if [ "$retval" -ne 0 ]; then
echo -e "${RED}Backup FAILED!${RST}"
else
- sudo chown ${USER} /home/${USER}/${FILE}
+ sudo chown "${USER}" /home/"${USER}"/"${FILE}"
echo -e "${GRN}OK${RST}"
fi
- popd > /dev/null
+ popd > /dev/null || exit 1
touch "${LFS}/sources/chapter6/backup"
fi