diff options
author | William Harrington <kb0iic@berzerkula.org> | 2021-03-23 13:13:26 -0500 |
---|---|---|
committer | William Harrington <kb0iic@berzerkula.org> | 2021-03-23 13:13:26 -0500 |
commit | c99e674d784dde5c3073dcfe8503adbfc9a0e2b7 (patch) | |
tree | 8812ca6a9f5d6d66818e0ae24e44543f69de5d89 /lfs.sh | |
parent | 5ba546134dbdb6b764644756268f7c187851b7c7 (diff) |
Cleanup lfs.sh
Diffstat (limited to 'lfs.sh')
-rwxr-xr-x | lfs.sh | 42 |
1 files changed, 21 insertions, 21 deletions
@@ -22,8 +22,7 @@ ${PRP}${LFS}${CYN} on ${PRP}${LFS_DISK}${LFS_PART}${RST}\n\n\n" # Continue or Abort echo -e "${IGRN}CONTINUE ${IWHTB}(C)${RST} / ${IRED}ABORT ${IWHTB}(OTHER)${RST}" -read -n 1 contabort -if [ $? == 0 ]; then +if read -r -n 1 contabort; then if [ "$contabort" == "C" ] || [ "$contabort" == "c" ]; then echo -e "\b${IWHT}Build is ${IGRN}CONTINUING${RST}" else @@ -37,31 +36,32 @@ fi echo -e "${GRN}Creating LFS directory at ${YLW}${LFS}${GRN} if it does not exist...${RST}" # Create LFS directory if it doesn't exist -[[ -d /mnt/lfs ]] || sudo mkdir ${LFS} +[[ -d /mnt/lfs ]] || sudo mkdir "${LFS}" -echo -e "${GRN}Setting up partition on ${YLW}${LFS_DISK} ${GRN}\ -with ${YLW}ext4${GRN} filesystem at ${YLW}${LFS_DISK}${LFS_ROOT} ${GRN}\ -and mounting at ${YLW}${LFS}${RST}..." # Setup partition, filesystem, format and mount if # LFS filesystem is not previously mounted if ! grep -q "${LFS}" /proc/mounts; then + echo -e "${GRN}Setting up partition on ${YLW}${LFS_DISK} ${GRN}\ +with ${YLW}ext4${GRN} filesystem at ${YLW}${LFS_DISK}${LFS_ROOT} ${GRN}\ +and mounting at ${YLW}${LFS}${RST}..." + source setupdisk.sh "${LFS_DISK}" "${LFS_PART}" sudo mount "${LFS_DISK}${LFS_PART}" "${LFS}" - sudo chown -v ${USER} "${LFS}" + sudo chown -v "${USER}" "${LFS}" fi # Create limited directory layout -mkdir -p ${LFS}/sources -mkdir -p ${LFS}/tools -mkdir -p ${LFS}/bin -mkdir -p ${LFS}/etc -mkdir -p ${LFS}/lib -mkdir -p ${LFS}/sbin -mkdir -p ${LFS}/usr -mkdir -p ${LFS}/var +mkdir -p "${LFS}"/sources +mkdir -p "${LFS}"/tools +mkdir -p "${LFS}"/bin +mkdir -p "${LFS}"/etc +mkdir -p "${LFS}"/lib +mkdir -p "${LFS}"/sbin +mkdir -p "${LFS}"/usr +mkdir -p "${LFS}"/var case $(uname -m) in - x86_64) mkdir -p ${LFS}/lib64 ;; + x86_64) mkdir -p "${LFS}"/lib64 ;; esac # Will use normal user and not special lfs user @@ -71,8 +71,8 @@ esac #echo -e "${LFS_PWD}\n${LFS_PWD}\n" | sudo passwd lfs # Copy scripts and csv files to LFS sources target -cp -rf *.sh chapter* *.csv "${LFS}/sources" -cd "${LFS}/sources" +cp -rf ./*.sh chapter* ./*.csv "${LFS}/sources" +cd "${LFS}/sources" || exit 1 # Download packages and patches source download.sh @@ -105,15 +105,15 @@ done chmod ugo+x preparechroot.sh chmod ugo+x insidechroot.sh echo -e "${CYN}PREPARING CHROOT ENVIRONMENT...${RST}" -sudo ./preparechroot.sh ${LFS} +sudo ./preparechroot.sh "${LFS}" echo -e "${CYN}ENTERING CHROOT ENVIRONMENT...${RST}" sleep 3 sudo chroot "${LFS}" /usr/bin/env \ HOME=/root \ - TERM=${TERM} \ + TERM="${TERM}" \ PS1='(lfs chroot) \u:\w\$ ' \ PATH=/bin:/usr/bin:/sbin:/usr/sbin \ - NUMPROCS=${NUMPROCS} \ + NUMPROCS="${NUMPROCS}" \ MAKEFLAGS="${MAKEFLAGS}" \ /bin/bash --login +h -c "/sources/insidechroot.sh" |