diff options
author | William Harrington <kb0iic@berzerkula.org> | 2021-04-02 10:42:44 -0500 |
---|---|---|
committer | William Harrington <kb0iic@berzerkula.org> | 2021-04-02 10:42:44 -0500 |
commit | f063af2cf37ddb9e542e8b085f350f79802e87e8 (patch) | |
tree | 4e48de891cdc623c5782263b7bf7c85fd6be0762 | |
parent | d9af1744baa9db3b6c9c7eb9df057b965aa6e3ed (diff) | |
parent | 6a4f0a701b1f4d72cdd46bfe506a2dd517bd4932 (diff) |
Merge branch 'cleanup' into chapter7
-rw-r--r-- | env.sh | 38 | ||||
-rwxr-xr-x | lfs.sh | 2 | ||||
-rw-r--r-- | setupdisk.sh | 14 |
3 files changed, 33 insertions, 21 deletions
@@ -6,39 +6,41 @@ PS1='\u:\w\$ ' set +h umask 022 -LFS=/mnt/lfs -LC_ALL=POSIX -LFS_TGT=$(uname -m)-lfs-linux-gnu +LFS="/mnt/lfs" +LC_ALL="POSIX" +LFS_TGT="$(uname -m)"-lfs-linux-gnu PATH=/usr/bin -if [ ! -L /bin ]; then PATH=/bin:${PATH}; fi -PATH=${LFS}/tools/bin:${PATH} -CONFIG_SITE=${LFS}/usr/share/config.site +if [ ! -L /bin ]; then PATH="/bin:${PATH}"; fi +PATH="${LFS}/tools/bin:${PATH}" +CONFIG_SITE="${LFS}/usr/share/config.site" # End book environment settings # LFS Version being built -LFS_VER=LFS_10_1 +LFS_VER="LFS_10_1" # Disk where LFS partition will exist / or exists -LFS_DISK=/dev/sdb +LFS_DISK="/dev/sdb" # Partition number where LFS will exist / or exists -LFS_PART=1 +LFS_PART="1" + +# Filesystem to use for LFS +LFS_FS="EXT4" # LFS User password (not used at this time) -LFS_PWD=lfs +LFS_PWD="lfs" # Get number of online processors -NUMPROCS=$(getconf _NPROCESSORS_ONLN) -numjobs=$((NUMPROCS * 2 - 1)) +NUMPROCS="$(getconf _NPROCESSORS_ONLN)" +numjobs="$((NUMPROCS * 2 - 1))" # Make flags for multiple jobs MAKEFLAGS="-j ${numjobs}" -unset numjobs +# Set spinner type (0-12 in funtions.sh) +SPINNER="0" export PS1 LC_ALL LFS LFS_TGT PATH CONFIG_SITE -export LFS_VER LFS_DISK LFS_PART LFS_PWD NUMPROCS MAKEFLAGS - - -# Set spinner type (0-12 in funtions.sh) -SPINNER=0 +export LFS_VER LFS_DISK LFS_FS LFS_PART LFS_PWD NUMPROCS MAKEFLAGS export SPINNER + +unset numjobs @@ -1,5 +1,7 @@ #!/bin/bash +set -u + clear printf "%b" "Sourcing colors...\n" diff --git a/setupdisk.sh b/setupdisk.sh index 569cb2d..6d13436 100644 --- a/setupdisk.sh +++ b/setupdisk.sh @@ -20,7 +20,15 @@ p w q EOF - +if [[ "$?" -ne 0 ]]; then + printf "%b" " ${IGRN}Creating partition ${IWHT}${LFS_DISK}${LFS_PART} \ +${IRED}FAILED!${RST}\n" + exit 1 +fi printf "%b" " ${IGRN}Formatting ${IWHT}${LFS_DISK}${LFS_PART} with \ -${YLW}EXT4${IGRN} filesystem and label ${IWHT}${LFS_VER}${RST}\n" -sudo /sbin/mkfs -t ext4 -L "${LFS_VER}" -F "${LFS_DISK}${LFS_PART}" >/dev/null 2>&1 +${IWHT}${LFS_FS}${IGRN} filesystem and label ${IWHT}${LFS_VER}${RST}\n" +if ! sudo /sbin/mkfs -t ${LFS_FS,,} -L "${LFS_VER}" -F "${LFS_DISK}${LFS_PART}" >/dev/null 2>&1; then + printf "%b" " ${IGRN}Creating ${IWHT}${LFS_FS}${IGRN} filesystem at \ +${IWHT}${LFS_DISK}${LFS_PART} ${IRED}FAILED!${RST}\n" + exit 1 +fi |