|
From: Tim T. <t....@co...> - 2004-01-04 23:33:14
|
I made what I think is a few enhancements to the linuxrc script... now
this is my 1st attempt at any real script mods, so I may not have it all
correct.
First is simple, I have it check floppies for a config 1st, thus
allowing someone to temporarily test new configs by overiding one stored
on a HD. Probably be good to check other removeable media list USB 1st
too but thats trickier. I don't think this raises a security risk, cause
if someone can put floppies into your machine they can do a lot worse too.
2nd, if you have multiple possible sources of the configuration file,
if it's not on the first one, it halts the boot to prompt if you want to
write a default one to it. This is really bad, because it hangs the
system on an unattended reboot. So I tweaked the script to check all
media 1st, then if none was found do a 2nd pass to look for blank media.
Of course lastly it still checks the CDROM. Is it possible to pass the
config source from grub as option, like it works for "root=/dev/hda1"?
I don't know if this is the correct way, but here is a CVS diff:
Tim
Index: etc/initrd/linuxrc
===================================================================
RCS file: /cvsroot/devil-linux/build/config/etc/initrd/linuxrc,v
retrieving revision 1.52
diff -r1.52 linuxrc
79c79
< CONFIG_SRC_LIST="$CDROM_IDE $CDROM_SCSI $PARTITIONS_SCSI
$PARTITIONS_IDE $FLOPPIES"
---
> CONFIG_SRC_LIST="$FLOPPIES $PARTITIONS_IDE $CDROM_IDE $CDROM_SCSI
$PARTITIONS_SCSI"
92c92
< echo -e "Checking $CFG_SRC"
---
> echo -e "Checking for configuration on $CFG_SRC"
103,109c103,120
< # offer to copy the configuration file if device is
not a CD
< if [ ! "${CFG_SRC##/*/}" = "cd" ];then
< beep;
< $YELLOW
< echo -e "\n*** Found empty configuration media. ***"
< $NORMAL
< echo -n "Should I copy default configuration to it?"
---
> fi
> fi
> done
>
> # first pass looks for existing configuration, 2nd pass will
create if none found
> for CFG_SRC in $CONFIG_SRC_LIST
> do
> echo -e "Looking for empty configuation media on $CFG_SRC"
> if mount -n -t auto $CFG_SRC /floppy >/dev/null 2>&1 ; then
> # offer to copy the configuration file if device is not a CD
> if [ ! "${CFG_SRC##/*/}" = "cd" ];then
> beep;
> $YELLOW
> echo -e "\n*** Found empty configuration media. ***"
> $NORMAL
> echo -n "Should I copy default configuration to it?"
> if ask_yes_no ; then
> echo -n "Would you like to probe for SCSI
controllers now?"
111,124c122,128
< echo -n "Would you like to probe for SCSI
controllers now?"
< if ask_yes_no ; then
< /probe_all_scsi_modules
< fi
< if ! /mount_cdrom /cdrom noreboot ; then
< $RED
< echo -e "Cannot find CD drive - try
probing for SCSI controllers"
< $NORMAL
< continue
< fi
< mount -n -t auto $CFG_SRC /floppy >/dev/null
2>&1 || continue
< cp -i /cdrom/config/etc.tar.bz2 /floppy/ ||
continue
< DL_CONFIG_SOURCE=$CFG_SRC
< continue 2
---
> /probe_all_scsi_modules
> fi
> if ! /mount_cdrom /cdrom noreboot ; then
> $RED
> echo -e "Cannot find CD drive - try probing
for SCSI controllers"
> $NORMAL
> continue
125a130,133
> mount -n -t auto $CFG_SRC /floppy >/dev/null 2>&1
|| continue
> cp -i /cdrom/config/etc.tar.bz2 /floppy/ || continue
> DL_CONFIG_SOURCE=$CFG_SRC
> continue 2
129a138,139
>
> # 3rd pass defaults to CD configuration
210a221
>
|