From deb6b6c8fd1bdbfd4810801bf06f5626095d7215 Mon Sep 17 00:00:00 2001 From: Pierre Labastie Date: Sun, 5 Mar 2017 08:35:09 +0000 Subject: [PATCH] Fixes: - when the user fstab and/or kernel config are the same as the ones in $BUILDDIR/sources: avoid to cp on itself - set SRC_ARCHIVE=/dev/null in BLFS tools download script if SRC_ARCHIVE is empty --- CLFS/master.sh | 16 ++++++++++++---- LFS/master.sh | 5 ++++- common/libs/func_install_blfs | 2 +- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/CLFS/master.sh b/CLFS/master.sh index e150f00..6417ff1 100644 --- a/CLFS/master.sh +++ b/CLFS/master.sh @@ -378,10 +378,13 @@ boot_Makefiles() { # *grub | *aboot | *colo | *silo | *arcload | *lilo | *introduction ) continue ;; *how-to-view*) continue ;; *whatnext*) continue ;; - *fstab) [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab ;; + *fstab) [[ ! -z ${FSTAB} ]] && + [[ ${FSTAB} == $BUILDDIR/sources/fstab ]] || + cp ${FSTAB} $BUILDDIR/sources/fstab ;; *kernel) # if there is no kernel config file do not build the kernel - [[ -z $CONFIG ]] && continue + [[ -z $BOOT_CONFIG ]] && continue # Copy the config file to /sources with a standardized name + [[ ${BOOT_CONFIG} == $BUILDDIR/sources/bootkernel-config ]] || cp $BOOT_CONFIG $BUILDDIR/sources/bootkernel-config ;; esac @@ -734,7 +737,9 @@ bootscripts_Makefiles() { # *udev) continue ;; # This is not a script but a commentary, we want udev-rules *console*) continue ;; # Use the files that came with the bootscripts # fstab is now here (for 3.x.y) - *fstab) [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab ;; + *fstab) [[ ! -z ${FSTAB} ]] && + [[ ${FSTAB} == $BUILDDIR/sources/fstab ]] || + cp ${FSTAB} $BUILDDIR/sources/fstab ;; *) ;; esac @@ -907,10 +912,13 @@ bootable_Makefiles() { # # A little housekeeping on the scripts case $this_script in *grub | *aboot | *colo | *silo | *arcload | *lilo | *reboot* ) continue ;; - *fstab) [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab ;; + *fstab) [[ ! -z ${FSTAB} ]] && + [[ ${FSTAB} == $BUILDDIR/sources/fstab ]] || + cp ${FSTAB} $BUILDDIR/sources/fstab ;; *kernel) # if there is no kernel config file do not build the kernel [[ -z $CONFIG ]] && continue # Copy the config file to /sources with a standardized name + [[ $CONFIG == $BUILDDIR/sources/kernel-config ]] || cp $CONFIG $BUILDDIR/sources/kernel-config ;; esac diff --git a/LFS/master.sh b/LFS/master.sh index a742d0e..f80cf57 100644 --- a/LFS/master.sh +++ b/LFS/master.sh @@ -312,8 +312,11 @@ chapter78_Makefiles() { # If no .config file is supplied, the kernel build is skipped case ${this_script} in *grub) continue ;; - *fstab) [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab ;; + *fstab) [[ ! -z ${FSTAB} ]] && + [[ ${FSTAB} == $BUILDDIR/sources/fstab ]] || + cp ${FSTAB} $BUILDDIR/sources/fstab ;; *kernel) [[ -z ${CONFIG} ]] && continue + [[ ${CONFIG} == $BUILDDIR/sources/kernel-config ]] || cp ${CONFIG} $BUILDDIR/sources/kernel-config ;; esac diff --git a/common/libs/func_install_blfs b/common/libs/func_install_blfs index 2b17edc..042a912 100644 --- a/common/libs/func_install_blfs +++ b/common/libs/func_install_blfs @@ -146,7 +146,7 @@ pushd $BUILDDIR/sources sudo find . -name unpacked -exec rm \{\} \; if [ "$GETPKG" = "y" ]; then FTP_SERVER=$SERVER/pub/blfs/ \ - SRC_ARCHIVE=$SRC_ARCHIVE \ + SRC_ARCHIVE=${SRC_ARCHIVE:-/dev/null} \ $BUILDDIR$BLFS_ROOT/download_script else # Save the download script in case the user wants to run it later cp $BUILDDIR$BLFS_ROOT/download_script .