Tiny Core Linux

Tiny Core Base => TCB Talk => Topic started by: maro on March 13, 2011, 08:37:15 PM

Title: Suggestion: Allow a parameter to specify host name for sethostname()
Post by: maro on March 13, 2011, 08:37:15 PM
The following idea is a consequence of reading about a users problems (http://forum.tinycorelinux.net/index.php?topic=8866) with changing the host name:

The sethostname() function (in '/etc/init.d/tc-functions') always uses the value from the 'host=...' boot code or defaults to 'box'. I'd like to suggest a change insofar as to allow for a parameter supplied to sethostname() to overwrite this. I'd imagine that [ -z "$1" ] && HOSTNAME="$(getbootparam host 2>/dev/null)" || HOSTNAME=$1 instead of HOSTNAME="$(getbootparam host 2>/dev/null)" should achieve just that.

With this in place it would be just a matter of executing something like sudo sh -c '. /etc/init.d/tc-functions ; sethostname box2' to change the host name more easily without having to use the boot code.
Title: Re: Suggestion: Allow a parameter to specify host name for sethostname()
Post by: roberts on March 15, 2011, 07:28:27 PM
I have implemented this idea. Although in a slightly different way, Look for it starting with v3.6.