Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 May 2007 11:27:23 -0700
From:      Doug Barton <dougb@FreeBSD.org>
To:        Andrew Thompson <thompsa@freebsd.org>
Cc:        freebsd-rc@freebsd.org, "Ralf S. Engelschall" <rse@FreeBSD.org>
Subject:   Re: cvs commit: src/etc/rc.d hostid
Message-ID:  <4651E48B.5010803@FreeBSD.org>
In-Reply-To: <20070521090155.GA1063@heff.fud.org.nz>
References:  <200704110005.l3B05QcV079261@repoman.freebsd.org> <20070521090155.GA1063@heff.fud.org.nz>

next in thread | previous in thread | raw e-mail | index | archive | help
Andrew Thompson wrote:
> On Wed, Apr 11, 2007 at 12:05:26AM +0000, Pawel Jakub Dawidek wrote:
>> pjd         2007-04-11 00:05:26 UTC
>>
>>   FreeBSD src repository
>>
>>   Modified files:
>>     etc/rc.d             hostid 
>>   Log:
>>   If available, take UUID from smbios.system.uuid, if not fall back to
>>   software-generated UUID. Store the result in /etc/hostid and use it in
>>   the future. Perform simple UUID format check, as there is a lot of
>>   hardware with broken UUIDs. The check should be improved to also eliminate
>>   fake UUIDs like 00000000-0000-0000-0000-000000000000.
>>   
> 
> Here is a simple patch to check for all zeros

Even simpler would have been to just put the ID you want to test for 
in the case statement. What's the benefit of the indirection?

Doug

> Index: hostid
> ===================================================================
> RCS file: /home/ncvs/src/etc/rc.d/hostid,v
> retrieving revision 1.3
> diff -u -p -r1.3 hostid
> --- hostid	21 May 2007 08:22:43 -0000	1.3
> +++ hostid	21 May 2007 08:56:56 -0000
> @@ -59,7 +59,11 @@ hostid_hardware()
>  	uuid=`kenv smbios.system.uuid 2>/dev/null | tr '[:upper:]' '[:lower:]'`
>  	x="[0-9a-f]"
>  	y=$x$x$x$x
> +	z="0000"
>  	case "${uuid}" in
> +	$z$z-$z-$z-$z-$z$z$z)
> +		# the bios returned all zeros
> +		;;
>  	$y$y-$y-$y-$y-$y$y$y)
>  		echo "${uuid}"
>  		;;
> _______________________________________________
> freebsd-rc@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-rc
> To unsubscribe, send any mail to "freebsd-rc-unsubscribe@freebsd.org"
> 


-- 

     This .signature sanitized for your protection




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4651E48B.5010803>