mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* variables with random values
@ 2016-05-12 19:34 Giorgio
  2016-05-12 19:41 ` Trent Piepho
  0 siblings, 1 reply; 2+ messages in thread
From: Giorgio @ 2016-05-12 19:34 UTC (permalink / raw)
  To: barebox


[-- Attachment #1.1.1: Type: text/plain, Size: 505 bytes --]

Hi,

I'm writing a shell script within barebox to assist an embedded board
initialization process. Some commands in the script do firmware
download with tftp; to allow initializing more than one board at
a time I need to assign every board a random ip address; I would
like to have a shell variable that every time it is dereferenced
it results in a new random (8 bits) value so I could write:

eth0.ipaddr=10.$RND.$RND.$RND

Is there a way to do something similar in barebox ?

giorgio



[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 246 bytes --]

[-- Attachment #2: Type: text/plain, Size: 149 bytes --]

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: variables with random values
  2016-05-12 19:34 variables with random values Giorgio
@ 2016-05-12 19:41 ` Trent Piepho
  0 siblings, 0 replies; 2+ messages in thread
From: Trent Piepho @ 2016-05-12 19:41 UTC (permalink / raw)
  To: Giorgio; +Cc: barebox

Have you considered using DHCP?  It would work a lot better, as you
won't have to worry about duplicate IPs or invalid IPs.

I think you'll have to write a new globalvar for barebox to get a random
value, since the shell doesn't support backtick substitution.

On Thu, 2016-05-12 at 21:34 +0200, Giorgio wrote:
> Hi,
> 
> I'm writing a shell script within barebox to assist an embedded board
> initialization process. Some commands in the script do firmware
> download with tftp; to allow initializing more than one board at
> a time I need to assign every board a random ip address; I would
> like to have a shell variable that every time it is dereferenced
> it results in a new random (8 bits) value so I could write:
> 
> eth0.ipaddr=10.$RND.$RND.$RND
> 
> Is there a way to do something similar in barebox ?
> 
> giorgio
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-05-12 19:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-12 19:34 variables with random values Giorgio
2016-05-12 19:41 ` Trent Piepho

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox