On 7/6/06, Paul G Rogers <[EMAIL PROTECTED]> wrote:
Dan, two questions.  Would this be an acceptable script for beginning or
resuming a Chap 6 build session?

Couple minor problems. See below.

And what would be the consequences of
allowing Chap6.8 to build on the real /dev rather than a tempfs?
(Besides wasting a little space after udev mounts the tempfs there.)

Nothing, really. If you prefer to populate $LFS/dev with a static set
of devices (like with MAKEDEV), that's fine. However, if you don't
bind mount the tmpfs /dev to $LFS/dev, then all you're going to have
there are console and null. That's not enough to get the build done
properly. You could do it the 6.1.1 way and create the minimum set of
nodes in $LFS/dev by hand if you want. In that case, you wouldn't need
$LFS/dev to be a tmpfs.

#!/bin/bash

If you add "set -e" or " -e" to the end of the interpreter line, then
the script will bomb on errors and you don't have to chain everything
together with &&.

# Prepare & enter the build environment for a session
if [ ! -d $LFS ] ; then
  mount /dev/hda2 $LFS
fi &&

This doesn't really check if anything is mounted. The directory $LFS
could exist and the device not be mounted. Worse, if the directory
doesn't exist and the device isn't mounted, then `mount' will bomb
because there's no directory to mount in.

So, you'd want to create the directory if it doesn't exist.

[ -d "$LFS" ] || mkdir -pv $LFS

Then check if anything is mounted. Look at /etc/mtab, or /proc/mounts
more properly.

if ! grep "/dev/hda2 $LFS" /proc/mounts >/dev/null; then
 mount -v /dev/hda2 $LFS
fi

You could change the logic around, obviously.

mount -vft tmpfs tmpfs $LFS/dev/shm &&
mount -vft devpts -o gid=4,mode=620 devpts $LFS/dev/pts &&

These actually need to be real mounts, so drop the f from -vft.  Looks
fine otherwise. There's a minor issue using the chroot line depending
on where you are in Ch. 6.  See here:

http://www.linuxfromscratch.org/lfs/view/development/chapter06/revisedchroot.html

--
Dan
--
http://linuxfromscratch.org/mailman/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page

Reply via email to