1*0696600cSBjoern A. Zeeb#!/bin/sh 2*0696600cSBjoern A. Zeeb# 3*0696600cSBjoern A. Zeeb# $FreeBSD$ 4*0696600cSBjoern A. Zeeb# 5*0696600cSBjoern A. Zeeb 6*0696600cSBjoern A. Zeeb# PROVIDE: hostid_save 7*0696600cSBjoern A. Zeeb# REQUIRE: hostid root 8*0696600cSBjoern A. Zeeb# KEYWORD: nojail 9*0696600cSBjoern A. Zeeb 10*0696600cSBjoern A. Zeeb. /etc/rc.subr 11*0696600cSBjoern A. Zeeb 12*0696600cSBjoern A. Zeebname="hostid_save" 13*0696600cSBjoern A. Zeebdesc="Save unique host ID to disk" 14*0696600cSBjoern A. Zeebstart_cmd="hostid_save" 15*0696600cSBjoern A. Zeebstop_cmd=":" 16*0696600cSBjoern A. Zeebrcvar="hostid_enable" 17*0696600cSBjoern A. Zeeb 18*0696600cSBjoern A. Zeebhostid_save() 19*0696600cSBjoern A. Zeeb{ 20*0696600cSBjoern A. Zeeb current_hostid=`$SYSCTL_N kern.hostuuid` 21*0696600cSBjoern A. Zeeb 22*0696600cSBjoern A. Zeeb if [ -r ${hostid_file} ]; then 23*0696600cSBjoern A. Zeeb read saved_hostid < ${hostid_file} 24*0696600cSBjoern A. Zeeb if [ ${saved_hostid} = ${current_hostid} ]; then 25*0696600cSBjoern A. Zeeb exit 0 26*0696600cSBjoern A. Zeeb fi 27*0696600cSBjoern A. Zeeb fi 28*0696600cSBjoern A. Zeeb 29*0696600cSBjoern A. Zeeb echo ${current_hostid} > ${hostid_file} 30*0696600cSBjoern A. Zeeb if [ $? -ne 0 ]; then 31*0696600cSBjoern A. Zeeb warn "could not store hostuuid in ${hostid_file}." 32*0696600cSBjoern A. Zeeb fi 33*0696600cSBjoern A. Zeeb} 34*0696600cSBjoern A. Zeeb 35*0696600cSBjoern A. Zeebload_rc_config $name 36*0696600cSBjoern A. Zeebrun_rc_command "$1" 37