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-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-04 Thread Christofer C. Bell
On Tue, Feb 28, 2012 at 12:08 AM, Jason Heeris jason.hee...@gmail.com wrote: On 28 February 2012 13:40, Tom H tomh0...@gmail.com 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

Re: Persisting a one-off hostname change

2012-02-28 Thread Tom H
On Tue, Feb 28, 2012 at 1:08 AM, Jason Heeris jason.hee...@gmail.com wrote: On 28 February 2012 13:40, Tom H tomh0...@gmail.com 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

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

Re: Persisting a one-off hostname change

2012-02-27 Thread Jason Heeris
On 27 February 2012 16:19, Bob Proulx b...@proulx.com 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

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 at the

Re: Persisting a one-off hostname change

2012-02-27 Thread Jason Heeris
On 27 February 2012 17:05, Bob Proulx b...@proulx.com 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

Re: Persisting a one-off hostname change

2012-02-27 Thread Tom H
On Mon, Feb 27, 2012 at 3:49 AM, Jason Heeris jason.hee...@gmail.com wrote: On 27 February 2012 16:19, Bob Proulx b...@proulx.com 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

Re: Persisting a one-off hostname change

2012-02-27 Thread Jason Heeris
On 27 February 2012 20:50, Tom H tomh0...@gmail.com 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

Re: Persisting a one-off hostname change

2012-02-27 Thread Tom H
On Mon, Feb 27, 2012 at 8:25 AM, Jason Heeris jason.hee...@gmail.com wrote: On 27 February 2012 20:50, Tom H tomh0...@gmail.com 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

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 first

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 first

Re: Persisting a one-off hostname change

2012-02-27 Thread Jason Heeris
On 28 February 2012 00:27, Tom H tomh0...@gmail.com 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

Re: Persisting a one-off hostname change

2012-02-27 Thread Jason Heeris
On 28 February 2012 03:28, Paul E Condon pecon...@mesanetworks.net 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

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 pecon...@mesanetworks.net 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

Re: Persisting a one-off hostname change

2012-02-27 Thread Jason Heeris
On 28 February 2012 09:21, Paul E Condon pecon...@mesanetworks.net 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.

Re: Persisting a one-off hostname change

2012-02-27 Thread Tom H
On Mon, Feb 27, 2012 at 7:07 PM, Jason Heeris jason.hee...@gmail.com wrote: On 28 February 2012 00:27, Tom H tomh0...@gmail.com 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

Re: Persisting a one-off hostname change

2012-02-27 Thread Jason Heeris
On 28 February 2012 13:40, Tom H tomh0...@gmail.com 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

Persisting a one-off hostname change

2012-02-26 Thread Jason Heeris
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 first thought was that I could remove /etc/hostname