head	1.15;
access;
symbols
	RELENG_8_4:1.15.0.2
	RELENG_9_1_0_RELEASE:1.14.2.1.4.2
	RELENG_9_1:1.14.2.1.0.4
	RELENG_9_1_BP:1.14.2.1
	RELENG_8_3_0_RELEASE:1.11.2.3.2.1
	RELENG_8_3:1.11.2.3.0.2
	RELENG_8_3_BP:1.11.2.3
	RELENG_9_0_0_RELEASE:1.14.2.1.2.1
	RELENG_9_0:1.14.2.1.0.2
	RELENG_9_0_BP:1.14.2.1
	RELENG_9:1.14.0.2
	RELENG_9_BP:1.14
	RELENG_7_4_0_RELEASE:1.7.2.1.8.1
	RELENG_8_2_0_RELEASE:1.11.2.2.6.1
	RELENG_7_4:1.7.2.1.0.8
	RELENG_7_4_BP:1.7.2.1
	RELENG_8_2:1.11.2.2.0.6
	RELENG_8_2_BP:1.11.2.2
	RELENG_8_1_0_RELEASE:1.11.2.2.4.1
	RELENG_8_1:1.11.2.2.0.4
	RELENG_8_1_BP:1.11.2.2
	RELENG_7_3_0_RELEASE:1.7.2.1.6.1
	RELENG_7_3:1.7.2.1.0.6
	RELENG_7_3_BP:1.7.2.1
	RELENG_8_0_0_RELEASE:1.11.2.2.2.1
	RELENG_8_0:1.11.2.2.0.2
	RELENG_8_0_BP:1.11.2.2
	RELENG_8:1.11.0.2
	RELENG_8_BP:1.11
	RELENG_7_2_0_RELEASE:1.7.2.1.4.1
	RELENG_7_2:1.7.2.1.0.4
	RELENG_7_2_BP:1.7.2.1
	RELENG_7_1_0_RELEASE:1.7.2.1.2.1
	RELENG_7_1:1.7.2.1.0.2
	RELENG_7_1_BP:1.7.2.1
	RELENG_7_0_0_RELEASE:1.7
	RELENG_7_0:1.7.0.4
	RELENG_7_0_BP:1.7
	RELENG_7:1.7.0.2
	RELENG_7_BP:1.7;
locks; strict;
comment	@# @;


1.15
date	2012.11.17.01.49.04;	author svnexp;	state Exp;
branches
	1.15.2.1;
next	1.14;

1.14
date	2011.03.30.01.19.00;	author emaste;	state Exp;
branches
	1.14.2.1;
next	1.13;

1.13
date	2010.05.19.19.03.19;	author dougb;	state Exp;
branches;
next	1.12;

1.12
date	2009.10.10.22.17.03;	author dougb;	state Exp;
branches;
next	1.11;

1.11
date	2009.07.29.05.23.52;	author pjd;	state Exp;
branches
	1.11.2.1;
next	1.10;

1.10
date	2008.06.23.04.46.54;	author mtm;	state Exp;
branches;
next	1.9;

1.9
date	2008.05.06.10.40.20;	author mtm;	state Exp;
branches;
next	1.8;

1.8
date	2008.01.24.07.04.12;	author ru;	state Exp;
branches;
next	1.7;

1.7
date	2007.05.22.13.53.59;	author rse;	state Exp;
branches
	1.7.2.1;
next	1.6;

1.6
date	2007.05.22.10.22.24;	author rse;	state Exp;
branches;
next	1.5;

1.5
date	2007.05.21.11.57.01;	author rse;	state Exp;
branches;
next	1.4;

1.4
date	2007.05.21.11.44.13;	author rse;	state Exp;
branches;
next	1.3;

1.3
date	2007.05.21.08.22.43;	author rse;	state Exp;
branches;
next	1.2;

1.2
date	2007.04.11.00.05.25;	author pjd;	state Exp;
branches;
next	1.1;

1.1
date	2007.04.09.19.21.27;	author pjd;	state Exp;
branches;
next	;

1.15.2.1
date	2012.11.17.01.49.04;	author svnexp;	state dead;
branches;
next	1.15.2.2;

