#!/bin/sh
# PROVIDE: machine_identity

. /etc/rc.subr

name=machine_identity
start_cmd=machine_identity_start
stop_cmd=:

machine_identity_start()
{
	if [ ! -s /etc/machine-id ]; then
		sed 's/-//g' /proc/sys/kernel/random/uuid > /etc/machine-id.new ||
			return 1
		chmod 0444 /etc/machine-id.new || return 1
		mv /etc/machine-id.new /etc/machine-id || return 1
	fi
}

run_rc_command "$1"
