From owner-cvs-all@FreeBSD.ORG Sun Feb 11 09:06:56 2007 Return-Path: X-Original-To: cvs-all@freebsd.org Delivered-To: cvs-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4986116A400; Sun, 11 Feb 2007 09:06:56 +0000 (UTC) (envelope-from yar@comp.chem.msu.su) Received: from comp.chem.msu.su (comp.chem.msu.su [158.250.32.97]) by mx1.freebsd.org (Postfix) with ESMTP id 4715E13C467; Sun, 11 Feb 2007 09:06:55 +0000 (UTC) (envelope-from yar@comp.chem.msu.su) Received: from comp.chem.msu.su (localhost [127.0.0.1]) by comp.chem.msu.su (8.13.4/8.13.3) with ESMTP id l1B8rIUI015096; Sun, 11 Feb 2007 11:53:18 +0300 (MSK) (envelope-from yar@comp.chem.msu.su) Received: (from yar@localhost) by comp.chem.msu.su (8.13.4/8.13.3/Submit) id l1B8rIWP015091; Sun, 11 Feb 2007 11:53:18 +0300 (MSK) (envelope-from yar) Date: Sun, 11 Feb 2007 11:53:17 +0300 From: Yar Tikhiy To: Ceri Davies Message-ID: <20070211085317.GF13808@comp.chem.msu.su> References: <200702101313.l1ADDX8m056868@repoman.freebsd.org> <20070210205228.GE9455@submonkey.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070210205228.GE9455@submonkey.net> User-Agent: Mutt/1.5.9i Cc: cvs-src@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org Subject: Re: cvs commit: src/etc/rc.d hostname X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Feb 2007 09:06:56 -0000 On Sat, Feb 10, 2007 at 08:52:28PM +0000, Ceri Davies wrote: > 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)? I've never played with setting the hostname via DHCP. In my change, I just tried not to break the existing code related to DHCP. Perhaps someone using DHCP to get the hostname could shed light on the topic. > > | @@ -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}? Thus we determine what name has actually been set. Our doing so reeks of paranoia, of course. :-) Perhaps a better ordering would be: echo "Setting hostname: ${hostname}." /bin/hostname "${hostname}" So possible error messages will follow the introductory statement, which makes more sense. Any objecttions? -- Yar