aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chapter6/backup.sh12
-rw-r--r--chapter6/m4.sh2
-rw-r--r--download.sh3
-rw-r--r--env.sh2
-rw-r--r--packageinstall.sh3
-rw-r--r--spinner.sh6
6 files changed, 18 insertions, 10 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
diff --git a/chapter6/m4.sh b/chapter6/m4.sh
index 2f67ebe..6dc2c9a 100644
--- a/chapter6/m4.sh
+++ b/chapter6/m4.sh
@@ -12,3 +12,5 @@ sed '/^HELP2MAN/s/$/ --no-discard-stderr/' -i doc/Makefile.in
--build="$(build-aux/config.guess)" &&
make &&
make DESTDIR="${LFS}" -j1 install
+
+unset CFLAGS
diff --git a/download.sh b/download.sh
index d816394..72b7bb3 100644
--- a/download.sh
+++ b/download.sh
@@ -24,7 +24,6 @@ cat packages.csv patches.csv | while read -r line; do
printf "%b" "${PRP}Downloading ${YLW}${CACHEFILE}${RST}... "
- #wget -nc ${URL} -O ${LFS}/sources/${CACHEFILE} --progress=dot -q --show-progress 2>&1 | awk 'NF>2 && $(NF-2) ~ /%/{printf "\r \t\t\t\t\t\t%s",$(NF-2)} END{print "\r "}'
download "${URL}"
if ! echo "${MD5SUM} ${LFS}/sources/${CACHEFILE}" | md5sum -c > /dev/null 2>&1; then
rm -f "${LFS}/sources/${CACHEFILE}"
@@ -33,3 +32,5 @@ cat packages.csv patches.csv | while read -r line; do
fi
fi
done
+
+unset VERSION URL MD5SUM CACHEFILE
diff --git a/env.sh b/env.sh
index ab028e5..4e05c06 100644
--- a/env.sh
+++ b/env.sh
@@ -33,5 +33,7 @@ numjobs=$((NUMPROCS * 2 - 1))
# Make flags for multiple jobs
MAKEFLAGS="-j ${numjobs}"
+unset numjobs
+
export PS1 LC_ALL LFS LFS_TGT PATH CONFIG_SITE
export LFS_VER LFS_DISK LFS_PART LFS_PWD NUMPROCS MAKEFLAGS
diff --git a/packageinstall.sh b/packageinstall.sh
index c08710a..6dc7601 100644
--- a/packageinstall.sh
+++ b/packageinstall.sh
@@ -11,7 +11,6 @@ else
VERSION="$(echo "$line" | cut -d\, -f2)"
URL="$(echo "$line" | cut -d\, -f3 | sed "s/@/${VERSION}/g")"
CACHEFILE="$(basename "${URL}")"
- #DIRNAME="$(echo "${CACHEFILE}" | sed 's/\(.*\)\.tar\..*/\1/')"
DIRNAME="$(tar -tf "${CACHEFILE}" | sed -e 's@/.*@@' | uniq)"
# Remove existing if exists
@@ -49,3 +48,5 @@ else
done
fi
+
+unset VERSION URL CACHEFILE DIRNAME CHAPTER PACKAGE
diff --git a/spinner.sh b/spinner.sh
index 5332ee1..74cb450 100644
--- a/spinner.sh
+++ b/spinner.sh
@@ -4,13 +4,13 @@
# string to display as second argument (default provided) and spins
# until the process completes.
spinner() {
- local PROC="$1"
+ local proc="$1"
#local str="${2:-'Copyright of KatworX© Tech. Developed by Arjun Singh Kathait and Debugged by the ☆Stack Overflow Community☆'}"
local str=""
local delay="0.1"
tput civis # hide cursor
printf "%b" "${WHT}"
- while [ -d /proc/"$PROC" ]; do
+ while [ -d /proc/"$proc" ]; do
#-\|/
#⠁⠂⠄⡀⢀⠠⠐⠈
#▁▂▃▄▅▆▇█▇▆▅▄▃▂▁
@@ -38,7 +38,7 @@ spinner() {
printf '\033[s\033[u[ ▂ ] %s\033[u' "$str"; sleep "$delay"
printf '\033[s\033[u[ ▁ ] %s\033[u' "$str"; sleep "$delay"
done
- wait "${PROC}"
+ wait "${proc}"
retval=$?
printf '\033[s\033[u%*s\033[u\033[0m' $((${#str}+6)) " " # return to normal
tput cnorm # restore cursor