svn commit: r281565 - head/etc/rc.d
Xin LI
delphij at FreeBSD.org
Wed Apr 15 21:48:07 UTC 2015
Author: delphij
Date: Wed Apr 15 21:48:06 2015
New Revision: 281565
URL: https://svnweb.freebsd.org/changeset/base/281565
Log:
Verify if the saved hostid is still the same and update if
it was changed.
Sponsored by: iXsystems, Inc.
Obtained from: FreeNAS (trueos commit 0abb740)
Modified:
head/etc/rc.d/hostid_save
Modified: head/etc/rc.d/hostid_save
==============================================================================
--- head/etc/rc.d/hostid_save Wed Apr 15 21:47:15 2015 (r281564)
+++ head/etc/rc.d/hostid_save Wed Apr 15 21:48:06 2015 (r281565)
@@ -16,12 +16,19 @@ 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}."
+ current_hostid=`$SYSCTL_N kern.hostuuid`
+
+ if [ -r ${hostid_file} ]; then
+ read saved_hostid < ${hostid_file}
+ if [ ${saved_hostid} = ${current_hostid} ]; then
+ exit 0
fi
fi
+
+ echo ${current_hostid} > ${hostid_file}
+ if [ $? -ne 0 ]; then
+ warn "could not store hostuuid in ${hostid_file}."
+ fi
}
load_rc_config $name
More information about the svn-src-all
mailing list