stage2.img still not patched?

Gerald Waugh gwaugh at frontstreetnetworks.com
Tue Aug 18 16:34:03 UTC 2009


Jake Vickers wrote; August 18, 2009 7:36 AM

> Jake Vickers wrote:
>> Is stage2.img still not patched to not eject the CD before the %post? 
>> Or did the process change as far as mounting the media and copying 
>> files to the new environment?
>> I have a tarball that I need to copy to the destination environment 
>> after the OS install and have been using a patched stage2 file I 
>> whipped up from the 5.1 days and just tried to create an x86_64 image 
>> but the file did not copy over from what I would assume to be the 
>> stage2 not being patched. Can anyone confirm/deny?
>> Thanks.
>>
>> For those that will ask, my %post is rather simple:
>>
>> %post --nochroot
>> mkdir /mnt/sysimage/var/me
>> cd /mnt/sysimage/var/me
>> tar xzvf /mnt/source/me.tar.gz
> 
> Sorry, guess I should have given more information....
> stage2 is not patched in RHEL 5.3, so it will eject the CD before the 
> %post is run. This is easily rectified by modifying the dispatch.py file 
> in stage2.img (see list archives for instructions) and then rebuilding 
> the stage2.img file.
> 

# Note that the *.img files use the squashfs file system. 
# if the tools are not on the system yum install them. 
yum -y install squashfs-tools mkisofs cdrecord 
# insert install-cd into cdrom 
mkdir /mnt/cdrom 
mount /dev/cdrom /mnt/cdrom 
mkdir /home/BlueOnyx 
mkdir /home/BlueOnyx/ISOs 
mkdir /home/BlueOnyx/BlueOnyx-5.2-20090107 
cd /mnt/cdrom 
# move the iso to a rw area 
tar -c * | tar -C /home/BlueOnyx/BlueOnyx-5.2-20090107 -xf- 
cd /home/BlueOnyx/BlueOnyx-5.2-20090107 
cp /mnt/cdrom/.discinfo . 
umount /mnt/cdrom 
# remove the install cd and insert a fresh CD 
cd /home/BlueOnyx/BlueOnyx-5.2-20090107/images 
unsquashfs stage2.img 
cd squashfs-root 
vi usr/lib/anaconda/dispatch.py 
# find these lines (need to reverse them) 
("methodcomplete", doMethodComplete, ), 
("dopostaction", doPostAction, ), 
#and change to 
("dopostaction", doPostAction, ), 
("methodcomplete", doMethodComplete, ), 
# note with vi you will have to use :w! to write the ro file 
# recreate the ram file system: 
cd .. 
mksquashfs squashfs-root ../../stage2.img 
cp ../../stage2.img stage2.img 
rm -rf squashfs-root 
cd ../ 
mkisofs -P CentOS -b isolinux/isolinux.bin -c isolinux/boot.cat\ 
-no-emul-boot -boot-load-size 4 -boot-info-table -r -J -T -o 
../ISOs/BlueOnyx-5.2-20090107-1.iso . 
cd ../ISOs 
# note dev arguement may be different execute 'cdrecord scanbus' to find 
dev= info 
cdrecord -v dev=5,0,0 BlueOnyx-5.2-20090107-1.iso 

You should now have a CD that will run the %post scripts. 
There may be typos/erros in the above... 





More information about the Kickstart-list mailing list