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

[ale] "busybox" looping?



Oh. My syntax is, I'm sure, crappy, the idea is there. As long as DHCP
is blank, loop through the process, setting DHCP to NULL if not in good
form.


echo "** Entering bootstrap **"
 while ( ! DHCP ){
 nums=0123456789
 
 echo -n "Enter IP address or DHCP:  "
 read DHCP*
 
 case $DHCP in*
         [$nums]\.[$nums])
                 /sbin/manual_IP 
         ;;
	[Dd][Hh][Cc][Pp])
		echo -n "Starting dhclient: "
                 dhclient && echo "Success." || /sbin/manual_IP
	;;
         *)
                DCHP=""
		echo "I can't start networking with that input" 
		exit
         ;;
 esac
}

On Tue, 2002-12-17 at 10:14, Robert L. Harris wrote:
>   Problem is that if the remote console (tty consoles in offices in and
> out of the country) is slow and you hit enter to get the console to
> respond, it doesn't because of lag, you hit enter again thinking it
> wasn't connected, you just started dhclient and hosed the box.
> 
> 
> 
> Thus spake James P. Kinney III (jkinney at localnetsolutions.com):
> 
> > Change the default to:
> > 
> > echo "** Entering bootstrap **"
> > 
> > nums=0123456789
> > 
> > echo -n "Enter IP address (leave blank for DHCP):  "
> > read DHCP*
> > 
> > case $DHCP in*
> >         [$nums]\.[$nums])
> >                 /sbin/manual_IP 
> >         ;;
> >         *)
> >                 echo -n "Starting dhclient: "
> >                 dhclient && echo "Success." || /sbin/manual_IP
> >         ;;
> > esac
> > 
> > On Tue, 2002-12-17 at 09:51, Robert L. Harris wrote:
> > >   Anyone use busybox?  Yes, I'm reverse engineering yet another project
> > > since the last one started rolling out finally.  It's a custom boot
> > > floppy that uses busybox.  The only real problem aside from some
> > > modernization and tweaking is that the floppy executes a "menu" which
> > > defaults to a very bad option if it doesn't like what it gets.  I'm
> > > thinking I'd like to put in a loop.  Right now it has a case statement
> > > that does a:
> > > 
> > > echo "** Entering bootstrap **"
> > > echo -n "Obtain ip via DHCP? (default: yes):  "
> > > read DHCP*
> > > 
> > > case $DHCP in*
> > >         [Nn][Oo] | [Nn])
> > >                 /sbin/manual_IP
> > >         ;;
> > >         *)
> > >                 echo -n "Starting dhclient: "
> > >                 dhclient && echo "Success." || /sbin/manual_IP
> > >         ;;
> > > esac
> > > 
> > >   The problem is that none of our production servers have dhcp in their
> > > area so we have to manually enter the IP.  If you're connecting to a
> > > remote console though you have to hit "enter" to get a screen refresh
> > > when it disconnects you at boot up/reboot.  As a result you may or may
> > > not end up hitting enter instead of "no" at that prompt.  It's happened
> > > with co-workers a few times in the very early hours of the morning.
> > > 
> > >   I know I can put a bunch of read's before the segment but I'd like to
> > > make it a little smarter and have it explicitly look for "yes" and loop
> > > back if no such animal.
> > > 
> > >   Anyone used busy box to this end or other good suggestions?  No dhcp
> > > won't be installed in the remote areas.. :>
> > > 
> > > Robert
> > > 
> > > 
> > > :wq!
> > > ---------------------------------------------------------------------------
> > > Robert L. Harris                     | PGP Key ID: FC96D405
> > >                                
> > > DISCLAIMER:
> > >       These are MY OPINIONS ALONE.  I speak for no-one else.
> > > FYI:
> > >  perl -e 'print $i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);'
> > -- 
> > James P. Kinney III   \Changing the mobile computing world/
> > President and CEO      \          one Linux user         /
> > Local Net Solutions,LLC \           at a time.          /
> > 770-493-8244             \.___________________________./
> > 
> > GPG ID: 829C6CA7 James P. Kinney III (M.S. Physics) <jkinney at localnetsolutions.com>
> > Fingerprint = 3C9E 6366 54FC A3FE BA4D 0659 6190 ADC3 829C 6CA7 
> > 
> > 
> 
> 
> 
> 
> 
> :wq!
> ---------------------------------------------------------------------------
> Robert L. Harris                     | PGP Key ID: FC96D405
>                                
> DISCLAIMER:
>       These are MY OPINIONS ALONE.  I speak for no-one else.
> FYI:
>  perl -e 'print $i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);'
-- 
James P. Kinney III   \Changing the mobile computing world/
President and CEO      \          one Linux user         /
Local Net Solutions,LLC \           at a time.          /
770-493-8244             \.___________________________./

GPG ID: 829C6CA7 James P. Kinney III (M.S. Physics) <jkinney at localnetsolutions.com>
Fingerprint = 3C9E 6366 54FC A3FE BA4D 0659 6190 ADC3 829C 6CA7 



 This is a digitally signed message part