1.15.2.2
date	2013.03.28.13.02.43;	author svnexp;	state Exp;
branches;
next	;

1.14.2.1
date	2011.09.23.00.51.37;	author kensmith;	state Exp;
branches
	1.14.2.1.2.1
	1.14.2.1.4.1;
next	1.14.2.2;

1.14.2.2
date	2012.11.17.11.36.11;	author svnexp;	state Exp;
branches;
next	;

1.14.2.1.2.1
date	2011.11.11.04.20.22;	author kensmith;	state Exp;
branches;
next	1.14.2.1.2.2;

1.14.2.1.2.2
date	2012.11.17.08.36.11;	author svnexp;	state Exp;
branches;
next	;

1.14.2.1.4.1
date	2012.08.05.23.54.33;	author kensmith;	state Exp;
branches;
next	1.14.2.1.4.2;

1.14.2.1.4.2
date	2012.11.17.08.47.01;	author svnexp;	state Exp;
branches;
next	;

1.11.2.1
date	2009.08.03.08.13.06;	author kensmith;	state Exp;
branches;
next	1.11.2.2;

1.11.2.2
date	2009.10.16.00.17.09;	author dougb;	state Exp;
branches
	1.11.2.2.2.1
	1.11.2.2.4.1
	1.11.2.2.6.1;
next	1.11.2.3;

1.11.2.3
date	2012.02.10.10.18.30;	author dougb;	state Exp;
branches
	1.11.2.3.2.1;
next	1.11.2.4;

1.11.2.4
date	2012.11.17.10.35.56;	author svnexp;	state Exp;
branches;
next	;

1.11.2.2.2.1
date	2009.10.25.01.10.29;	author kensmith;	state Exp;
branches;
next	;

1.11.2.2.4.1
date	2010.06.14.02.09.06;	author kensmith;	state Exp;
branches;
next	;

1.11.2.2.6.1
date	2010.12.21.17.09.25;	author kensmith;	state Exp;
branches;
next	;

1.11.2.3.2.1
date	2012.03.03.06.15.13;	author kensmith;	state Exp;
branches;
next	1.11.2.3.2.2;

1.11.2.3.2.2
date	2012.11.17.08.24.38;	author svnexp;	state Exp;
branches;
next	;

1.7.2.1
date	2008.05.20.15.27.24;	author mtm;	state Exp;
branches
	1.7.2.1.2.1
	1.7.2.1.4.1
	1.7.2.1.6.1
	1.7.2.1.8.1;
next	1.7.2.2;

1.7.2.2
date	2012.11.17.08.01.20;	author svnexp;	state Exp;
branches;
next	;

1.7.2.1.2.1
date	2008.11.25.02.59.29;	author kensmith;	state Exp;
branches;
next	;

1.7.2.1.4.1
date	2009.04.15.03.14.26;	author kensmith;	state Exp;
branches;
next	;

1.7.2.1.6.1
date	2010.02.10.00.26.20;	author kensmith;	state Exp;
branches;
next	;

1.7.2.1.8.1
date	2010.12.21.17.10.29;	author kensmith;	state Exp;
branches;
next	1.7.2.1.8.2;

1.7.2.1.8.2
date	2012.11.17.08.16.37;	author svnexp;	state Exp;
branches;
next	;


desc
@@


1.15
log
@Switching exporter and resync
@
text
@#!/bin/sh
#
# Copyright (c) 2007 Pawel Jakub Dawidek <pjd@@FreeBSD.org>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD: head/etc/rc.d/hostid 220153 2011-03-30 01:19:00Z emaste $
#

# PROVIDE: hostid
# REQUIRE: sysctl
# KEYWORD: nojail

. /etc/rc.subr

name="hostid"
start_cmd="hostid_start"
stop_cmd=":"
reset_cmd="hostid_reset"
extra_commands="reset"
rcvar="hostid_enable"

hostid_set()
{
	uuid=$1
	# Generate hostid based on hostuuid - take first four bytes from md5(uuid).
	id=`echo -n $uuid | /sbin/md5`
	id="0x${id%????????????????????????}"

	# Set both kern.hostuuid and kern.hostid.
	#
	check_startmsgs && echo "Setting hostuuid: ${uuid}."
	${SYSCTL} kern.hostuuid="${uuid}" >/dev/null
	check_startmsgs && echo "Setting hostid: ${id}."
	${SYSCTL} kern.hostid=${id} >/dev/null
}

hostid_hardware()
{
	uuid=`kenv -q smbios.system.uuid`
	x="[0-9a-f]"
	y=$x$x$x$x
	case "${uuid}" in
	$y$y-$y-$y-$y-$y$y$y)
		echo "${uuid}"
		;;
	esac
}

hostid_generate()
{
	# First look for UUID in hardware.
	uuid=`hostid_hardware`
	if [ -z ${uuid} ]; then
		# If not found, fall back to software-generated UUID.
		uuid=`uuidgen`
	fi
	hostid_set $uuid
}

hostid_reset()
{
	hostid_generate
	# Store newly generated UUID in ${hostid_file}.
	echo $uuid > ${hostid_file}
	if [ $? -ne 0 ]; then
		warn "could not store hostuuid in ${hostid_file}."
	fi
}

hostid_start()
{
	# If ${hostid_file} already exists, we take UUID from there.
	if [ -r ${hostid_file} ]; then
		hostid_set `cat ${hostid_file}`
	else
		# No hostid file, generate UUID.
		hostid_generate
	fi
}

load_rc_config $name
run_rc_command "$1"
@


1.15.2.1
log
@file hostid was added on branch RELENG_8_4 on 2013-03-28 13:02:43 +0000
@
text
@d1 103
@


1.15.2.2
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/248810
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@a0 103
#!/bin/sh
#
# Copyright (c) 2007 Pawel Jakub Dawidek <pjd@@FreeBSD.org>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD: releng/8.4/etc/rc.d/hostid 231372 2012-02-10 10:18:30Z dougb $
#

# PROVIDE: hostid
# REQUIRE: sysctl
# KEYWORD: nojail

. /etc/rc.subr

name="hostid"
start_cmd="hostid_start"
stop_cmd=":"
reset_cmd="hostid_reset"
extra_commands="reset"
rcvar="hostid_enable"

hostid_set()
{
	uuid=$1
	# Generate hostid based on hostuuid - take first four bytes from md5(uuid).
	id=`echo -n $uuid | /sbin/md5`
	id="0x${id%????????????????????????}"

	# Set both kern.hostuuid and kern.hostid.
	#
	check_startmsgs && echo "Setting hostuuid: ${uuid}."
	${SYSCTL_W} kern.hostuuid="${uuid}" >/dev/null
	check_startmsgs && echo "Setting hostid: ${id}."
	${SYSCTL_W} kern.hostid=${id} >/dev/null
}

hostid_hardware()
{
	uuid=`kenv -q smbios.system.uuid`
	x="[0-9a-f]"
	y=$x$x$x$x
	case "${uuid}" in
	$y$y-$y-$y-$y-$y$y$y)
		echo "${uuid}"
		;;
	esac
}

hostid_generate()
{
	# First look for UUID in hardware.
	uuid=`hostid_hardware`
	if [ -z ${uuid} ]; then
		# If not found, fall back to software-generated UUID.
		uuid=`uuidgen`
	fi
	hostid_set $uuid
}

hostid_reset()
{
	hostid_generate
	# Store newly generated UUID in ${hostid_file}.
	echo $uuid > ${hostid_file}
	if [ $? -ne 0 ]; then
		warn "could not store hostuuid in ${hostid_file}."
	fi
}

hostid_start()
{
	# If ${hostid_file} already exists, we take UUID from there.
	if [ -r ${hostid_file} ]; then
		hostid_set `cat ${hostid_file}`
	else
		# No hostid file, generate UUID.
		hostid_generate
	fi
}

load_rc_config $name
run_rc_command "$1"
@


1.14
log
@SVN rev 220153 on 2011-03-30 01:19:00Z by emaste

Replace ${SYSCTL_W} with ${SYSCTL} in rc.d scripts, as they are identical.
This is a further clean up after r202988.

SYSCTL_W is still initialized in rc.subr as some ports may still use it.
@
text
@d27 1
a27 1
# $FreeBSD$
@


