Deleted Added
full compact
hostid (195938) hostid (197947)
1#!/bin/sh
2#
3# Copyright (c) 2007 Pawel Jakub Dawidek <pjd@FreeBSD.org>
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:

--- 10 unchanged lines hidden (view full) ---

19# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25# SUCH DAMAGE.
26#
1#!/bin/sh
2#
3# Copyright (c) 2007 Pawel Jakub Dawidek <pjd@FreeBSD.org>
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:

--- 10 unchanged lines hidden (view full) ---

19# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25# SUCH DAMAGE.
26#
27# $FreeBSD: head/etc/rc.d/hostid 195938 2009-07-29 05:23:52Z pjd $
27# $FreeBSD: head/etc/rc.d/hostid 197947 2009-10-10 22:17:03Z dougb $
28#
29
30# PROVIDE: hostid
31# BEFORE: fsck
32# KEYWORD: nojail
33
34. /etc/rc.subr
35

--- 8 unchanged lines hidden (view full) ---

44{
45 uuid=$1
46 # Generate hostid based on hostuuid - take first four bytes from md5(uuid).
47 id=`echo -n $uuid | /sbin/md5`
48 id="0x${id%????????????????????????}"
49
50 # Set both kern.hostuuid and kern.hostid.
51 #
28#
29
30# PROVIDE: hostid
31# BEFORE: fsck
32# KEYWORD: nojail
33
34. /etc/rc.subr
35

--- 8 unchanged lines hidden (view full) ---

44{
45 uuid=$1
46 # Generate hostid based on hostuuid - take first four bytes from md5(uuid).
47 id=`echo -n $uuid | /sbin/md5`
48 id="0x${id%????????????????????????}"
49
50 # Set both kern.hostuuid and kern.hostid.
51 #
52 [ -z "${rc_quiet}" ] && echo "Setting hostuuid: ${uuid}."
52 check_startmsgs && echo "Setting hostuuid: ${uuid}."
53 ${SYSCTL_W} kern.hostuuid="${uuid}" >/dev/null
53 ${SYSCTL_W} kern.hostuuid="${uuid}" >/dev/null
54 [ -z "${rc_quiet}" ] && echo "Setting hostid: ${id}."
54 check_startmsgs && echo "Setting hostid: ${id}."
55 ${SYSCTL_W} kern.hostid=${id} >/dev/null
56}
57
58hostid_hardware()
59{
60 uuid=`kenv -q smbios.system.uuid`
61 x="[0-9a-f]"
62 y=$x$x$x$x

--- 41 unchanged lines hidden ---
55 ${SYSCTL_W} kern.hostid=${id} >/dev/null
56}
57
58hostid_hardware()
59{
60 uuid=`kenv -q smbios.system.uuid`
61 x="[0-9a-f]"
62 y=$x$x$x$x

--- 41 unchanged lines hidden ---