diff --git a/CLFS/master.sh b/CLFS/master.sh index 8d535ef..4e5a258 100755 --- a/CLFS/master.sh +++ b/CLFS/master.sh @@ -1016,7 +1016,7 @@ EOF if [[ "${METHOD}" = "chroot" ]]; then ( cat << EOF -all: chapter2 chapter3 chapter4 chapter5 chapter6 chapter7 chapter8 +all: chapter2 chapter3 chapter4 chapter5 chapter6 chapter7 chapter8 do-housekeeping @\$(call echo_finished,$VERSION) chapter2: 023-creatingtoolsdir 024-creatingcrossdir 025-addinguser 026-settingenvironment @@ -1077,6 +1077,17 @@ restore-lfs-env: @chown lfs:lfs /home/lfs/.bash* && \\ touch \$@ +do-housekeeping: + -umount \$(MOUNT_PT)/dev/pts + -umount \$(MOUNT_PT)/dev/shm + -umount \$(MOUNT_PT)/dev + -umount \$(MOUNT_PT)/sys + -umount \$(MOUNT_PT)/proc + -if [ ! -f user-lfs-exist ]; then \\ + userdel lfs; \\ + rm -rf /home/lfs; \\ + fi; + EOF ) >> $MKFILE fi @@ -1146,6 +1157,7 @@ restore-lfs-env: @chown lfs:lfs /home/lfs/.bash* && \\ touch \$@ + EOF ) >> $MKFILE fi diff --git a/HLFS/master.sh b/HLFS/master.sh index 0b935ad..55021fb 100755 --- a/HLFS/master.sh +++ b/HLFS/master.sh @@ -505,7 +505,7 @@ EOF # as a dependency. ( cat << EOF -all: chapter3 chapter5 chapter6 chapter7 +all: chapter3 chapter5 chapter6 chapter7 do-housekeeping @\$(call echo_finished,$VERSION) chapter3: 020-creatingtoolsdir 021-addinguser 022-settingenvironment @@ -561,6 +561,17 @@ restore-lfs-env: @chown lfs:lfs /home/lfs/.bash* && \\ touch \$@ +do-housekeeping: + -umount \$(MOUNT_PT)/dev/pts + -umount \$(MOUNT_PT)/dev/shm + -umount \$(MOUNT_PT)/dev + -umount \$(MOUNT_PT)/sys + -umount \$(MOUNT_PT)/proc + -if [ ! -f user-lfs-exist ]; then \\ + userdel lfs; \\ + rm -rf /home/lfs; \\ + fi; + EOF ) >> $MKFILE diff --git a/LFS/master.sh b/LFS/master.sh index b0a88a7..f41c0fc 100755 --- a/LFS/master.sh +++ b/LFS/master.sh @@ -47,7 +47,7 @@ chapter4_Makefiles() { fi; @echo "set +h" > /home/lfs/.bashrc && \\ echo "umask 022" >> /home/lfs/.bashrc && \\ - echo "LFS=/mnt/lfs" >> /home/lfs/.bashrc && \\ + echo "LFS=\$(MOUNT_PT)" >> /home/lfs/.bashrc && \\ echo "LC_ALL=POSIX" >> /home/lfs/.bashrc && \\ echo "PATH=/tools/bin:/bin:/usr/bin" >> /home/lfs/.bashrc && \\ echo "export LFS LC_ALL PATH" >> /home/lfs/.bashrc && \\ @@ -376,7 +376,7 @@ EOF # as a dependency. ( cat << EOF -all: chapter4 chapter5 chapter6 chapter789 +all: chapter4 chapter5 chapter6 chapter789 do_housekeeping @\$(call echo_finished,$VERSION) chapter4: 020-creatingtoolsdir 021-addinguser 022-settingenvironment @@ -431,7 +431,18 @@ restore-lfs-env: fi; @chown lfs:lfs /home/lfs/.bash* && \\ touch \$@ - + +do_housekeeping: + -umount \$(MOUNT_PT)/sys + -umount \$(MOUNT_PT)/proc + -umount \$(MOUNT_PT)/dev/shm + -umount \$(MOUNT_PT)/dev/pts + -umount \$(MOUNT_PT)/dev + -if [ ! -f user-lfs-exist ]; then \\ + userdel lfs; \\ + rm -rf /home/lfs; \\ + fi; + EOF ) >> $MKFILE diff --git a/README b/README index 5e92b43..4cd93bb 100644 --- a/README +++ b/README @@ -16,7 +16,7 @@ $Id$ Lay in a supply of caffeine beverages. *. It is recommended that you temporarily unpack your linux kernel, - run , configure the kernal as per the book and save + run , configure the kernel as per the book and save the resulting .config file. This suggestion also applies to the configuration of the uClibc package when building a HLFS system using uClibc rather than glibc. @@ -94,10 +94,10 @@ $Id$ 6. FAQ:: - Q. "It doesn't work" + Q. "It doesn't work!" A. Yes it does, try ./lfs --help - Q. "How do I specify the build location" + Q. "How do I specify the build location?" A. The original LFS document worked against the well know location /mnt/lfs. This script automates the build of all of the LFS series of books and uses a generic location $BUILDDIR with a default value a /mnt/build_dir. @@ -113,7 +113,7 @@ $Id$ FHS dir structure ... - Q. "What is the function of the SRC_ARCHIVE variable + Q. "What is the function of the SRC_ARCHIVE variable?" A. When then symlinked master.sh runs it creates a local copy of the necessary packages in BUILDDIR/sources by downloading the files. If the variable SRC_ARCHIVE is defined the software will first look in @@ -121,13 +121,13 @@ $Id$ If the files are not found in SRC_ARCHIVE _and_ you have write priv to the directory any downloaded files will be mirrored there. - Q. "How do I set the SRC_ARCHIVE location" + Q. "How do I set the SRC_ARCHIVE location?" A. The best way to set the value of SRC_ARCHIVE is export SRC_ARCHIVE=/wherever/you/store/downloaded/packages OR you can change the setting in .common/config. - Q. "Why have 2 copies of the files." + Q. "Why have 2 copies of the files?" A. The package files must be visible during the chroot phase and this is a simple and reliable method of doing so. This method also handles the CLFS build method where the final build may be done on a separate machine. diff --git a/common/common-functions b/common/common-functions index 46d2e81..ef9a803 100644 --- a/common/common-functions +++ b/common/common-functions @@ -612,31 +612,12 @@ extract_commands() { # # Create the packages file. We need it for proper Makefile creation rm -f packages - case "${PROGNAME}" in - clfs) - echo -n "Creating <${PROGNAME}> specific packages file" - grep "\-version " $BOOK/packages.ent | sed -e 's@@"@' \ - -e '/generic/d' > packages - echo " ...OK" - ;; - - hlfs) - echo -n "Creating <${PROGNAME}> specific packages file" - grep "\-version" $BOOK/general.ent | sed -e 's@@"@' \ - -e '/generic/d' >> packages - echo " ...OK" - ;; - - lfs) - echo -n "Creating <${PROGNAME}> specific packages file" - grep "\-version" $BOOK/general.ent | sed -e 's@@"@' \ - -e '/generic/d' >> packages - echo " ...OK" - ;; - esac + if [[ "${PROGNAME}" != "blfs" ]] ; then + echo -n "Creating <${PROGNAME}> specific packages file" + grep "\-version " $BOOK/packages.ent | sed -e 's@@"@' > packages + echo " ...OK" + fi # Done. Moving on... get_sources @@ -659,13 +640,9 @@ get_sources() { # Download file, write name to MISSING_FILES.DMP if [[ ! -d $BUILDDIR/sources ]] && mkdir $BUILDDIR/sources cd $BUILDDIR/sources [[ -f MD5SUMS ]] && rm MD5SUMS - [[ -f MD5SUMS-$VERSION ]] && rm MD5SUMS-$VERSION [[ -f MISSING_FILES.DMP ]] && rm MISSING_FILES.DMP [[ -f urls.lst ]] && rm urls.lst - # Download a fresh MD5SUMS file - wget $SERVER/pub/lfs/conglomeration/MD5SUMS - # Generate URLs file create_urls @@ -681,6 +658,9 @@ get_sources() { # Download file, write name to MISSING_FILES.DMP if */vim-*-lang* ) [[ "$VIMLANG" = "0" ]] && continue ;; + *linux/linux-* ) + [[ -z "$CONFIG" ]] && [[ -z "$BOOT_CONFIG" ]] && continue + ;; esac # Locations @@ -689,21 +669,9 @@ get_sources() { # Download file, write name to MISSING_FILES.DMP if FILE=`basename $URL1` # File name BOOKMD5=`echo $line | cut -d" " -f3` # MD5 book value - if [[ x"$BOOKMD5" != "x" ]]; then - HAVEMD5=1 - MD5="$BOOKMD5 $FILE" - else - # Find the md5 sum for this package in the server MD5SUMS file. - set +e - HAVEMD5=1 # Always assume we have a MD5SUM - MD5=`grep " $FILE" MD5SUMS` - if [ $? -ne 0 ]; then - set -e - gs_wrt_message "$FILE not found in MD5SUMS" - # IMPORTANT:: There is no MD5SUM for this file. - HAVEMD5=0 - fi - fi + # Validation pair + MD5="$BOOKMD5 $FILE" + HAVEMD5=1 set -e # If the file exists in the archive copy it to the @@ -717,7 +685,7 @@ get_sources() { # Download file, write name to MISSING_FILES.DMP if else echo "${BOLD}${YELLOW}$FILE: not found in ${SRC_ARCHIVE}${OFF}" fromARCHIVE=0 - # If the file does not exist in /sources download a fresh one + # If the file does not exist yet in /sources download a fresh one if [ ! -f $FILE ] ; then if ! wget $URL1 && ! wget $URL2 ; then gs_wrt_message "$FILE not found in the SRC_ARCHIVE or on any server..SKIPPING" @@ -726,26 +694,23 @@ get_sources() { # Download file, write name to MISSING_FILES.DMP if fi fi - # Is there a MD5SUM to validate the file against. - if [[ "$HAVEMD5" = "1" ]] ; then - # IF the md5sum does not match the existing files - if ! echo "$MD5" | md5sum -c - >/dev/null ; then - [[ $fromARCHIVE = "1" ]] && echo "${BOLD}${YELLOW}MD5SUM did not match SRC_ARCHIVE copy${OFF}" - [[ $fromARCHIVE = "0" ]] && echo "${BOLD}${YELLOW}MD5SUM did not match REMOTE copy${OFF}" - # Remove the old file and download a new one - rm -fv $FILE - # Force generation of MD5SUM and storage in SRC_ARCHIVE - fromARCHIVE=0; - # Try and retrieve the file. Servers in reverse order. - if ! wget $URL2 && ! wget $URL1 ; then - gs_wrt_message "$FILE not found on the servers.. SKIPPING" - continue - fi + # IF the md5sum does not match the existing files + if ! echo "$MD5" | md5sum -c - >/dev/null ; then + [[ $fromARCHIVE = "1" ]] && echo "${BOLD}${YELLOW}MD5SUM did not match SRC_ARCHIVE copy${OFF}" + [[ $fromARCHIVE = "0" ]] && echo "${BOLD}${YELLOW}MD5SUM did not match REMOTE copy${OFF}" + # Remove the old file and download a new one + rm -fv $FILE + # Force storage in SRC_ARCHIVE + fromARCHIVE=0; + # Try to retrieve again the file. Servers in reverse order. + if ! wget $URL2 && ! wget $URL1 ; then + gs_wrt_message "$FILE not found on the servers.. SKIPPING" + continue fi fi # Validate the MD5SUM one last time - if [[ "$HAVEMD5" = "1" ]] && ! echo "$MD5" | md5sum -c - >/dev/null ; then + if ! echo "$MD5" | md5sum -c - >/dev/null ; then gs_wrt_message "$FILE does not match MD5SUMS value" # Force generation of MD5SUM HAVEMD5=0 @@ -754,11 +719,11 @@ get_sources() { # Download file, write name to MISSING_FILES.DMP if # Generate a fresh MD5SUM for this file if [[ "$HAVEMD5" = "0" ]] ; then echo "${BOLD}${YELLOW}Generating a new MD5SUM for ${OFF}$FILE" - echo "NEW MD5SUM $(md5sum $FILE)" >> MISSING_FILES.DMP + echo "NEW MD5SUM: $(md5sum $FILE)" >> MISSING_FILES.DMP fi # Good or bad we write the original md5sum to a file - echo "$MD5" >> MD5SUMS-$VERSION + echo "$MD5" >> MD5SUMS # Copy the freshly downloaded file # to the source archive. diff --git a/common/config b/common/config index 48a35df..f5d0b9c 100644 --- a/common/config +++ b/common/config @@ -60,7 +60,7 @@ STRIP=1 PAGE=letter #--- set default timezone. -TIMEZONE=GMT +TIMEZONE=${TZ:-GMT} #--- install the optional vim-lang package 0(no)/1(yes) VIMLANG=1 diff --git a/common/func_validate_configs.sh b/common/func_validate_configs.sh index baeeca6..793a8ef 100644 --- a/common/func_validate_configs.sh +++ b/common/func_validate_configs.sh @@ -169,11 +169,6 @@ inline_doc for config_param in ${!PARAM_GROUP}; do # This is a tricky little piece of code.. executes a cmd string. case $config_param in - BUILDDIR) # We cannot have an or root mount point - echo -e "`eval echo $PARAM_VALS`" - [[ "xx x/x" =~ "x${!config_param}x" ]] && - write_error_and_die - ;; TIMEZONE) echo -e "`eval echo $PARAM_VALS`" ;; # Validate general parameters.. @@ -227,6 +222,11 @@ inline_doc # fatal -z -d -w, # warning -z+ -w+ SRC_ARCHIVE) validate_dir -z+ -d -w+ ;; + BUILDDIR) # The build directory/partition MUST exist and be writable by the user + validate_dir -z -d -w + [[ "xx x/x" =~ "x${!config_param}x" ]] && + write_error_and_die + ;; # Validate files, testable states: # fatal -z -e -s -w -x -r, diff --git a/common/urls.xsl b/common/urls.xsl index eea8f73..e713090 100644 --- a/common/urls.xsl +++ b/common/urls.xsl @@ -54,18 +54,25 @@ /pub/lfs/conglomeration/ - + bash/ + + dvhtool/ + gcc/ glibc/ - + + powerpc-utils/ + + tcl/ diff --git a/master.sh b/master.sh index 1f70b28..fd8da3a 100755 --- a/master.sh +++ b/master.sh @@ -446,7 +446,6 @@ echo "${SD_BORDER}${nl_}" validate_config echo "${SD_BORDER}${nl_}" - echo -n "Are you happy with these settings? yes/no (no): " read ANSWER if [ x$ANSWER != "xyes" ] ; then @@ -455,7 +454,7 @@ if [ x$ANSWER != "xyes" ] ; then fi echo "${nl_}${SD_BORDER}${nl_}" -# Loadd additional modules or configuration files based on global settings +# Load additional modules or configuration files based on global settings # compare module if [[ "$COMPARE" = "1" ]]; then [[ $VERBOSITY > 0 ]] && echo -n "Loading compare module..." @@ -470,30 +469,19 @@ if [[ "$OPTIMIZE" != "0" ]]; then source optimize/optimize_functions [[ $? > 0 ]] && echo " optimize/optimize_functions did not load.." && exit [[ $VERBOSITY > 0 ]] && echo "OK" -fi -# -# optimize configurations -if [[ "$OPTIMIZE" != "0" ]]; then + # + # optimize configurations [[ $VERBOSITY > 0 ]] && echo -n "Loading optimization config..." source optimize/opt_config [[ $? > 0 ]] && echo " optimize/opt_config did not load.." && exit [[ $VERBOSITY > 0 ]] && echo "OK" + # Validate optimize settings, if required + validate_opt_settings fi # -# Validate optimize settings, if required -[[ "$OPTIMIZE" != "0" ]] && validate_opt_settings - -# Prevents setting "-d /" by mistake. - -if [ $BUILDDIR = / ] ; then - echo -ne "\nThe root directory can't be used to build LFS.\n\n" - exit 1 -fi - # If $BUILDDIR has subdirectories like tools/ or bin/, stop the run # and notify the user about that. - if [ -d $BUILDDIR/tools -o -d $BUILDDIR/bin ] && [ -z $CLEAN ] ; then eval "$no_empty_builddir" fi @@ -504,7 +492,19 @@ clean_builddir if [[ ! -d $JHALFSDIR ]]; then mkdir -p $JHALFSDIR fi - +# +# Create $BUILDDIR/sources even though it could be created by get_sources() +if [[ ! -d $BUILDDIR/sources ]]; then + mkdir -p $BUILDDIR/sources +fi +# +# Create the log directory +if [[ ! -d $LOGDIR ]]; then + mkdir $LOGDIR +fi +>$LOGDIR/$LOG +# +# if [[ "$PWD" != "$JHALFSDIR" ]]; then cp $COMMON_DIR/makefile-functions $JHALFSDIR/ [[ "$OPTIMIZE" != "0" ]] && cp optimize/opt_override $JHALFSDIR/ @@ -512,33 +512,33 @@ if [[ "$PWD" != "$JHALFSDIR" ]]; then mkdir -p $JHALFSDIR/extras cp extras/* $JHALFSDIR/extras fi + # if [[ -n "$FILES" ]]; then # pushd/popd necessary to deal with mulitiple files pushd $PACKAGE_DIR 1> /dev/null cp $FILES $JHALFSDIR/ popd 1> /dev/null fi + # if [[ "$PROGNAME" != "blfs" ]]; then - [[ "$REPORT" = "1" ]] && cp $COMMON_DIR/create-sbu_du-report.sh $JHALFSDIR/ + if [[ "$REPORT" = "1" ]]; then + cp $COMMON_DIR/create-sbu_du-report.sh $JHALFSDIR/ + # After be sure that all look sane and if REPORT=1, dump the settings to a file + # This file will be used to create the REPORT header + validate_config > $JHALFSDIR/jhalfs.config + fi [[ "$GETPKG" = "1" ]] && cp $COMMON_DIR/urls.xsl $JHALFSDIR/ fi + # sed 's,FAKEDIR,'$BOOK',' $PACKAGE_DIR/$XSL > $JHALFSDIR/${XSL} export XSL=$JHALFSDIR/${XSL} fi -if [[ ! -d $LOGDIR ]]; then - mkdir $LOGDIR -fi - -# After be sure that all look sane and if REPORT=1, dump the settings to a file -# This file will be used to create the REPORT header -[[ "$PROGNAME" != "blfs" ]] && [[ "$REPORT" = "1" ]] && validate_config > $JHALFSDIR/jhalfs.config - ->$LOGDIR/$LOG get_book echo "${SD_BORDER}${nl_}" + build_Makefile echo "${SD_BORDER}${nl_}"