1.14.2.1
log
@SVN rev 225736 on 2011-09-23 00:51:37Z by kensmith

Copy head to stable/9 as part of 9.0-RELEASE release cycle.

Approved by:	re (implicit)
@
text
@@


1.14.2.2
log
@## SVN ##
## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/ 242902
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ## r242902 | dteske | 2012-11-11 23:29:45 +0000 (Sun, 11 Nov 2012) | 10 lines
## SVN ##
## SVN ## Fix a regression introduced by SVN r211417 that saw the breakage of a feature
## SVN ## documented in usr.sbin/sysinstall/help/shortcuts.hlp (reproduced below):
## SVN ##
## SVN ## If /usr/sbin/sysinstall is linked to another filename, say
## SVN ## `/usr/local/bin/configPackages', then the basename will be used
## SVN ## as an implicit command name.
## SVN ##
## SVN ## Reviewed by:	adrian (co-mentor)
## SVN ## Approved by:	adrian (co-mentor)
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ##
@
text
@d27 1
a27 1
# $FreeBSD: stable/9/etc/rc.d/hostid 220153 2011-03-30 01:19:00Z emaste $
@


1.14.2.1.4.1
log
@SVN rev 239080 on 2012-08-05 23:54:33Z by kensmith

Copy stable/9 to releng/9.1 as part of the 9.1-RELEASE release process.

Approved by:	re (implicit)
@
text
@@


1.14.2.1.4.2
log
@Switch importer
@
text
@d27 1
a27 1
# $FreeBSD: releng/9.1/etc/rc.d/hostid 220153 2011-03-30 01:19:00Z emaste $
@


1.14.2.1.2.1
log
@SVN rev 227445 on 2011-11-11 04:20:22Z by kensmith

Copy stable/9 to releng/9.0 as part of the FreeBSD 9.0-RELEASE release
cycle.

Approved by:	re (implicit)
@
text
@@


1.14.2.1.2.2
log
@Switch importer
@
text
@d27 1
a27 1
# $FreeBSD: releng/9.0/etc/rc.d/hostid 220153 2011-03-30 01:19:00Z emaste $
@


1.13
log
@SVN rev 208307 on 2010-05-19 19:03:19Z by dougb

This change does the following for the scripts that run up through
FILESYSTEMS (the default early_late_divider):
1. Move sysctl to run first
2. Move as many BEFOREs to REQUIREs as possible.
3. Minor effect, move hostid_save from right before mdconfig to right
   after.

A lot of the early scripts make use of sysctl one way or another so
running this first makes a lot of sense given that system-critical
values are often placed in sysctl.conf.

My original purpose for working on this was that while doing some
debugging on other stuff I noticed that the order of execution was
different in the first pass through the early scripts and the second.
In practice that doesn't matter because the scripts are not executed the
second time. However this _can_ result in problems if the difference in
the rcorder moves a script from the late section to the early section in
the second pass (which would mean the script would not get executed).
So, I wanted to make the order of execution of the scripts in the early
section more deterministic.

In the course of debugging the ordering problems I noticed that moving
the BEFOREs to REQUIREs prevented the changes in order from the first
pass to the second pass without having to make any substantial changes.
(Of course it's no secret that I think BEFORE should be avoided as much
as possible, but this is a good example of why.)

Reviewed by:	silence on freebsd-rc@@
MFC after:	8.1-RELEASE
@
text
@d53 1
a53 1
	${SYSCTL_W} kern.hostuuid="${uuid}" >/dev/null
d55 1
a55 1
	${SYSCTL_W} kern.hostid=${id} >/dev/null
@


1.12
log
@SVN rev 197947 on 2009-10-10 22:17:03Z by dougb

In regards to the "Starting foo:" type messages at boot time, create and
employ a more generic solution, and use it in the individual rc.d scripts
that also have an $rc_quiet test:

