LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices

Reply
 
LinkBack Search this Thread
Old 01-14-2009, 11:32 AM   #1
jnojr
Member
 
Registered: Sep 2007
Location: San Diego, CA
Posts: 175

Rep: Reputation: 15
RHEL5 - copy files from DVD during %post in kickstart


I want to put various files on a DVD along with a kickstart file, and have those files copied during the %post section. Googling led me top several mentions of how Red Hat broke anaconda and made it eject the CD/DVD too early. I also found a post which supposedly described how to fix this (create a new stage2.img that has two lines in dispatch.py swapped). I followed that process (mounted the original stage2.img, copied the contents to a new directory, made the change to dispatch.py, and used mksquashfs to create a new stage2.img) However, after copying my new stage2.img into my DVD and creating an ISO, it doesn't work... after loading drivers for SCSI, I get a 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.

Alt-F3 shows the last line as "ejecting /tmp/cdrom..."

So, the "fix" I found actually made things worse!

What is the real answer here? What do I need to do to keep the DVD mounted during %post?
 
Old 01-17-2009, 09:51 AM   #2
rayfordj
Member
 
Registered: Feb 2008
Location: Texas
Distribution: Fedora, RHEL, CentOS
Posts: 475

Rep: Reputation: 73
I do not believe that they actually eject it (or at least has been my experience) but rather umount it and remove the device node. I'm not sure if this is still a problem with newer media releases of RHEL5...

You may try something like this to recreate the device node for the optical drive and mount the media for access again:
Code:
%pre
#...

ls -l /tmp/cdrom > /tmp/cdrom.ls

#...

%post --nochroot

#...

#make sure we have access to media before continuing
if [ ! -b /tmp/cdrom ]
then
  #get the major number
  major=$(cat /tmp/cdrom.ls | cut -d" " -f5)
  #strip of the trailing comma
  major=${major%,}
  #get the minor number
  minor=$(cat /tmp/cdrom.ls | cut -d" " -f6)
  #make sure we have what we need; create device node if so
  [ -n "$major" -a -n "$minor" ] && mknod /tmp/cdrom b $major $minor
fi

#make sure mount directory exists
if [ ! -d /mnt/source ]
then
  mkdir -p /mnt/source
fi
#should be ready to mount the optical media
mount -t iso9660 -o ro /tmp/cdrom /mnt/source

#...
 
Old 12-13-2010, 06:03 PM   #3
Goll
LQ Newbie
 
Registered: Jun 2003
Location: €urope
Distribution: Debian GNU/Linux
Posts: 16

Rep: Reputation: 0
How to do it on CentOS 5.2

This is how I did it on CentOS 5.2:

in my ks.cfg:
Code:
%post --nochroot

#!/bin/bash

mkdir /tmp/c
mount -t iso9660 /tmp/cdrom /tmp/c
mkdir -p /mnt/sysimage/mnt/readme
cp /tmp/c/RELEASE-NOTES-es /mnt/sysimage/mnt/readme
umount /tmp/c
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Red Hat Enterprise Linux 5 RHEL5 kickstart problem with post install tate1615 Red Hat 1 04-30-2010 03:38 AM
Copy files from kickstart nfs mount to new system... custangro Linux - General 2 10-07-2008 09:55 AM
RHEL 5 Kickstart copying files from DVD ilo Red Hat 0 02-05-2008 08:42 AM
RHEL 5 Kickstart copying files from DVD & inserting comments with sed ilo Linux - Enterprise 0 01-31-2008 12:01 PM
copy files of cd post-install? tuppe Red Hat 2 12-05-2003 11:27 AM


All times are GMT -5. The time now is 10:59 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration