cvs commit: src/etc/rc.d hostname

Ceri Davies ceri at submonkey.net
Sat Feb 10 20:52:30 UTC 2007


On Sat, Feb 10, 2007 at 01:13:33PM +0000, Yar Tikhiy wrote:
> yar         2007-02-10 13:13:33 UTC
> 
>   FreeBSD src repository
> 
>   Modified files:
>     etc/rc.d             hostname 
>   Log:
>   Handle the case when the admin forgot to set $hostname,
>   which can happen in new installations: advise to set the
>   variable and refer to rc.conf(5).

Isn't it possible for the hostname to come via DHCP?  How does this
behave in that case (or rather, I can see how it behaves; is that the
right thing)?

> | @@ -58,7 +58,16 @@ hostname_start()
> |  		fi
> |  	fi
> |  
> | -	/bin/hostname ${hostname}
> | +	# Have we got a hostname yet?
> | +	#
> | +	if [ -z "${hostname}" ]; then
> | +		warn "\$hostname is not set -- see ${rcvar_manpage}."
> | +		return
> | +	fi
> | +
> | +	# All right, it is safe to invoke hostname(1) now.
> | +	#
> | +	/bin/hostname "${hostname}"
> |  	echo "Setting hostname: `hostname`."

Are the backticks necessary here?  Why don't we use ${hostname}?

Ceri
-- 
That must be wonderful!  I don't understand it at all.
                                                  -- Moliere
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/cvs-src/attachments/20070210/902d4a04/attachment.pgp


More information about the cvs-src mailing list