X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;f=stage0%2Fcis-pre-install;h=5183a23de045bde50f84e8fe2fa30990e53cb122;hb=eb29a384d8d1bcb7efdb7ce9d41666f1bbe02d46;hp=f52fc9b438583a83ffbf84e06e75e624c8c160e4;hpb=f9cf3632a64429991fa5e6f556b0c4017e0e9435;p=hvlinux.git diff --git a/stage0/cis-pre-install b/stage0/cis-pre-install index f52fc9b..5183a23 100755 --- a/stage0/cis-pre-install +++ b/stage0/cis-pre-install @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit # Reading system configuration informations, functions and package versions. @@ -18,8 +18,20 @@ if [ ! -d ${LFS} ]; then 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 "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 +fi + # Creating basic directories -for subdir in tmp var boot tools cross-tools; do +for subdir in tmp var tools cross-tools; do dir=${LFS}/${subdir} if [ ! -d ${dir} ]; then install -dv ${dir} @@ -33,38 +45,20 @@ for subdir in tools cross-tools; do ln -sfvT ${LFS}/${subdir} /${subdir} done -# 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 -fi - cat > /home/lfs/.bashrc << "EOF" # Setting up the environment set +h umask 022 LC_ALL=POSIX PATH=/cross-tools/bin:/bin:/usr/bin -CLFS_BUILDFLAGS=_CLFS_BUILDFLAGS_ -CLFS_HOST="$(echo $MACHTYPE | \ - sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")" -CLFS_TARGET=_CLFS_TARGET_ HVMAKE="make -j ${MAKEJOBS}" unset CFLAGS unset CXXFLAGS -export LC_ALL PATH CLFS_BUILDFLAGS CLFS_HOST CLFS_TARGET HVMAKE +export LC_ALL PATH HVMAKE EOF -sed -i -e "s!_CLFS_BUILDFLAGS_!${CLFS_BUILDFLAGS}!g" /home/lfs/.bashrc -sed -i -e "s!_CLFS_TARGET_!${CLFS_TARGET}!g" /home/lfs/.bashrc - chown lfs:lfs /home/lfs/.bashrc exit $?