|
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
>
|
|
From: Heiko Z. <he...@zu...> - 2004-01-04 23:41:16
|
Tim Tait wrote: > > 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: Do it again and add the parameters "-run". For infos: cvs diff --help I'm going to add this stuff to the documentation.... Heiko |
|
From: Friedrich L. <fl...@fl...> - 2004-01-05 00:23:46
|
Heiko Zuerker wrote on 05.01.2004 00:37 MET: > Tim Tait wrote: > >> I don't know if this is the correct way, but here is a CVS diff: > > > Do it again and add the parameters "-run". I guess you mean "--Nur" (capital n!) side note: "Nur"...= german for only ;-) but you can also write it as "--ruN". > For infos: > cvs diff --help > > I'm going to add this stuff to the documentation.... -- MfG / Regards Friedrich Lobenstock ____________________________________________________________________ Friedrich Lobenstock Linux Services Lobenstock URL: http://www.lsl.at/ Email: fl...@fl... ____________________________________________________________________ |
|
From: Tim T. <t....@co...> - 2004-01-05 00:01:05
Attachments:
patch_linuxrc.diff
|
Tim Tait wrote: > > 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"? 2nd try with "unified diff" attachment. I couldn't get the cvs diff -run to work, sorry. Tim |
|
From: Heiko Z. <he...@zu...> - 2004-01-05 00:15:18
|
Tim Tait wrote: > > Tim Tait wrote: > >> >> 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"? > > > 2nd try with "unified diff" attachment. I couldn't get the cvs diff -run > to work, sorry. I just checked out the cvs diff command, it's very limited.... Heiko |
|
From: Friedrich L. <fl...@fl...> - 2004-01-05 00:26:21
|
Tim Tait wrote on 05.01.2004 01:01 MET: > > 2nd try with "unified diff" attachment. I couldn't get the cvs diff -run > to work, sorry. See my other posting, I guess you need to use a capital N, so use "--Nur". > > ------------------------------------------------------------------------ > > --- config/etc/initrd/linuxrc.old 2003-12-23 17:05:33.000000000 +0100 > +++ config/etc/initrd/linuxrc 2004-01-03 23:53:12.000000000 +0100 > @@ -208,3 +218,4 @@ > echo 'Please mail a bug report to bu...@de...' > echo > exit > + Please remove the empty line at the end of the file. Please always check your diff for such little mistakes. Thanks. -- MfG / Regards Friedrich Lobenstock ____________________________________________________________________ Friedrich Lobenstock Linux Services Lobenstock URL: http://www.lsl.at/ Email: fl...@fl... ____________________________________________________________________ |
|
From: Heiko Z. <he...@zu...> - 2004-01-05 00:36:58
|
Tim Tait wrote: > > Tim Tait wrote: > >> >> 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"? > > > 2nd try with "unified diff" attachment. I couldn't get the cvs diff -run > to work, sorry. I can't look into it at the moment, I have a full re-compile running. Bruce you got time? Otherwise I'll try to do it tomorrow night. Heiko |
|
From: Bruce S. <bw...@ar...> - 2004-01-05 01:26:34
|
> >> 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"? > > > > 2nd try with "unified diff" attachment. I couldn't get the cvs diff -run > > to work, sorry. > > I can't look into it at the moment, I have a full re-compile running. > Bruce you got time? Otherwise I'll try to do it tomorrow night. I might have time tomorrow. I haven't looked at the patch yet, but I'm not sure about checking for floppy first. That would check floppy before the USB memory stick. I think the USB flash drive should have priority over the floppy. Heiko, what's your opinion on that? Also, the search order for configs need to match the save-config script. It's really confusing if your save goes to a different location than the boot is using. (believe me, I know that first hand! :) So, if you change the boot order, you also need to modify the save-config script. - BS |
|
From: Tim T. <t....@co...> - 2004-01-05 03:04:47
|
Bruce Smith wrote: >>>>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"? >>>> >>>> >>>2nd try with "unified diff" attachment. I couldn't get the cvs diff -run >>>to work, sorry. >>> >>> >>I can't look into it at the moment, I have a full re-compile running. >>Bruce you got time? Otherwise I'll try to do it tomorrow night. >> >> > >I might have time tomorrow. > >I haven't looked at the patch yet, but I'm not sure about checking for >floppy first. That would check floppy before the USB memory stick. >I think the USB flash drive should have priority over the floppy. >Heiko, what's your opinion on that? > > I think it needs to check both... my thought was if you have a USB config then you are unlikely to leave a floppy in, except to test something. Also, I was not sure how to make it check USB vs a SCSI drive. Either way I think removable media 1st.. of course since I have an IDE CF Card, it get's more convoluted. There probably is no canned config which solves every setup, which is why I was asking about passing it as a parameter from grub for installs to usb/hd . >Also, the search order for configs need to match the save-config script. >It's really confusing if your save goes to a different location than the >boot is using. (believe me, I know that first hand! :) So, if you >change the boot order, you also need to modify the save-config script. > > - BS > > I agree on the save-config script, that was my next order of business. Ideally though, save-config should *know* where the source was, not guess. Hot-pluggable media coudl ahve been added since boot, etc. Can't we pass it some how from linuxrc? Tim |
|
From: Heiko Z. <he...@zu...> - 2004-01-06 00:46:12
|
Tim Tait wrote: > Bruce Smith wrote: > >>>>>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"? >>>>> >>>>> >>>>2nd try with "unified diff" attachment. I couldn't get the cvs diff -run >>>>to work, sorry. >>>> >>>> >>>I can't look into it at the moment, I have a full re-compile running. >>>Bruce you got time? Otherwise I'll try to do it tomorrow night. >>> >>> >> >>I might have time tomorrow. >> >>I haven't looked at the patch yet, but I'm not sure about checking for >>floppy first. That would check floppy before the USB memory stick. >>I think the USB flash drive should have priority over the floppy. >>Heiko, what's your opinion on that? >> >> > I think it needs to check both... my thought was if you have a USB > config then you are unlikely to leave a floppy in, except to test > something. Also, I was not sure how to make it check USB vs a SCSI > drive. Either way I think removable media 1st.. of course since I have > an IDE CF Card, it get's more convoluted. There probably is no canned > config which solves every setup, which is why I was asking about passing > it as a parameter from grub for installs to usb/hd . Sorry, but I don't really "feel" we should change the order. However, your other changes are still in the queue. >>Also, the search order for configs need to match the save-config script. >>It's really confusing if your save goes to a different location than the >>boot is using. (believe me, I know that first hand! :) So, if you >>change the boot order, you also need to modify the save-config script. >> >> - BS >> >> > I agree on the save-config script, that was my next order of business. > Ideally though, save-config should *know* where the source was, not > guess. Hot-pluggable media coudl ahve been added since boot, etc. Can't > we pass it some how from linuxrc? We just need to copy'n'paste the specific parts into the save-config script. Heiko |
|
From: Diego T. <dt...@co...> - 2004-01-06 01:46:09
|
On Mon, Jan 05, 2004 at 07:41:34PM -0500, Heiko Zuerker wrote: > >config which solves every setup, which is why I was asking about passing > >it as a parameter from grub for installs to usb/hd . > > Sorry, but I don't really "feel" we should change the order. i agree. now that it's working and should be consider a standard, we shouldn't touch it :) -- -- gnupg keyfingerprint -- 48AF 5BF9 8F54 2966 64CC 2327 7CD0 DD91 B09D 5799 -- Use of a keyboard or mouse may be linked to serious injuries or disorders. Diego Torres - dtorres at anthalia dot org - Madrid / España |
|
From: Heiko Z. <he...@zu...> - 2004-01-05 01:51:18
|
Bruce Smith wrote: >>>>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"? >>> >>>2nd try with "unified diff" attachment. I couldn't get the cvs diff -run >>>to work, sorry. >> >>I can't look into it at the moment, I have a full re-compile running. >>Bruce you got time? Otherwise I'll try to do it tomorrow night. > > > I might have time tomorrow. > > I haven't looked at the patch yet, but I'm not sure about checking for > floppy first. That would check floppy before the USB memory stick. > > I think the USB flash drive should have priority over the floppy. > Heiko, what's your opinion on that? I think so, too. But that means that SCSI devices come before the floppy comes before IDE devices. > Also, the search order for configs need to match the save-config script. > It's really confusing if your save goes to a different location than the > boot is using. (believe me, I know that first hand! :) So, if you > change the boot order, you also need to modify the save-config script. Yes, save-config *and* the initrd need to be in sync. Heiko |
|
From: Bruce S. <bw...@ar...> - 2004-01-05 02:24:03
|
> > I haven't looked at the patch yet, but I'm not sure about checking for > > floppy first. That would check floppy before the USB memory stick. > > > > I think the USB flash drive should have priority over the floppy. > > Heiko, what's your opinion on that? > > I think so, too. But that means that SCSI devices come before the floppy > comes before IDE devices. And if save-config has the same search order, and if IDE drives come before floppies, then save-config will be saving the config to IDE hard drives if they exist. I'm not sure that's a good idea either, is it??? > > Also, the search order for configs need to match the save-config script. > > It's really confusing if your save goes to a different location than the > > boot is using. (believe me, I know that first hand! :) So, if you > > change the boot order, you also need to modify the save-config script. > > Yes, save-config *and* the initrd need to be in sync. - BS |
|
From: Heiko Z. <he...@zu...> - 2004-01-08 01:15:18
|
Tim Tait wrote: > > Tim Tait wrote: > >> >> 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"? > > > 2nd try with "unified diff" attachment. I couldn't get the cvs diff -run > to work, sorry. The patch is in CVS now, I did some more cleanup and you forgott a "umount /floppy". Heiko |
|
From: Tim T. <t....@co...> - 2004-01-08 02:51:18
|
Heiko Zuerker wrote: > Tim Tait wrote: > >> >> Tim Tait wrote: >> >>> >>> 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"? >> >> >> >> 2nd try with "unified diff" attachment. I couldn't get the cvs diff >> -run to work, sorry. > > > The patch is in CVS now, I did some more cleanup and you forgott a > "umount /floppy". > > Heiko Yes, I found that out last night :( Sorry. I was testing out some more changes I mind and was hoping to submit a new patch but my build machine is misbehaving, seems to be a well documented issue with APIC on nForce2 motherboards:(( Causes it to lockup when there is a lot of interrupts like IDE r/w during a big build #@$!@$%$#%. Anyhow thanks for fixing and including it! Tim |