diff options
author | William Harrington <kb0iic@berzerkula.org> | 2021-04-02 11:33:59 -0500 |
---|---|---|
committer | William Harrington <kb0iic@berzerkula.org> | 2021-04-02 11:33:59 -0500 |
commit | 09a71c051060d3b934a19ae4d9c962f7ceb44c69 (patch) | |
tree | 12b46d0b4caf7a21d9a37dc8d0de6442c929fe33 /lfs.sh | |
parent | f063af2cf37ddb9e542e8b085f350f79802e87e8 (diff) | |
parent | e2547734fd91c35bf3eaac1d9486b0f3c2877192 (diff) |
Merge branch 'cleanup' into chapter7
Diffstat (limited to 'lfs.sh')
-rwxr-xr-x | lfs.sh | 28 |
1 files changed, 20 insertions, 8 deletions
@@ -33,7 +33,7 @@ before continuing.${RST}\n\n\n" # Continue or Abort printf "%b" "${IGRN}CONTINUE ${IWHTB}(C)${RST} / ${IRED}ABORT ${IWHTB}(OTHER)${RST}\n" if read -r -n 1 contabort; then - if [ "$contabort" == "C" ] || [ "$contabort" == "c" ]; then + if [[ "$contabort" == "C" ]] || [[ "$contabort" == "c" ]]; then printf "%b" "\b${IWHT}Build is ${IGRN}CONTINUING${RST}\n\n" else printf "%b" "\b${IWHT}Build ${IRED}ABORTED!\n\n" @@ -44,9 +44,16 @@ else exit 1 fi -printf "%b" "${GRN}Creating LFS directory at ${YLW}${LFS}${GRN} if it does not exist...${RST}\n" # Create LFS directory if it doesn't exist -[[ -d /mnt/lfs ]] || sudo mkdir "${LFS}" +printf "%b" "${GRN}Creating LFS directory at ${YLW}${LFS}${GRN}... ${RST}" +if [[ -d "${LFS}" ]]; then + printf "%b" "${IGRN}EXISTS${RST}\n" +else + if ! mkdir "${LFS}" >/dev/null 2>&1; then + printf "%b" "${IRED}FAILED!${RST}\n" + exit 1 + fi +fi # Setup partition, filesystem, format and mount if # LFS filesystem is not previously mounted @@ -84,9 +91,14 @@ esac # Copy scripts and csv files to LFS sources target printf "%b" "${GRN}Copying required files to ${YLW}${LFS}/sources \ -${GRN}target directory...${RST}\n" +${GRN}target directory... ${RST}" + +if ! cp -rf ./*.sh chapter* ./*.csv "${LFS}/sources"; then + printf "%b" "${IRED}FAILED!${RST}\n" +else + printf "%b" "${GRN}OK${RST}\n" +fi -cp -rf ./*.sh chapter* ./*.csv "${LFS}/sources" cd "${LFS}/sources" || exit 1 # Download packages and patches @@ -94,7 +106,7 @@ printf "%b" "\n${IWHT}============ ${IGRN}Downloading source files and patches \ ${IWHT}============${RST}\n" source download.sh retval=$? -if [ "$retval" -ne 0 ]; then +if [[ "$retval" -ne 0 ]]; then exit 1 fi @@ -104,7 +116,7 @@ printf "%b" "\n${IWHT}============ ${IGRN}Building ${IYLW}Chapter 5${IWHT} \ for package in binutils gcc linux-api-headers glibc libstdc++; do source packageinstall.sh 5 $package retval=$? - if [ "$retval" -ne 0 ]; then + if [[ "$retval" -ne 0 ]]; then exit 1 fi done @@ -115,7 +127,7 @@ printf "%b" "\n${IWHT}============ ${IGRN}Building ${IYLW}Chapter 6${IWHT} \ for package in m4 ncurses bash coreutils diffutils file findutils gawk grep gzip make patch sed tar xz binutils gcc; do source packageinstall.sh 6 $package retval=$? - if [ "$retval" -ne 0 ]; then + if [[ "$retval" -ne 0 ]]; then exit 1 fi done |