RHEL5 - copy files from DVD during %post

Bryan Schneiders bschneiders at woti.com
Fri Feb 6 19:52:08 UTC 2009


Here is everything I have in my notes from last time I did this.  I don't remember why I used tar to copy the contents of the stage2.img, but probably because it preserved something that 'cp' didn't.


# Do the following to disable the CDROM eject using kickstart:

    * to make changes to files on the ram filesystem:

      mkdir /mnt/image
      mount -o loop /mnt/cdrom/images/stage2.img /mnt/image/
      cd /mnt/image
      tar -cvf ~/stage2.tar .
      mkdir ~/stage2
      cd ~/stage2
      tar -xvf ~/stage2.tar
      vim usr/lib/anaconda/kickstart.py

    * add this line into the setSteps function
      dispatch.skipStep("methodcomplete")
    * to recreate the ram file system:

      cd ~
      mksquashfs stage2/ stage2.img.new
      cp stage2.img.new ~/dvd/images/stage2.img

# Create the custom iso with mkisofs
mkisofs -o custom.iso -V "Customized" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -R -J -v -T /tmp/cdrom 



I added the line to kickstart.py on line 880.  Here's the surrounding lines for context:
...
        dispatch.skipStep("bootdisk")
        dispatch.skipStep("betanag")
        dispatch.skipStep("installtype")
        dispatch.skipStep("tasksel")            
        dispatch.skipStep("network")
        dispatch.skipStep("methodcomplete")

        # Don't show confirmation screens on non-interactive installs.
        if not self.ksdata.interactive:
            dispatch.skipStep("confirminstall")
            dispatch.skipStep("confirmupgrade")
            dispatch.skipStep("welcome")
...


Also make sure your new CD or DVD includes the .discinfo and .treeinfo files from the root of the original DVD.

Bryan Schneiders
bschneiders at woti.com
301-562-1900 ext 305


John Oliver wrote:
> On Wed, Jan 14, 2009 at 01:49:13PM -0500, Bryan Schneiders wrote:
>> I worked around this in the past by modifying usr/lib/anaconda/kickstart.py 
>> in the stage2.img and adding dispatch.skipStep("methodcomplete") to the 
>> list in the setSteps function.
> 
> Where, exactly, would that line go?
> 
> Every suggestion I've had for this problem results in a stage2.img that
> does not work.
> 
> I can go through the motions of creating a new stage2.img, and so long
> as I do not change anything, it will work, so I know I'm not screwing
> that up.  But if I change any files, I get stuck with the message:
> 
> The Red Hat Enterprise Linux Server CD was not found in any of your
> CDROM drives. Please insert the Red Hat Enterprise Linux Server CD and
> press OK to retry.
> 
> That tells me that either there's some very particular way in which the
> contents of the img need to be modified, or that every suggestion I've
> found so far has been a guess as to "what might work".  So, a very
> precise description of what *does* work would be greatly appreciated.
> 




More information about the Kickstart-list mailing list