#!/bin/bash set -o errexit source ../functions/main # Making sure that the LFS directory is accessible if [ ! -d ${LFS} ]; then echo "LFS destination directory not found." exit 1 fi # Testing for the presence of the lfs user # We cannot always automatically create the user 'lfs' because the installation # media can be a CD-ROM (read-only) If installing from some kind of live-CD, # simply install as root without the LFS user :) if ! grep -q "lfs" /etc/passwd; then groupadd -f lfs # The option '-k /dev/null' prevents possible copying of files from a # skeleton directory (default is /etc/skel). useradd -s /bin/bash -g lfs -m -k /dev/null lfs fi # Creating basic directories for subdir in etc tmp var tools cross-tools; do dir=${LFS}/${subdir} if [ ! -d ${dir} ]; then install -dv ${dir} fi done chown -R lfs:lfs ${LFS} cat > /home/lfs/.bashrc << "EOF" # Setting up the environment set +h umask 022 LC_ALL=POSIX PATH=_CLFS_CROSS_TOOLS_PATH_/bin:/bin:/usr/bin HVMAKE="make -j ${MAKEJOBS}" unset CFLAGS unset CXXFLAGS export LC_ALL PATH HVMAKE EOF sed -e "s@_CLFS_CROSS_TOOLS_PATH_@${CROSS_TOOLS_DIR}@" -i /home/lfs/.bashrc chown lfs:lfs /home/lfs/.bashrc exit $?