summaryrefslogtreecommitdiff
path: root/scripts/init.sh
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2014-07-06 18:04:32 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2014-07-06 18:04:32 +0200
commita7f89980e5b3f4b9a74c70dbc5ffe8aabd28be28 (patch)
tree41c4deec1fdfbafd7821b4ca7a9772ac0abd92f5 /scripts/init.sh
Imported Upstream version 2.9.3upstream/2.9.3
Diffstat (limited to 'scripts/init.sh')
-rwxr-xr-xscripts/init.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/scripts/init.sh b/scripts/init.sh
new file mode 100755
index 0000000..d08fcd6
--- /dev/null
+++ b/scripts/init.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+# init.sh - run this at install time if rpm postinstall not used
+#
+sbindir=/usr/bin
+vardir=/var/lib/ipmiutil
+datadir=/usr/share/ipmiutil
+sensorout=$vardir/sensor_out.txt
+
+ if [ -x $datadir/setlib.sh ]; then
+ $datadir/setlib.sh
+ fi
+
+ mkdir -p $vardir
+ if [ ! -f $vardir/ipmi_if.txt ]; then
+ $datadir/ipmi_if.sh
+ fi
+
+ # 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
+ # IPMI_IS_ENABLED, so enable services
+ if [ -x /sbin/chkconfig ]; then
+ /sbin/chkconfig --add ipmi_port
+ /sbin/chkconfig --add ipmiutil_wdt
+ /sbin/chkconfig --add ipmiutil_asy
+ fi
+
+ # Capture a snapshot of IPMI sensor data once now for later reuse.
+ if [ ! -f $sensorout ]; then
+ $sbindir/ipmiutil sensor -q >$sensorout
+ fi
+ fi
+