Date: Wed, 15 Apr 2015 21:48:07 +0000 (UTC) From: Xin LI <delphij@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r281565 - head/etc/rc.d Message-ID: <201504152148.t3FLm7Hn010379@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201504152148.t3FLm7Hn010379>