X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;f=stage1%2Fstage1-install;h=dd89a72877473ceaa35769958ea6261f711df7aa;hb=3605ab38ca7604b1fe43c3bce5e4963730a85d39;hp=d3eb6a73a5053f2989992977f4b28811027caedd;hpb=16cc35ba4890382ee9368a176e4f5a7fa773b7a6;p=hvlinux.git diff --git a/stage1/stage1-install b/stage1/stage1-install index d3eb6a7..dd89a72 100755 --- a/stage1/stage1-install +++ b/stage1/stage1-install @@ -1,70 +1,41 @@ -#!/bin/sh +#!/bin/bash + +LFS_STAGE=stage1 + +# Let shell functions inherit ERR trap. Same as `set -E'. +set -o errtrace + +# Setting ERR trap does implicit `set -o errexit'. +trap myerr ERR + +function myerr() +{ + echo + echo "*** An error occured during ${LFS_STAGE}" + exit 1 +} # Reading system configuration informations, functions and package versions. source ../sysinfos source ../functions source ../packages-list -export LFS_PKG_DIR="$(dirname $(dirname $(pwd)))/packages/stage1" -export LFS_LOG_DIR=${LFS}/var/log/hvlinux-install/stage1 +export LFS_PKG_DIR="$(dirname $(pwd))/packages/${LFS_STAGE}" +export LFS_LOG_DIR=${LFS}/var/log/hvlinux-install/${LFS_STAGE} 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 - chmod 777 ${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 && +init_log_file -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 && +rscr mult "Performing pre-install" pre-install # 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 +rscr mult "Performing post-install" post-install + +echo "Total build time: $(get_total_build_time ${LFS_LOG_FILE})h" exit 0