1. Add check_startmsgs() to rc.subr.
2. In the rc.d scripts that use rc_quiet (and rc.subr) substitute
variations of [ -z "$rc_quiet" ] with check_startmsgs
3. In savecore add a trailing '.' to the end of the message to make it
more consistent with other scripts.
4. In newsyslog remove a : before the terminal '.' since we do not expect
there to be anything printed out in between to make it more consistent.
5. In the following scripts change "quotes" to 'quotes' where no variables
exist in the message: savecore pf newsyslog
6. In the following scripts substitute if/then/fi for the simpler (and
more consistent) check_startmsgs &&: faith stf
7. In the following scripts separate the "Starting foo:" from the terminal
'.' to make them more consistent: moused hostname pf
8. In nfsclient move the message to its own line to avoid a style bug
9. In pf rc_quiet does not apply to the _stop method, so remove the
test there.
10. In motd add 'quotes' around the terminal '.' for consistency
@
text
@d31 1
a31 1
# BEFORE: fsck
@


1.11
log
@SVN rev 195938 on 2009-07-29 05:23:52Z by pjd

Currently there is a problem with fscking UFS file systems created on
top of ZVOLs. The problem is that rc.d/fsck runs before rc.d/zfs. The
latter makes ZVOLs to appear in /dev/. In such case rc.d/fsck cannot
find devfs entry and aborts. We cannot simply move rc.d/zfs before
rc.d/fsck, because we first want kern.hostid to be configured (by
rc.d/hostid). If we won't wait (hostid will be 0) we can reuse disks
which are in use by different systems (eg. in SAN/NAS environment).
We also cannot move rc.d/hostid before rc.d/fsck, because rc.d/hostid on
first system start stores generated kern.hostuuid in /etc/hostid file,
so it needs root file system to be mounted read-write.

The fix is to split rc.d/hostid so that rc.d/hostid (which will now run
before rc.d/fsck) only generates hostid and sets up sysctls, but doesn't
touch root file system and rc.d/hostid_save (which is run after
rc.d/root) and only creates /etc/hostid file.

With that in place, we can move ZVOL initialization to dedicated
rc.d/zvol script which runs before rc.d/fsck.

PR:		conf/120194
Reported by:	James Snow <snow@@teardrop.org>
Reviewed by:	brooks
Approved by:	re (kib)
MFC after:	2 weeks
@
text
@d52 1
a52 1
	[ -z "${rc_quiet}" ] && echo "Setting hostuuid: ${uuid}."
d54 1
a54 1
	[ -z "${rc_quiet}" ] && echo "Setting hostid: ${id}."
@


1.11.2.1
log
@SVN rev 196045 on 2009-08-03 08:13:06Z by kensmith

Copy head to stable/8 as part of 8.0 Release cycle.

Approved by:	re (Implicit)
@
text
@@


1.11.2.2
log
@SVN rev 198164 on 2009-10-16 00:17:09Z by dougb

MFC r197947:

In regards to the "Starting foo:" type messages at boot time, create
and employ a more generic solution, and use it in the individual rc.d
scripts that also have an $rc_quiet test:

1. Add check_startmsgs() to rc.subr.
2. In the rc.d scripts that use rc_quiet (and rc.subr) substitute
variations of [ -z "$rc_quiet" ] with check_startmsgs
3. In savecore add a trailing '.' to the end of the message to make it
more consistent with other scripts.
4. In newsyslog remove a : before the terminal '.' since we do not
expect there to be anything printed out in between to make it more
consistent.
5. In the following scripts change "quotes" to 'quotes' where no
variables exist in the message: savecore pf newsyslog
6. [Does not apply in RELENG_8]
7. In the following scripts separate the "Starting foo:" from the
terminal '.' to make them more consistent: moused hostname pf
8. In nfsclient move the message to its own line to avoid a style bug
9. In pf rc_quiet does not apply to the _stop method, so remove the
test there.
10. In motd add 'quotes' around the terminal '.' for consistency

Approved by:	re (kib)
@
text
@d52 1
a52 1
	check_startmsgs && echo "Setting hostuuid: ${uuid}."
d54 1
a54 1
	check_startmsgs && echo "Setting hostid: ${id}."
@


1.11.2.3
log
@SVN rev 231372 on 2012-02-10 10:18:30Z by dougb

MFC r208307:

This change does the following for the scripts that run up through
FILESYSTEMS (the default early_late_divider):
1. Move sysctl to run first
2. Move as many BEFOREs to REQUIREs as possible.
3. Minor effect, move hostid_save from right before mdconfig to right
   after.

