New Buildscripts (yet again ;-) ) (v2.2.4)

Bill's LFS Login lfsbill at wlmcs.com
Tue Apr 1 04:03:47 PST 2003


Hi Ryan!

How's the sleep effort going?

On Mon, 31 Mar 2003 Ryan.Oliver at pha.com.au wrote:

> Greetings again all
>
> Another update, plenty of contributed changes from Nicolas Roeser
> (Thanks Nico)

I think some of those changes were somewhat parochial in their view. I
have attached patches, which you may find unsuitable. You'll want to
remove the "brain-dead" reference, and probably most of the commentary.

><snip>

> Regards
> Ryan

Bill
-------------- next part --------------
diff -U10 -r NewStuff/build-ch5-2.2.4.sh Updated/build-ch5-2.2.4.sh
--- NewStuff/build-ch5-2.2.4.sh	2003-03-30 20:04:32.000000000 -0500
+++ Updated/build-ch5-2.2.4.sh	2003-04-01 06:35:16.000000000 -0500
@@ -286,20 +286,36 @@
 
 export SRC=${LFS}/usr/src
 export TARBALLS=${LFS}/usr/tarballs
 export PATCHES=${LFS}/usr/patches
 export SCRIPTS=${LFS}/usr/scripts
 
 # Logging
 # Set for base of logging tree
 export LOGS=${LFS}
 
+########################################################################
+# ====> For CHROOT: use one of the following two forms: For CHROOT <====
+# Because both SCRIPTS and LOGS are allowed to be set to an *arbitrary*
+# path, the first two can be used *only* if the leading portion of their
+# paths contain ${LFS}. Since my SCRIPTS=$PWD and doesn't contain ${LFS}
+# the CHSCRIPTS= using the sed flops miserably. Since my LOGS=${LFS},
+# the sed version of CHLOGS= leads to a null string, which flops due
+# to the fact that the tee command in the chroot is *not* interpreted in
+# the chroot environment, but in the current environment. This can be
+# changed, if desired by reworking the chroot command.
+########################################################################
+# CHSCRIPTS=`echo ${SCRIPTS} | sed "s@^${LFS}@@g"`
+# CHLOGS=`echo ${LOGS} | sed "s@^${LFS}@@g"`
+CHSCRIPTS=/Golfs/Testdir
+CHLOGS=${SCRIPTS}
+
 export CONFLOGS=${LOGS}/conflogs
 export BUILDLOGS=${LOGS}/buildlogs
 export INSTLOGS=${LOGS}/instlogs
 export TESTLOGS=${LOGS}/testlogs
 
 # Source Functions and definitions
 . ${SCRIPTS}/build-init-2.2.4.sh
 
 set +x
 unset LD_LIBRARY_PATH
@@ -1876,19 +1892,17 @@
    # may differ from the host, and cant expect the above /etc/group creation not
    # to be changed
    TTYGID=`grep ^tty: ${LFS}/etc/group | awk -F\: '{print $3}'`
    chgrp ${TTYGID} ${LFS}/dev/console
    mknod -m 666 ${LFS}/dev/null c 1 3
 
    mount --bind /dev ${LFS}/dev
 }
 
 # For automated build only (RO)
-CHSCRIPTS=`echo ${SCRIPTS} | sed "s@^${LFS}@@g"`
-CHLOGS=`echo ${LOGS} | sed "s@^${LFS}@@g"`
 
 chroot ${LFS} /stage1/bin/env -i \
    HOME=/root TERM=$TERM PS1='[\u@\h \W]\$ ' \
    PATH=/sbin:/bin:/usr/sbin:/usr/bin:/stage1/sbin:/stage1/bin \
    LDFLAGS="-s" \
    ${CHSCRIPTS}/build-ch6-toolchain-${VERSION}.sh 2>&1 | \
       tee ${CHLOGS}/buildlog-ch6.log-${DATE}
diff -U10 -r NewStuff/build-ch6-toolchain-2.2.4.sh Updated/build-ch6-toolchain-2.2.4.sh
--- NewStuff/build-ch6-toolchain-2.2.4.sh	2003-03-30 20:13:23.000000000 -0500
+++ Updated/build-ch6-toolchain-2.2.4.sh	2003-04-01 06:29:47.000000000 -0500
@@ -176,23 +176,36 @@
 unset LD_LIBRARY_PATH
 unset LD_PRELOAD
 
 export LDFLAGS="-s"
 
 # set path, /bin first so we pickup our symlinked
 # bash first
 # ( Commented as PATH is set during chroot)
 #export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/stage1/sbin:/stage1/bin
 
+########################################################################
+# The below is brain-dead because it makes assumptions that everything
+# under / should be changed to root:root. In my case, via mount --bind,
+# there are source/patch tarball directories and script directories that
+# are *not* to be root:root. So, modify the command to do what should be
+# done.
+#
+# NOTE: this is safe *only* because all *bin* stuff is only symlinks to
+# /stage1 at this time. If things change in the future, the chown *must*
+# be changed to avoid security concerns.
+########################################################################
 # Try to chown all files another time (perhaps we were not a root user while
 #  installing ch5 from outside the chroot)
-chown -R 0:0 /
+# chown -R 0:0 /
+chown -R 0:0 /opt /stage1 /var /bin /dev /lib /proc /boot /etc /root \
+    /tmp /home /mnt /sbin /usr
 
 # mount the proc filesystem and create a real /etc/mtab file
 mount proc /proc -t proc
 cp /proc/mounts /etc/mtab && chmod 644 /etc/mtab
 
 # If /dev is fstype devfs, set DEVFS=Y
 # If not, mount /dev/pts if used outside chroot (not req'd with devfs)
 
 df -T /dev | grep devfs > /dev/null 2>&1 &&
 {


More information about the lfs-dev mailing list