hostid (208307) | hostid (220153) |
---|---|
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 208307 2010-05-19 19:03:19Z dougb $ | 27# $FreeBSD: head/etc/rc.d/hostid 220153 2011-03-30 01:19:00Z emaste $ |
28# 29 30# PROVIDE: hostid 31# REQUIRE: sysctl 32# KEYWORD: nojail 33 34. /etc/rc.subr 35 --- 9 unchanged lines hidden (view full) --- 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 check_startmsgs && echo "Setting hostuuid: ${uuid}." | 28# 29 30# PROVIDE: hostid 31# REQUIRE: sysctl 32# KEYWORD: nojail 33 34. /etc/rc.subr 35 --- 9 unchanged lines hidden (view full) --- 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 check_startmsgs && echo "Setting hostuuid: ${uuid}." |
53 ${SYSCTL_W} kern.hostuuid="${uuid}" >/dev/null | 53 ${SYSCTL} kern.hostuuid="${uuid}" >/dev/null |
54 check_startmsgs && echo "Setting hostid: ${id}." | 54 check_startmsgs && echo "Setting hostid: ${id}." |
55 ${SYSCTL_W} kern.hostid=${id} >/dev/null | 55 ${SYSCTL} 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 63 case "${uuid}" in --- 40 unchanged lines hidden --- | 56} 57 58hostid_hardware() 59{ 60 uuid=`kenv -q smbios.system.uuid` 61 x="[0-9a-f]" 62 y=$x$x$x$x 63 case "${uuid}" in --- 40 unchanged lines hidden --- |