SCIENTIFIC-LINUX-USERS Archives

January 2005

SCIENTIFIC-LINUX-USERS@LISTSERV.FNAL.GOV

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Jon Peatfield <[log in to unmask]>
Reply To:
Jon Peatfield <[log in to unmask]>
Date:
Thu, 13 Jan 2005 19:13:17 +0000
Content-Type:
TEXT/PLAIN
Parts/Attachments:
TEXT/PLAIN (62 lines)
In a %post --nochroot one can simply use the chroot command to run
things chrooted to the new install tree.

We gave up trying to run our %post chrooted because it wasn't flexible
enough for what we needed.  To be honest it was also more what I was
used to with stuff like Jumpstart anyway!

Our %post copies over config files and a more complex script and then
runs it chooted approx like this:

--cut-here--
%post --nochroot

<snip snip -- stuff done needing access to the non-chrooted tree>

NR=/mnt/sysimage
SERV=ganglia.damtp.cam.ac.uk:/inst/ssetup/...<snip snip>
CFDIR=/rh-config/
export CFDIR
mkdir $NR/$CFDIR

## Get dns lookups working enough to do the first mount (sigh...)
cat > $NR/etc/resolv.conf <<EOF
search amtp.cam.ac.uk cam.ac.uk ac.uk
nameserver 131.111.16.129
EOF

## Fix up nsswitch.conf so host name lookups use DNS not try to use NIS
cp $NR/etc/nsswitch.conf $NR/etc/nsswitch.conf.orig
printf "/^hosts:/\ns;:.*;: files dns;\nw\nq\n" | ed $NR/etc/nsswitch.conf

# Since we want to do NFS we need to start portmap and nfslocking (in
# case it is needed), but portmapper needs loopback starting up first...
#
/usr/bin/ifconfig lo 127.0.0.1 up
#
chroot $NR /etc/rc.d/init.d/portmap start
chroot $NR /etc/rc.d/init.d/nfslock start

# Name lookups etc should be ok by now
chroot $NR mount $SERV $CFDIR
# Make a copy of postinstall and run it (it should do the rest)
cp $NR/$CFDIR/Config/postinstall $NR/root/

chroot $NR /root/postinstall

<snip snip -- some tidy ups>

chroot $NR /etc/rc.d/init.d/nfslock stop
chroot $NR /etc/rc.d/init.d/portmap stop

cd /
chroot $NR umount $CFDIR

--cut-here--

The info on resolv.conf/nsswitch.conf/loopback/portmap/nfslock might I
suppose save someone a bit of frustration if they want to use nfs
mounts in %post...

 -- Jon

ATOM RSS1 RSS2