A lot of the early scripts make use of sysctl one way or another so
running this first makes a lot of sense given that system-critical
values are often placed in sysctl.conf. (More details in original log.)

In addition to the changes from this revision, tweak a few other rcorder
elements in order to minimize the differences between the order before
and after this change, mostly related to scripts still in this branch
that are no longer in HEAD.
@
text
@d31 1
a31 1
# REQUIRE: sysctl
@


1.11.2.4
log
@## SVN ##
## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/ 242909
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ## r242909 | dim | 2012-11-12 07:47:19 +0000 (Mon, 12 Nov 2012) | 20 lines
## SVN ##
## SVN ## MFC r242625:
## SVN ##
## SVN ## Remove duplicate const specifiers in many drivers (I hope I got all of
## SVN ## them, please let me know if not).  Most of these are of the form:
## SVN ##
## SVN ## static const struct bzzt_type {
## SVN ##       [...list of members...]
## SVN ## } const bzzt_devs[] = {
## SVN ##       [...list of initializers...]
## SVN ## };
## SVN ##
## SVN ## The second const is unnecessary, as arrays cannot be modified anyway,
## SVN ## and if the elements are const, the whole thing is const automatically
## SVN ## (e.g. it is placed in .rodata).
## SVN ##
## SVN ## I have verified this does not change the binary output of a full kernel
## SVN ## build (except for build timestamps embedded in the object files).
## SVN ##
## SVN ## Reviewed by:	yongari, marius
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ##
@
text
@d27 1
a27 1
# $FreeBSD: stable/8/etc/rc.d/hostid 231372 2012-02-10 10:18:30Z dougb $
@


1.11.2.3.2.1
log
@SVN rev 232438 on 2012-03-03 06:15:13Z by kensmith

Copy stable/8 to releng/8.3 as part of 8.3-RELEASE release cycle.

Approved by:	re (implicit)
@
text
@@


1.11.2.3.2.2
log
@Switch importer
@
text
@d27 1
a27 1
# $FreeBSD: releng/8.3/etc/rc.d/hostid 231372 2012-02-10 10:18:30Z dougb $
@


1.11.2.2.6.1
log
@SVN rev 216617 on 2010-12-21 17:09:25Z by kensmith

Copy stable/8 to releng/8.2 in preparation for FreeBSD-8.2 release.

Approved by:	re (implicit)
@
text
@@


1.11.2.2.4.1
log
@SVN rev 209145 on 2010-06-14 02:09:06Z by kensmith

Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.

Approved by:	re (implicit)
@
text
@@


1.11.2.2.2.1
log
@SVN rev 198460 on 2009-10-25 01:10:29Z by kensmith

Copy stable/8 to releng/8.0 as part of 8.0-RELEASE release procedure.

Approved by:	re (implicit)
@
text
@@


1.10
log
@SVN rev 179945 on 2008-06-23 04:46:54Z by mtm

Move a lot of diagnostic output behind $rc_quiet in scripts that
implement their own start command.
@
text
@d31 1
a31 2
# REQUIRE: root
# BEFORE: mountcritlocal
d70 1
a70 1
hostid_reset()
d78 6
a88 1
	hostid_set $uuid
d98 1
a98 1
		hostid_reset
@


1.9
log
@Specify the full path to the md5(1) binary so the script will
still work even if it's not in the shell's path.

PR: conf/122215
MFC after: 1 week
@
text
@d50 1
d52 2
a53 1
	echo "Setting hostuuid: ${uuid}."
d55 1
a55 1
	echo "Setting hostid: ${id}."
@


1.8
log
@Shorter equivalent of the command.
@
text
@d48 1
a48 1
	id=`echo -n $uuid | md5`
@


1.7
log
@backout filter of Nil UUID as the boot loader code already filters out Nil UUIDs (see src/sys/boot/i386/libi386/smbios.c:smbios_setuuid for details)
@
text
@d59 1
a59 1
	uuid=`kenv smbios.system.uuid 2>/dev/null`
@


1.7.2.1
log
@MFC:
	Specify the full path to the md5(1) binary so the script will
	still work even if it's not in the shell's path.
	PR: conf/122215
