From fa43dec5de9704ebf4b33aa079e636a5b4463a87 Mon Sep 17 00:00:00 2001 From: William Harrington Date: Wed, 24 Mar 2021 11:10:04 -0500 Subject: Adjust CHROOT printf's and add chapter 7 blocks. --- lfs.sh | 41 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) (limited to 'lfs.sh') diff --git a/lfs.sh b/lfs.sh index c154c19..84da9b6 100755 --- a/lfs.sh +++ b/lfs.sh @@ -99,14 +99,14 @@ for package in m4 ncurses bash coreutils diffutils file findutils gawk grep gzip fi done -#source chapter6/cleanup.sh -#source chapter6/backup.sh +source chapter6/cleanup.sh +source chapter6/backup.sh chmod ugo+x preparechroot.sh chmod ugo+x insidechroot.sh -printf "%b" "${CYN}PREPARING CHROOT ENVIRONMENT...${RST}\n" +printf "%b" "${CYN}PREPARING ${RED}CHROOT${RST} ENVIRONMENT...${RST}\n" sudo ./preparechroot.sh "${LFS}" -printf "%b" "${CYN}ENTERING CHROOT ENVIRONMENT...${RST}\n" +printf "%b" "${CYN}ENTERING ${RED}CHROOT${RST} ENVIRONMENT...${RST}\n" sleep 3 sudo chroot "${LFS}" /usr/bin/env \ @@ -116,4 +116,35 @@ sudo chroot "${LFS}" /usr/bin/env \ PATH=/bin:/usr/bin:/sbin:/usr/sbin \ NUMPROCS="${NUMPROCS}" \ MAKEFLAGS="${MAKEFLAGS}" \ - /bin/bash --login +h -c "/sources/insidechroot.sh" + /bin/bash --login +h -c "/sources/insidechroot.sh 7" +retval=$? + +printf "%b" "${CYN}EXITED ${RED}CHROOT${RST} ENVIRONMENT...${RST}\n" +# Cleanup and Backup if chapter 7 successfully finished +if [ "$retval" -eq 7 ]; then + printf "%b" "${GRN}Unmounting Virtual Kernel Filesystems...\n" + sudo umount "${LFS}"/dev/pts + sudo umount "${LFS}"/dev/ + sudo umount "${LFS}"/run + sudo umount "${LFS}"/sys + sudo umount "${LFS}"/proc + + printf "%b" "${GRN}Cleaning and backing up before starting Chapter 8.\n" + source "${LFS}"/sources/chapter7/cleanup.sh + source "${LFS}"/sources/chapter7/backup.sh +else + exit "$retval" +fi + +source mountvirtfs.sh + +sudo chroot "${LFS}" /usr/bin/env \ + HOME=/root \ + TERM="${TERM}" \ + PS1='(lfs chroot) \u:\w\$ ' \ + PATH=/bin:/usr/bin:/sbin:/usr/sbin \ + NUMPROCS="${NUMPROCS}" \ + MAKEFLAGS="${MAKEFLAGS}" \ + /bin/bash --login +h -c "/sources/insidechroot.sh 8" + +printf "%b" "${CYN}EXITED ${RED}CHROOT${RST} ENVIRONMENT...${RST}\n" -- cgit v1.2.3-54-g00ecf From a77136fab286d5c6f44132c310e223ebbcee8540 Mon Sep 17 00:00:00 2001 From: William Harrington Date: Wed, 24 Mar 2021 11:26:06 -0500 Subject: Add some comments. --- lfs.sh | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lfs.sh') diff --git a/lfs.sh b/lfs.sh index 84da9b6..991e7fe 100755 --- a/lfs.sh +++ b/lfs.sh @@ -136,8 +136,10 @@ else exit "$retval" fi +# Mount virtual kernel filesystems after cleanup and backup source mountvirtfs.sh +# Enter CHROOT for chapter 8, 9 and 10 sudo chroot "${LFS}" /usr/bin/env \ HOME=/root \ TERM="${TERM}" \ -- cgit v1.2.3-54-g00ecf From 3129e0fd3f2928862974902fb06e7258ec122b5e Mon Sep 17 00:00:00 2001 From: William Harrington Date: Wed, 24 Mar 2021 13:02:10 -0500 Subject: Make Building message when first starting the build to have the target LFS location and target disk/partition as high intensity white. --- lfs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lfs.sh') diff --git a/lfs.sh b/lfs.sh index 991e7fe..145faeb 100755 --- a/lfs.sh +++ b/lfs.sh @@ -18,7 +18,7 @@ source spinner.sh #source versioncheck.sh printf "%b" "\n\n\n${CYN}BUILDING ${YLW}${LFS_VER} $(uname -m)${CYN} at \ -${PRP}${LFS}${CYN} on ${PRP}${LFS_DISK}${LFS_PART}${RST}\n\n\n" +${IWHT}${LFS}${CYN} on ${IWHT}${LFS_DISK}${LFS_PART}${RST}\n\n\n" # Continue or Abort printf "%b" "${IGRN}CONTINUE ${IWHTB}(C)${RST} / ${IRED}ABORT ${IWHTB}(OTHER)${RST}\n" -- cgit v1.2.3-54-g00ecf From 41f7b9370db6752b86a8e3cc9c09aa1efc17c83d Mon Sep 17 00:00:00 2001 From: William Harrington Date: Fri, 26 Mar 2021 15:11:45 -0500 Subject: Source functions. --- lfs.sh | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lfs.sh') diff --git a/lfs.sh b/lfs.sh index 145faeb..dc0fd0f 100755 --- a/lfs.sh +++ b/lfs.sh @@ -14,6 +14,10 @@ printf "%b" "Sourcing spinner...\n" # Spinner function (returns an exit value) source spinner.sh +printf "%b" "Sourcing functions...\n" +# Functions used during build +source functions.sh + # Version check script #source versioncheck.sh -- cgit v1.2.3-54-g00ecf From d2c936f4e18395f30b07fe61a5608620cf82a7d8 Mon Sep 17 00:00:00 2001 From: William Harrington Date: Fri, 26 Mar 2021 15:57:40 -0500 Subject: Remove spinner source since moved to functions. --- lfs.sh | 4 ---- 1 file changed, 4 deletions(-) (limited to 'lfs.sh') diff --git a/lfs.sh b/lfs.sh index dc0fd0f..d1b23a5 100755 --- a/lfs.sh +++ b/lfs.sh @@ -10,10 +10,6 @@ printf "%b" "Sourcing environment variables...\n" # LFS build environment settings source env.sh -printf "%b" "Sourcing spinner...\n" -# Spinner function (returns an exit value) -source spinner.sh - printf "%b" "Sourcing functions...\n" # Functions used during build source functions.sh -- cgit v1.2.3-54-g00ecf From 24ae50590b533a53cbc254854ec7159c5e02c804 Mon Sep 17 00:00:00 2001 From: William Harrington Date: Mon, 29 Mar 2021 20:43:11 -0500 Subject: Add TESTUSERID when chrooting and use 'id -u' commnd to get user id. Use when adding tester user to passwd. --- insidechroot.sh | 3 +-- lfs.sh | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'lfs.sh') diff --git a/insidechroot.sh b/insidechroot.sh index 88a5d26..57951ab 100644 --- a/insidechroot.sh +++ b/insidechroot.sh @@ -131,7 +131,7 @@ nogroup:x:99: users:x:999: EOF - echo "tester:x:$(ls -n "$(tty)" | cut -d" " -f3):101::/home/tester:/bin/bash" >> /etc/passwd + echo "tester:x:${TESTERUID}:101::/home/tester:/bin/bash" >> /etc/passwd echo "tester:x:101:" >> /etc/group install -o tester -d /home/tester @@ -162,4 +162,3 @@ EOF else printf "%b" "Do Chapter 8, 9 and 10 stuff here.\n" fi - diff --git a/lfs.sh b/lfs.sh index d1b23a5..fedf71a 100755 --- a/lfs.sh +++ b/lfs.sh @@ -116,6 +116,7 @@ sudo chroot "${LFS}" /usr/bin/env \ PATH=/bin:/usr/bin:/sbin:/usr/sbin \ NUMPROCS="${NUMPROCS}" \ MAKEFLAGS="${MAKEFLAGS}" \ + TESTERUID="$(id -u)" \ /bin/bash --login +h -c "/sources/insidechroot.sh 7" retval=$? @@ -147,6 +148,7 @@ sudo chroot "${LFS}" /usr/bin/env \ PATH=/bin:/usr/bin:/sbin:/usr/sbin \ NUMPROCS="${NUMPROCS}" \ MAKEFLAGS="${MAKEFLAGS}" \ + TESTERUID="$(id -u)" \ /bin/bash --login +h -c "/sources/insidechroot.sh 8" printf "%b" "${CYN}EXITED ${RED}CHROOT${RST} ENVIRONMENT...${RST}\n" -- cgit v1.2.3-54-g00ecf From 2fdc594c54a592070de1336d8b9a8e8eb97e974b Mon Sep 17 00:00:00 2001 From: William Harrington Date: Thu, 1 Apr 2021 13:00:40 -0500 Subject: Add warning message about potential loss of data when not manually setting up the LFS partition, filesystem and mounting. --- lfs.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lfs.sh') diff --git a/lfs.sh b/lfs.sh index fedf71a..a22704c 100755 --- a/lfs.sh +++ b/lfs.sh @@ -18,7 +18,15 @@ source functions.sh #source versioncheck.sh printf "%b" "\n\n\n${CYN}BUILDING ${YLW}${LFS_VER} $(uname -m)${CYN} at \ -${IWHT}${LFS}${CYN} on ${IWHT}${LFS_DISK}${LFS_PART}${RST}\n\n\n" +${IWHT}${LFS}${CYN} on ${IWHT}${LFS_DISK}${LFS_PART}${RST}\n\n" + +printf "%b" "${IRED}*** ${IREDB}WARNING${RST} \ +${IWHT}POTENTIAL DATA LOSS \ +${IREDB}WARNING ${RST}${IRED}***${GRN}\n${RST}" + +printf "%b" "${GRN}Automatic creation of partition(s), filesystem(s) \n\ +and mounting will occur unless manually performed\n\ +before continuing.${RST}\n\n\n" # Continue or Abort printf "%b" "${IGRN}CONTINUE ${IWHTB}(C)${RST} / ${IRED}ABORT ${IWHTB}(OTHER)${RST}\n" -- cgit v1.2.3-54-g00ecf From fd6537d1bf69e3b73eb3e7cec0be7811e4a72539 Mon Sep 17 00:00:00 2001 From: William Harrington Date: Thu, 1 Apr 2021 13:43:18 -0500 Subject: Add message when copying requierd files for build to LFS sources target directory. --- lfs.sh | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lfs.sh') diff --git a/lfs.sh b/lfs.sh index a22704c..ad58449 100755 --- a/lfs.sh +++ b/lfs.sh @@ -79,6 +79,9 @@ esac #printf "%b" "${LFS_PWD}\n${LFS_PWD}\n" | sudo passwd lfs # Copy scripts and csv files to LFS sources target +printf "%b" "${GRN}Copying required files to ${YLW}${LFS}/sources \ +${GRN}target directory.${RST}\n" + cp -rf ./*.sh chapter* ./*.csv "${LFS}/sources" cd "${LFS}/sources" || exit 1 -- cgit v1.2.3-54-g00ecf From 5b6db0dde8b8fbbd638c76088ecd35c83492f95b Mon Sep 17 00:00:00 2001 From: William Harrington Date: Thu, 1 Apr 2021 14:02:43 -0500 Subject: Add empty line. --- lfs.sh | 1 + 1 file changed, 1 insertion(+) (limited to 'lfs.sh') diff --git a/lfs.sh b/lfs.sh index 5c8cbb9..555221d 100755 --- a/lfs.sh +++ b/lfs.sh @@ -124,6 +124,7 @@ chmod ugo+x insidechroot.sh printf "%b" "${CYN}PREPARING ${RED}CHROOT${CYN} ENVIRONMENT...${RST}\n" sudo ./preparechroot.sh "${LFS}" + printf "%b" "${CYN}ENTERING ${RED}CHROOT${CYN} ENVIRONMENT...${RST}\n" sleep 3 -- cgit v1.2.3-54-g00ecf From b5a6b72fc21d9f54b626cc8be5536b179125efd4 Mon Sep 17 00:00:00 2001 From: William Harrington Date: Thu, 1 Apr 2021 15:39:20 -0500 Subject: Add SPINNER to chroot variables for spinnertype to be used. --- lfs.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'lfs.sh') diff --git a/lfs.sh b/lfs.sh index 0dea3a0..e31460a 100755 --- a/lfs.sh +++ b/lfs.sh @@ -125,10 +125,10 @@ source chapter6/backup.sh chmod ugo+x preparechroot.sh chmod ugo+x insidechroot.sh -printf "%b" "${CYN}PREPARING ${RED}CHROOT${CYN} ENVIRONMENT...${RST}\n" +printf "%b" "\n${CYN}PREPARING ${RED}CHROOT${CYN} ENVIRONMENT...${RST}\n" sudo ./preparechroot.sh "${LFS}" -printf "%b" "${CYN}ENTERING ${RED}CHROOT${CYN} ENVIRONMENT...${RST}\n" +printf "%b" "\n${CYN}ENTERING ${RED}CHROOT${CYN} ENVIRONMENT...${RST}\n" sleep 3 sudo chroot "${LFS}" /usr/bin/env \ @@ -138,11 +138,12 @@ sudo chroot "${LFS}" /usr/bin/env \ PATH=/bin:/usr/bin:/sbin:/usr/sbin \ NUMPROCS="${NUMPROCS}" \ MAKEFLAGS="${MAKEFLAGS}" \ + SPINNER="${SPINNER}" \ TESTERUID="$(id -u)" \ /bin/bash --login +h -c "/sources/insidechroot.sh 7" retval=$? -printf "%b" "${CYN}EXITED ${RED}CHROOT${RST} ENVIRONMENT...${RST}\n" +printf "%b" "\n${CYN}EXITED ${RED}CHROOT${RST} ENVIRONMENT...${RST}\n" # Cleanup and Backup if chapter 7 successfully finished if [ "$retval" -eq 7 ]; then printf "%b" "${GRN}Unmounting Virtual Kernel Filesystems...\n" @@ -162,6 +163,9 @@ fi # Mount virtual kernel filesystems after cleanup and backup source mountvirtfs.sh +printf "%b" "\n${CYN}ENTERING ${RED}CHROOT${CYN} ENVIRONMENT...${RST}\n" +sleep 3 + # Enter CHROOT for chapter 8, 9 and 10 sudo chroot "${LFS}" /usr/bin/env \ HOME=/root \ @@ -170,7 +174,8 @@ sudo chroot "${LFS}" /usr/bin/env \ PATH=/bin:/usr/bin:/sbin:/usr/sbin \ NUMPROCS="${NUMPROCS}" \ MAKEFLAGS="${MAKEFLAGS}" \ + SPINNER="${SPINNER}" \ TESTERUID="$(id -u)" \ /bin/bash --login +h -c "/sources/insidechroot.sh 8" -printf "%b" "${CYN}EXITED ${RED}CHROOT${RST} ENVIRONMENT...${RST}\n" +printf "%b" "\n${CYN}EXITED ${RED}CHROOT${RST} ENVIRONMENT...${RST}\n" -- cgit v1.2.3-54-g00ecf From 9dbc17f3dcaf1191c49a557c7dbb60ededbf4d5b Mon Sep 17 00:00:00 2001 From: William Harrington Date: Thu, 1 Apr 2021 15:49:05 -0500 Subject: Use CYN at end of last CHROOT exit message. --- lfs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lfs.sh') diff --git a/lfs.sh b/lfs.sh index e31460a..aaa27af 100755 --- a/lfs.sh +++ b/lfs.sh @@ -178,4 +178,4 @@ sudo chroot "${LFS}" /usr/bin/env \ TESTERUID="$(id -u)" \ /bin/bash --login +h -c "/sources/insidechroot.sh 8" -printf "%b" "\n${CYN}EXITED ${RED}CHROOT${RST} ENVIRONMENT...${RST}\n" +printf "%b" "\n${CYN}EXITED ${RED}CHROOT${CYN} ENVIRONMENT...${RST}\n" -- cgit v1.2.3-54-g00ecf From 35d43dceb238ecd5a61c3fdc9035844e8146c940 Mon Sep 17 00:00:00 2001 From: William Harrington Date: Thu, 1 Apr 2021 16:34:38 -0500 Subject: Use intense colors for backup found message and indent. Change cleanup and backup message for chapter 7 in lfs.sh. --- chapter7/backup.sh | 2 +- lfs.sh | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'lfs.sh') diff --git a/chapter7/backup.sh b/chapter7/backup.sh index 4bdb206..8b0944d 100644 --- a/chapter7/backup.sh +++ b/chapter7/backup.sh @@ -4,7 +4,7 @@ file="${LFS_VER}-ch7-backup.tar.xz" directories=(bin dev etc lib lib64 proc run sbin sys tools usr var) if [ -f "${LFS}/sources/chapter7/backup" ]; then - echo -e "${YLW}Chapter 7 ${GRN}Backup found. Remove manually to backup again.${RST}" + echo -e " ${IYLW}Chapter 7 ${IGRN}Backup found. Remove manually to backup again.${RST}" else echo -ne "${GRN}Backing up ${YLW}${LFS}${GRN} to ${YLW}${file}${RST}... " diff --git a/lfs.sh b/lfs.sh index aaa27af..64ca920 100755 --- a/lfs.sh +++ b/lfs.sh @@ -118,6 +118,7 @@ for package in m4 ncurses bash coreutils diffutils file findutils gawk grep gzip fi done +printf "%b" "\n${YLW}Chapter 6 ${GRN}cleanup and backup${RST}\n" source chapter6/cleanup.sh source chapter6/backup.sh @@ -153,7 +154,7 @@ if [ "$retval" -eq 7 ]; then sudo umount "${LFS}"/sys sudo umount "${LFS}"/proc - printf "%b" "${GRN}Cleaning and backing up before starting Chapter 8.\n" + printf "%b" "\n${YLW}Chapter 7 ${GRN}cleanup and backup${RST}\n" source "${LFS}"/sources/chapter7/cleanup.sh source "${LFS}"/sources/chapter7/backup.sh else -- cgit v1.2.3-54-g00ecf From 215711600f348efb37b13163b838ee06c6071ca9 Mon Sep 17 00:00:00 2001 From: William Harrington Date: Fri, 2 Apr 2021 11:34:56 -0500 Subject: Use [[ ]] instead of [ ] --- lfs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lfs.sh') diff --git a/lfs.sh b/lfs.sh index 873426c..eced325 100755 --- a/lfs.sh +++ b/lfs.sh @@ -160,7 +160,7 @@ retval=$? printf "%b" "\n${CYN}EXITED ${RED}CHROOT${RST} ENVIRONMENT...${RST}\n" # Cleanup and Backup if chapter 7 successfully finished -if [ "$retval" -eq 7 ]; then +if [[ "$retval" -eq 7 ]]; then printf "%b" "${GRN}Unmounting Virtual Kernel Filesystems...\n" sudo umount "${LFS}"/dev/pts sudo umount "${LFS}"/dev/ -- cgit v1.2.3-54-g00ecf From d15a78517dfa18948aaf9ae91b19cdc2de5df998 Mon Sep 17 00:00:00 2001 From: William Harrington Date: Fri, 2 Apr 2021 13:36:51 -0500 Subject: Cleanup information messages for chapater 7 backup and cleanup and change from echo to printf. --- chapter7/backup.sh | 8 ++++---- chapter7/cleanup.sh | 6 +++--- lfs.sh | 3 ++- 3 files changed, 9 insertions(+), 8 deletions(-) (limited to 'lfs.sh') diff --git a/chapter7/backup.sh b/chapter7/backup.sh index 2aac08e..a6abb86 100644 --- a/chapter7/backup.sh +++ b/chapter7/backup.sh @@ -4,19 +4,19 @@ file="${LFS_VER}-ch7-backup.tar.xz" directories=(bin dev etc lib lib64 proc run sbin sys tools usr var) if [ -f "${LFS}/sources/chapter7/backup" ]; then - echo -e " ${IGRN}Backup found. Remove manually to backup again.${RST}" + printf "%b" " ${IGRN}Backup previously completed${RST}\n" else - echo -ne "${GRN}Backing up ${YLW}${LFS}${GRN} to ${YLW}${file}${RST}... " + printf "%b" "${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[@]}" >/dev/null 2>&1 & pid=$! spinner "$pid" "${SPINNER}" retval=$? if [ "${retval}" -ne 0 ]; then - echo -e "${IRED}FAILED!${RST}\n" + printf "%b" "${IRED}FAILED!${RST}\n" exit "${retval}" else - echo -e "${IGRN}OK${RST}\n" + printf "%b" "${IGRN}OK${RST}\n" fi popd > /dev/null || exit 1 diff --git a/chapter7/cleanup.sh b/chapter7/cleanup.sh index 60a934f..0a5ec86 100644 --- a/chapter7/cleanup.sh +++ b/chapter7/cleanup.sh @@ -1,10 +1,10 @@ #!/bin/bash if [ -f "${LFS}/sources/chapter7/cleanup" ]; then - echo -e " ${IGRN}Cleanup already performed.${RST}" + printf "%b" " ${IGRN}Cleanup already performed${RST}\n" else - echo -ne "${GRN}Cleaning up ${YLW}${LFS}${RST}... " + printf "%b" "${GRN}Cleaning up ${YLW}${LFS}${RST}... " sudo find "${LFS}"/usr/lib -name \*.la -delete >/dev/null 2>&1 sudo find "${LFS}"/usr/libexec -name \*.la -delete >/dev/null 2>&1 @@ -18,6 +18,6 @@ else sudo strip --strip-unneeded "${LFS}"/usr/sbin/* >/dev/null 2>&1 sudo strip --strip-unneeded "${LFS}"/tools/bin/* >/dev/null 2>&1 - echo -e "${IGRN}OK${RST}\n" + printf "%b" "${IGRN}OK${RST}\n" touch "${LFS}"/sources/chapter7/cleanup >/dev/null 2>&1 fi diff --git a/lfs.sh b/lfs.sh index bdd8659..55bdfb6 100755 --- a/lfs.sh +++ b/lfs.sh @@ -169,7 +169,8 @@ if [[ "$retval" -eq 7 ]]; then sudo umount "${LFS}"/sys sudo umount "${LFS}"/proc - printf "%b" "\n${YLW}Chapter 7 ${GRN}cleanup and backup${RST}\n" + printf "%b" "\n${IWHT}======= ${IYLW}Chapter 7 ${IGRN}Cleanup and Backup \ +${IWHT}=======${RST}\n" source "${LFS}"/sources/chapter7/cleanup.sh source "${LFS}"/sources/chapter7/backup.sh else -- cgit v1.2.3-54-g00ecf