[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Mount cdrom in %post on 2.6 kernel

On 9/13/05, Michael Boman <michael boman gmail com> wrote:
> On 9/13/05, Panu Matilainen <pmatilai laiskiainen org> wrote:
> > On Mon, 12 Sep 2005, Robert Wehner wrote:
> >
> > > Anyone have any ideas on how to get the CD mounted during %post in RHEL 4
> > > kickstarts?
> >
> > Run '/sbin/udevstart' at beginning of %post which will create the
> > necessary devices, worked for me at least.
> I was having the same problem, and this thread helped me resolve it.
> What I did was:
> --8<--
> %post
> {
> /sbin/start_udev
> mkdir -p /media/cdrom
> mount /dev/cdrom /media/cdrom
> --8<--

Thanks for everyone's comments on this. I finally got back to it last
night and used a combination of these suggestions to solve the
problem. I essentially used the above, but since I wanted to be able
to handle more than one cdrom device per machine I didn't feel
comfortable using /dev/cdrom and instead made haldaemon update
/etc/fstab so I could grep out all the cdrom devices and mount them in

find_cd_mounts ()
/sbin/service messagebus start
/sbin/service haldaemon start
# wait a few seconds for the above to finish
sleep 10
# now figure out what to mount.
if [ -e /proc/sys/dev/cdrom/info ]; then
   cd_devices="$(egrep '^drive name:' /proc/sys/dev/cdrom/info | awk
-F: '{print $2}')"
   echo "ERROR: File /proc/sys/dev/cdrom/info does not exist. Cannot mount DVD!"
   return 1

if [ "X${cd_devices}" = "X" ]; then
   echo "ERROR: No CD devices found in /proc/sys/dev/cdrom/info!"
   return 1
   for device in ${cd_devices}
      mount_pnt="$(egrep "/dev/${device}[^aA-zZ]" /etc/fstab | awk '{
print $2 }')"
                        if (mount ${mount_pnt}  >> ${LOGFILE} 2>&1); then
                                # run scripts found on CD with run-parts
                                non_mounted="${non_mounted} ${device}"
        echo "ERROR: Unable to mount any devices: ${non_mounted}"
        return 1

May be a little overkill, but there are a few odd multi-CD boxes out
there that I wanted to be sure I'd eventually find the CD.

thanks again for all the help.

Robert Wehner
rwehner gmail com

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]