From owner-cvs-src@FreeBSD.ORG Mon Feb 12 03:44:58 2007 Return-Path: X-Original-To: cvs-src@FreeBSD.org Delivered-To: cvs-src@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7668D16A407; Mon, 12 Feb 2007 03:44:58 +0000 (UTC) (envelope-from brooks@lor.one-eyed-alien.net) Received: from lor.one-eyed-alien.net (grnl-static-02-0046.dsl.iowatelecom.net [69.66.56.110]) by mx1.freebsd.org (Postfix) with ESMTP id 1A16613C4A8; Mon, 12 Feb 2007 03:44:58 +0000 (UTC) (envelope-from brooks@lor.one-eyed-alien.net) Received: from lor.one-eyed-alien.net (localhost [127.0.0.1]) by lor.one-eyed-alien.net (8.13.8/8.13.8) with ESMTP id l1C3idCC042464; Sun, 11 Feb 2007 21:44:39 -0600 (CST) (envelope-from brooks@lor.one-eyed-alien.net) Received: (from brooks@localhost) by lor.one-eyed-alien.net (8.13.8/8.13.8/Submit) id l1C3icDv042463; Sun, 11 Feb 2007 21:44:38 -0600 (CST) (envelope-from brooks) Date: Sun, 11 Feb 2007 21:44:38 -0600 From: Brooks Davis To: Yar Tikhiy Message-ID: <20070212034438.GA42410@lor.one-eyed-alien.net> References: <200702101313.l1ADDX8m056868@repoman.freebsd.org> <20070210205228.GE9455@submonkey.net> <20070211085317.GF13808@comp.chem.msu.su> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="IJpNTDwzlM2Ie8A6" Content-Disposition: inline In-Reply-To: <20070211085317.GF13808@comp.chem.msu.su> User-Agent: Mutt/1.5.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0 (lor.one-eyed-alien.net [127.0.0.1]); Sun, 11 Feb 2007 21:44:40 -0600 (CST) Cc: cvs-src@FreeBSD.org, Ceri Davies , cvs-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: cvs commit: src/etc/rc.d hostname X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Feb 2007 03:44:58 -0000 --IJpNTDwzlM2Ie8A6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Feb 11, 2007 at 11:53:17AM +0300, Yar Tikhiy wrote: > 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 > > >=20 > > > FreeBSD src repository > > >=20 > > > Modified files: > > > etc/rc.d hostname=20 > > > 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). > >=20 > > 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)? >=20 > 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. This appears mostly harmless for systems that get their hostname via DHCP. They will get a warning, but it will otherwise work. -- Brooks > > > | @@ -58,7 +58,16 @@ hostname_start() > > > | fi > > > | fi > > > | =20 > > > | - /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`." > >=20 > > Are the backticks necessary here? Why don't we use ${hostname}? >=20 > Thus we determine what name has actually been set. Our doing so > reeks of paranoia, of course. :-) Perhaps a better ordering would > be: >=20 > echo "Setting hostname: ${hostname}." > /bin/hostname "${hostname}" >=20 > So possible error messages will follow the introductory statement, > which makes more sense. Any objecttions? >=20 > --=20 > Yar >=20 --IJpNTDwzlM2Ie8A6 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (FreeBSD) iD8DBQFFz+KlXY6L6fI4GtQRAm3IAKCg400PLjfucaTwbVbfo5cN4hUuGQCbBwOA DME1uPbkxggZXBrSXRaEbhc= =GLEQ -----END PGP SIGNATURE----- --IJpNTDwzlM2Ie8A6--