summaryrefslogtreecommitdiffstats
path: root/etc/rc.d/hostid_save
diff options
context:
space:
mode:
Diffstat (limited to 'etc/rc.d/hostid_save')
-rwxr-xr-xetc/rc.d/hostid_save29
1 files changed, 29 insertions, 0 deletions
diff --git a/etc/rc.d/hostid_save b/etc/rc.d/hostid_save
new file mode 100755
index 0000000..44e403f
--- /dev/null
+++ b/etc/rc.d/hostid_save
@@ -0,0 +1,29 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: hostid_save
+# REQUIRE: root
+# BEFORE: mountcritlocal
+# KEYWORD: nojail
+
+. /etc/rc.subr
+
+name="hostid_save"
+start_cmd="hostid_save"
+stop_cmd=":"
+rcvar="hostid_enable"
+
+hostid_save()
+{
+ if [ ! -r ${hostid_file} ]; then
+ $SYSCTL_N kern.hostuuid > ${hostid_file}
+ if [ $? -ne 0 ]; then
+ warn "could not store hostuuid in ${hostid_file}."
+ fi
+ fi
+}
+
+load_rc_config $name
+run_rc_command "$1"
OpenPOWER on IntegriCloud