From 0792c6def2d9a8805d60515a59a5b800272f2f25 Mon Sep 17 00:00:00 2001 From: Mike Hibler Date: Sat, 1 Jul 2017 15:54:12 -0600 Subject: [PATCH] Support using a FreeBSD 10.x smartctl binary in nodecheck. FreeBSD 8.x smartctl binary does work with 10.x kernel. --- clientside/tmcc/common/checknode/checkutils.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/clientside/tmcc/common/checknode/checkutils.sh b/clientside/tmcc/common/checknode/checkutils.sh index 7d7531266..4df6036d4 100644 --- a/clientside/tmcc/common/checknode/checkutils.sh +++ b/clientside/tmcc/common/checknode/checkutils.sh @@ -32,6 +32,7 @@ fi [[ -z "${host-}" ]] && declare host #emulab hostname [[ -z "${failed-}" ]] && declare failed="" #major falure to be commicated to user [[ -z "${os-}" ]] && declare os="" #[Linux|FreeBSD] for now +[[ -z "${osrel-}" ]] && declare osrel="" #release major number [[ -z "${todo_exit-}" ]] && declare -a todo_exit=('echo "Exit trap"') [[ -z "${hwinv[hwinvidx]-}" ]] && declare -A hwinv["hwinvidx"]="" # hwinv from tmcc [[ -z "${hwinvcopy[hwinvidx]-}" ]] && declare -A hwinvcopy["hwinvidx"]="" # a copy of hwinv from tmcc @@ -71,6 +72,13 @@ initialize () { if [ -z "${BINDIR-""}" ] ; then if [ -f "/etc/emulab/paths.sh" ]; then source /etc/emulab/paths.sh + # XXX paths.sh resets PATH so we need to re-add any special bindir + ldir=`$BINDIR/tmcc hwinfo | grep LOGDIR= | \ + sed -e 's/.*LOGDIR="\(.*\)".*/\1/'` + bdir=$ldir/`uname -s`/bin-`uname -m` + if [ -d $bdir ] ; then + export PATH="$PATH:$bdir" + fi else export BINDIR=/usr/local/etc/emulab export LOGDIR=/var/tmp @@ -600,6 +608,7 @@ inithostname() { echo "ERROR uname messed up" exit 1 fi + osrel=`uname -r | sed 's/^\([0-9][0-9]*\)\..*/\1/'` if [ -e "$BINDIR/tmcc" ] ; then host=$($BINDIR/tmcc nodeid) else @@ -618,6 +627,13 @@ inithostname() { findSmartctl() { local findit=$(which smartctl) + if [ "$os" == "FreeBSD" ] ; then + if [ "$osrel" == "9" ] ; then + findit=$(which smartctl9) + elif [ "$osrel" == "10" ] ; then + findit=$(which smartctl10) + fi + fi if [ -z "${findit}" ] ; then if [ -x "/usr/sbin/smartctl" ]; then findit="/usr/sbin/smartctl" -- GitLab