#!/bin/sh
#    Debian post-install script
#
sbindir=/usr/sbin
vardir=/var/lib/ipmiutil
sensorout=$vardir/sensor_out.txt

mkdir -p $vardir

# Run some ipmiutil command to see if any IPMI interface works.
$sbindir/ipmiutil wdt >/dev/null 2>&1
IPMIret=$?

# If IPMIret==0, the IPMI cmd was successful, and IPMI is enabled locally.
if [ $IPMIret -eq 0 ]; then
   # Capture a snapshot of IPMI sensor data once now for later reuse.
   if [ ! -f $sensorout ]; then
      $sbindir/ipmiutil sensor -q >$sensorout
   fi
fi

