Re: Persisting a one-off hostname change

2012-03-05 Thread Jason Heeris
If you're wondering, the way I did it was to change /etc/init.d/hostname.sh to include: PATH=/sbin:/bin:/usr/bin:/usr/local/bin ... do_start () { if [ -z "${HOSTNAME}" ]; then MAC_MAGIC="$(macstr | sed 's/://g' | cksum | cut -d ' ' -f 1 | xargs printf '%08X')"

Re: Persisting a one-off hostname change

2012-03-05 Thread Bob Proulx
Christofer C. Bell wrote: > /bin/echo dt$(/sbin/ifconfig eth0 | head -1 | awk -F: '{print $4$5$6}') > > /etc/hostname Why the full paths? Those have only ever hurt me. It is therefore a pet peeve of mine to challenge the use of them. They always hurt me. And I always remove them whenever I see

Re: Persisting a one-off hostname change

2012-03-04 Thread Christofer C. Bell
On Tue, Feb 28, 2012 at 12:08 AM, Jason Heeris wrote: > On 28 February 2012 13:40, Tom H wrote: >> Everywhere that I've worked the hostnames have had something to >> indicate its purpose and its location. > > I don't think this reasoning can be applied here though. There will be > dozens of ident

Re: Persisting a one-off hostname change

2012-02-28 Thread Tom H
On Tue, Feb 28, 2012 at 1:08 AM, Jason Heeris wrote: > On 28 February 2012 13:40, Tom H wrote: >> >> Everywhere that I've worked the hostnames have had something to >> indicate its purpose and its location. > > I don't think this reasoning can be applied here though. There will be > dozens of ide

Re: Persisting a one-off hostname change

2012-02-27 Thread Jason Heeris
On 28 February 2012 13:40, Tom H wrote: > Everywhere that I've worked the hostnames have had something to > indicate its purpose and its location. I don't think this reasoning can be applied here though. There will be dozens of identical devices plugged into the network, and hundreds in total (bu

Re: Persisting a one-off hostname change

2012-02-27 Thread Tom H
On Mon, Feb 27, 2012 at 7:07 PM, Jason Heeris wrote: > On 28 February 2012 00:27, Tom H wrote: >> Thanks for the explanation. It's a good plan but I think that you >> name'll be invoked in some non-flattering contexts once this is >> implemented... :) > > How would you approach it? Everywhere

Re: Persisting a one-off hostname change

2012-02-27 Thread Jason Heeris
On 28 February 2012 09:21, Paul E Condon wrote: > I didn't intend that the two steps be separated by some manual > process. I worry that when you start implementing the system you might > find that the total fix cannot actually be done at one point during > the boot process. Nope it works! ifconf

Re: Persisting a one-off hostname change

2012-02-27 Thread Paul E Condon
On 20120228_081002, Jason Heeris wrote: > On 28 February 2012 03:28, Paul E Condon wrote: > > I've been lurking, hoping to learn. Maybe I don't fully understand, but --- > > Wouldn't you be better off using the MAC address of the interface chip in > > each computer > > rather than a random number

Re: Persisting a one-off hostname change

2012-02-27 Thread Jason Heeris
On 28 February 2012 03:28, Paul E Condon wrote: > I've been lurking, hoping to learn. Maybe I don't fully understand, but --- > Wouldn't you be better off using the MAC address of the interface chip in > each computer > rather than a random number. The MAC address is supposed to be unique. I know

Re: Persisting a one-off hostname change

2012-02-27 Thread Jason Heeris
On 28 February 2012 00:27, Tom H wrote: > Thanks for the explanation. It's a good plan but I think that you > name'll be invoked in some non-flattering contexts once this is > implemented... :) How would you approach it? > "cp /etc/rc.local /etc/rc.local.final" and "vi /etc/rc.local" to add > yo

Re: Persisting a one-off hostname change

2012-02-27 Thread Paul E Condon
On 20120227_131327, Jason Heeris wrote: > I have an image of a Debian Squeeze system that I want to put onto > multiple systems (flash-based disks for a single-board computer). I'd > like each system to have a different hostname, but have that hostname > persist across subsequent reboots. > > My f

Re: Persisting a one-off hostname change

2012-02-27 Thread Paul E Condon
On 20120227_131327, Jason Heeris wrote: > I have an image of a Debian Squeeze system that I want to put onto > multiple systems (flash-based disks for a single-board computer). I'd > like each system to have a different hostname, but have that hostname > persist across subsequent reboots. > > My f

Re: Persisting a one-off hostname change

2012-02-27 Thread Tom H
On Mon, Feb 27, 2012 at 8:25 AM, Jason Heeris wrote: > On 27 February 2012 20:50, Tom H wrote: >> >> Aren't your users going to hate the random names? > > They won't be end users, but production staff. (I can certainly see > how you'd be sceptical of doing this for some poor end user...) There >

Re: Persisting a one-off hostname change

2012-02-27 Thread Jason Heeris
On 27 February 2012 20:50, Tom H wrote: > Aren't your users going to hate the random names? They won't be end users, but production staff. (I can certainly see how you'd be sceptical of doing this for some poor end user...) There will be multiple devices being built in a workshop, and they'll nee

Re: Persisting a one-off hostname change

2012-02-27 Thread Tom H
On Mon, Feb 27, 2012 at 3:49 AM, Jason Heeris wrote: > On 27 February 2012 16:19, Bob Proulx wrote: >> >> If you are generating random hostnames then does it actually matter >> what name the current host uses?  Would "localhost" be as good as any >> randomly generated one? > > The randomness is n

Re: Persisting a one-off hostname change

2012-02-27 Thread Jason Heeris
On 27 February 2012 17:05, Bob Proulx wrote: > I would do it later in runlevel 2 (same as 2-5).  Even at the very end > would be fine.  You could use "Required-Start: $all" if you like. I'll try it. > Alternatively instead of a random name have you considered using the > name it gets from revers

Re: Persisting a one-off hostname change

2012-02-27 Thread Bob Proulx
Jason Heeris wrote: > Bob Proulx wrote: > > You could still set the hostname randomly. Then later come back and > > write the current hostname to the /etc/hostname file when it is > > writable. > > Later in the rcS sequence, or in rc[2-5]? I would do it later in runlevel 2 (same as 2-5). Even a

Re: Persisting a one-off hostname change

2012-02-27 Thread Jason Heeris
On 27 February 2012 16:19, Bob Proulx wrote: > If you are generating random hostnames then does it actually matter > what name the current host uses?  Would "localhost" be as good as any > randomly generated one? The randomness is needed to avoid name collisions when multiple devices are running.

Re: Persisting a one-off hostname change

2012-02-27 Thread Bob Proulx
Jason Heeris wrote: > I have an image of a Debian Squeeze system that I want to put onto > multiple systems (flash-based disks for a single-board computer). I'd > like each system to have a different hostname, but have that hostname > persist across subsequent reboots. If you are generating random