cvs commit: src/etc/rc.d hostid

Doug Barton dougb at FreeBSD.org
Mon May 21 18:27:26 UTC 2007


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 at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-rc
> To unsubscribe, send any mail to "freebsd-rc-unsubscribe at freebsd.org"
> 


-- 

     This .signature sanitized for your protection



More information about the freebsd-rc mailing list