dbootstrap: understanding is_cdrom_image
Ben, you wrote this function and I don't quite understand it:
/* This may get more complex...leave it simple for now */
int
is_cdrom_image(void)
{
struct stat statbuf;
if (NAME_ISREG("/cdrom_image",&statbuf) || bootargs.cdrom) {
if (NAME_ISDIR("/dists",&statbuf))
return 2;
else
return 1;
} else
return 0;
}
Please explain to me what the return values represent.
The problem here is that when the user select "install XXX from
CD-ROM", I want an accurate test of whether or not this is an official
CD-ROM or not. Which *doesn't* rely on the bootargs to be set
correctly.
Apparently non-zero return values means its some sort of CD-ROM
ismage. I would presume that '2' represents booting from a CD-image
(thus we have /dists). What I need is something like:
if (NAME_ISREG("/cdrom_image",&statbuf) || bootargs.cdrom) {
if (NAME_ISDIR("/dists",&statbuf))
return 2;
else
return 1;
} elsif (NAME_ISREG("/instmnt/.disks/info") {
return 1;
} else
return 0;
Does this seem correct?
--
.....Adam Di Carlo....adam@onShore.com.....<URL:http://www.onShore.com/>
Reply to: