From b454589fa6e9dcb0c386d9f84f6d181884230c62 Mon Sep 17 00:00:00 2001 From: Pierre Labastie Date: Wed, 6 May 2020 13:02:47 +0000 Subject: [PATCH] Avoid having /bin in lfs' PATH if the build distro has merged /bin and /usr/bin git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/cross-chap5@11837 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689 --- chapter04/settingenviron.xml | 38 +++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/chapter04/settingenviron.xml b/chapter04/settingenviron.xml index 86d10bf05..a94586e0c 100644 --- a/chapter04/settingenviron.xml +++ b/chapter04/settingenviron.xml @@ -43,7 +43,9 @@ umask 022 LFS=/mnt/lfs LC_ALL=POSIX LFS_TGT=$(uname -m)-lfs-linux-gnu -PATH=$LFS/tools/bin:/bin:/usr/bin +PATH=/usr/bin +if [ ! -l /bin ]; then PATH=/bin:$PATH; fi +PATH=$LFS/tools/bin:$PATH export LFS LC_ALL LFS_TGT PATH EOF @@ -108,14 +110,36 @@ EOF - PATH=$LFS/tools/bin:/bin:/usr/bin + PATH=/usr/bin + + Many modern linux distributions have merged /bin and /usr/bin. When this is the case, the standard + PATH variable needs just to be set to /usr/bin/ for the environment. When this is not the + case, the following line adds /bin + to the path. + + + + + if [ ! -l /bin ]; then PATH=/bin:$PATH; fi + + If /bin is not a symbolic + link, then it has to be added to the PATH variable. + + + + + PATH=$LFS/tools/bin:$PATH By putting $LFS/tools/bin ahead of the - standard PATH, all the programs installed in are picked up by the shell immediately after - their installation. This, combined with turning off hashing, limits the risk - that old programs are used from the host when the same programs are available in - the Chapter 5 environment. + standard PATH, the cross-compiler installed at the beginning + of is picked up by the shell + immediately after its installation. This, combined with turning off hashing, + limits the risk that the compiler from the host be used instead of the + cross-compiler.