#!/bin/sh # Reading system configuration informations, functions and package versions. source ../sysinfos source ../functions source ../packages-list export LFS_PKG_DIR="$(dirname $(pwd))/packages/stage1" export LFS_LOG_DIR=${LFS}/var/log/hvlinux-install/stage1 export LFS_LOG_FILE=${LFS_LOG_DIR}/install.log export LFS_TMP="${LFS}/tmp" # Making sure that this script was executed by the root user if [ "x${USER}" != "xroot" ]; then echo "You must be the superuser to install hvlinux." exit 1 fi # Making sure that the LFS partition is mounted if ! mount | awk '{ print "x" $3 "x" }' | grep "x${LFS}x" 1> /dev/null 2>&1; then echo "LFS partition is not mounted. Please mount it." exit 1 fi # Creating basic directories for subdir in tmp var boot tools; do dir=${LFS}/${subdir} if [ ! -d ${dir} ]; then install -dv ${dir} || exit 1 fi chown lfs:lfs ${dir} || exit 1 done # Creating a link from the host root directory to LFS tools directory ln -sf ${LFS}/tools / && # Testing for the presence of the lfs user # We cannot 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 "lfs" /etc/passwd 1> /dev/null 2>&1; then # The option '-k /dev/null' prevents possible copying of files from a # skeleton directory (default is /etc/skel). groupadd lfs && useradd -s /bin/bash -g lfs -m -k /dev/null lfs || exit 1 fi && cat > /home/lfs/.bashrc << "EOF" && # Setting up the environment set +h umask 022 CC="gcc -s" LC_ALL=POSIX PATH=/tools/bin:/bin:/usr/bin export CC LC_ALL PATH EOF chown lfs:lfs /home/lfs/.bashrc && # Logging-in as 'lfs' user, and executing the install-1 script. The # 'su -' command starts with a clean environment and enters the home # directory of the user. su - lfs -c "cd ${PWD}; ./install-1" if [ $? -ne 0 ]; then echo "*** An error occured during stage1" exit 1 fi exit 0