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

Re: boot-floppies 2.2.9 and Debian CD's...



On Fri Mar 24, 2000 at 09:28:54AM -0500, Ben Collins wrote:
> On Fri, Mar 24, 2000 at 01:19:59PM +0100, Raphael Hertzog wrote:
> > Le Thu, Mar 23, 2000 at 05:58:45PM -0500, Ben Collins écrivait:
> > > When mkhybrid creates the CD, you pass it the image(s) to use for booting.
> > > One of these is the root.bin from boot-floppies. It does not need to be
> > > recreated for the CD's, just simply:
> > > 
> > > gzip -dc root.bin > root.bin.uncompressed
> > > mount -o loop root.bin.uncompressed /mnt
> > > touch /mnt/cdrom_image
> > > umount /mnt
> > > gzip -c9 root.bin.uncompressed > root.bin
> > > 
> > > It's quite simple, and then that becomes the root image used for CD
> > > booting.
> > 
> > Yes, but mount needs root rights, and I would better not add such a
> > requiry for using debian-cd... is there no other way to get this
> > information ? Is there no way to get the device that has been used 
> > to boot ? Or can't we just automatically detect CD roms and look if there's a
> > .disk/info file in it ?
> 
> We do already detect cdrom's, but we still ask the user. Problem is you
> can't really know if you've booted off of a CDROM because the root
> filesystem is /dev/ram no matter what, which could be a tftp image,
> floppy, cdrom, zip drive, syslinux, or who knows what else.

So we put a magic file on the CDROM (or whatever media) so
we can tell which device we booted from.  Something along
the lines of:

    foundit=0

    # Mount /proc
    mount proc /proc -t proc

    # Try to mount up the boot device, and check 
    # to be sure it is the right one....

    for drive in `echo /dev/hd? /dev/sd? /dev/scd?` ; do
	if ! mount $drive /mnt -t iso9660 -o ro > /dev/null 2>&1 ; then
	    continue
	elif [ -e /mnt/README.Debian ] ; then
	    foundit=1
	else
	    umount /mnt
	fi
    done

    if [ foundit = 0 ] ; then
	echo "I'm sorry.  I could not find the Debian CD-ROM."
	while [ 1 ] ; do
	    sleep 1
	done
    fi

 -Erik

--
Erik B. Andersen   Web:    http://www.xmission.com/~andersen/ 
                   email:  andersee@debian.org
--This message was written using 73% post-consumer electrons--


Reply to: