diff options
author | William Harrington <kb0iic@berzerkula.org> | 2021-03-25 11:15:34 -0500 |
---|---|---|
committer | William Harrington <kb0iic@berzerkula.org> | 2021-03-25 11:15:34 -0500 |
commit | 89a12d1e4dc4fddf6ea4f3be84310cb789d0bc09 (patch) | |
tree | d11192eb9e13daf2188ca143b51cb3139b28ad38 | |
parent | 3129e0fd3f2928862974902fb06e7258ec122b5e (diff) | |
parent | 41b1fa5813a7e7dd1df52ea8a9afc5062dff9d7d (diff) |
Merge branch 'master' into chapter7
-rw-r--r-- | chapter6/backup.sh | 12 | ||||
-rw-r--r-- | chapter6/m4.sh | 2 | ||||
-rw-r--r-- | download.sh | 3 | ||||
-rw-r--r-- | env.sh | 2 | ||||
-rw-r--r-- | packageinstall.sh | 3 | ||||
-rw-r--r-- | spinner.sh | 6 |
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 @@ -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 @@ -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 |