@
text
@d48 1
a48 1
	id=`echo -n $uuid | /sbin/md5`
@


1.7.2.2
log
@Switch importer
@
text
@d27 1
a27 1
# $FreeBSD: stable/7/etc/rc.d/hostid 220110 2011-03-28 19:29:30Z dougb $
@


1.7.2.1.8.1
log
@SVN rev 216618 on 2010-12-21 17:10:29Z by kensmith

Copy stable/7 to releng/7.4 in preparation for FreeBSD-7.4 release.

Approved by:	re (implicit)
@
text
@@


1.7.2.1.8.2
log
@Switch importer
@
text
@d27 1
a27 1
# $FreeBSD: releng/7.4/etc/rc.d/hostid 179158 2008-05-20 15:27:24Z mtm $
@


1.7.2.1.6.1
log
@SVN rev 203736 on 2010-02-10 00:26:20Z by kensmith

Copy stable/7 to releng/7.3 as part of the 7.3-RELEASE process.

Approved by:	re (implicit)
@
text
@@


1.7.2.1.4.1
log
@SVN rev 191087 on 2009-04-15 03:14:26Z by kensmith

Create releng/7.2 from stable/7 in preparation for 7.2-RELEASE.

Approved by:	re (implicit)
@
text
@@


1.7.2.1.2.1
log
@SVN rev 185281 on 2008-11-25 02:59:29Z by kensmith

Create releng/7.1 in preparation for moving into RC phase of 7.1 release
cycle.

Approved by:	re (implicit)
@
text
@@


1.6
log
@Remove the ugly csh(1) based UUID lower-case translation hack from
/etc/rc.d/hostid now that we switched the origin of the UUID (variable
smbios.system.uuid as provided by the i386 BIOS code) to already provide
a standard conforming lower-case UUID text representation.
@
text
@a61 1
	z="0000"
a62 3
	$z$z-$z-$z-$z-$z$z$z)
		# Filter the special "Nil" UUID
		;;
@


1.5
log
@Cleanup style by consistently using braces around variable expansion and
apply an addition from Andrew Thompson <thompsa> for filtering out the
special "Nil" UUID (all zeros) which would be a useless host UUID.
@
text
@a59 1
	uuid=`csh -c 'echo -n ${*:al}' "${uuid}"`
@


1.4
log
@Adjust UUID lower-case translation from straight-forward tr(1)
usage to an equivalent csh(1) usage as tr(1) stays in /usr/bin and
/etc/rc.d/hostid has just the root filesystem (and this way mainly the
tools in /bin) available.

I've chosen csh(1) here as the string manipulation tools available in
/bin is extremely limited and the (only) alternative ed(1) usage would
have been a lot more complicated or even might require a temporary file.
@
text
@d60 1
a60 1
	uuid=`csh -c 'echo -n ${*:al}' "$uuid"`
d63 1
d65 3
@


1.3
log
@The standardized textual representation of UUIDs according to RFC 4122
and ISO/IEC-9834-8:2005 is with LOWER-CASE hexadecimal characters only,
so translate the (usually upper-case and this way not conforming)
representation of the BIOS UUID when reading it. Also be more strict
about the valid characters in the textual representation by checking for
just the hexadecimal characters.
@
text
@d59 2
a60 1
	uuid=`kenv smbios.system.uuid 2>/dev/null | tr '[:upper:]' '[:lower:]'`
@


1.2
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.

Requested by:	many
@
text
@d59 2
a60 2
	uuid=`kenv smbios.system.uuid 2>/dev/null`
	x="[0-9a-zA-Z]"
@


1.1
log
@Add rc.d/hostid script (turned on by default) which on first boot generates
UUID and stores it in /etc/hostid ($hostid_file) as well as sets kern.hostuuid
and kern.hostid sysctls on every boot.

Hostid can be reset using '/etc/rc.d/hostid reset' command.

Hostid generation and setting can be turned off by setting variable
hostid_enable to "NO" in /etc/rc.conf.

Reviewed by:	mlaier, rink, brooks, rwatson
@
text
@d57 12
d71 6
a76 1
	uuid=`uuidgen`
@

