#!/bin/bash

# Does Python exist?  I don't want to hardcode a dependency in the spec file.
# If it's there, let the RAS daemon do the version check.

# define a directory to store XML-formatted SAL records
# directory is created if it doesn't exist
#XML_OUT_DIR="-d /tmp"

rpm -q python > /dev/null 2>&1
if [ $? -eq 0 ]; then
	DESC[0]="HP RAS daemon"
	PROG[0]="hprasd"
	ARGS[0]="-v ${XML_OUT_DIR:-}"
	WAIT[0]=1		# DBus name propagation
else
	DESC[0]="ignoring HP RAS daemon"
	PROG[0]=""
	ARGS[0]=""
	WAIT[0]=0
fi

. $RUNDAEMON

# Add warning message for salinfo_decode
ps -C salinfo_decode > /dev/null 2>&1
[ $? -eq 0 -a "$1" == "start" ] && echo "Warning: 'salinfo_decode' was running. In order for 'hprasd' to read SAL errors, Try to stop it manually and restart hpgmtmbase again."

# 42 == Python versionitis.  The error status has been displayed, don't
# mess up other actions.

[ $RETVAL -eq 42 ] && RETVAL=0
exit $RETVAL
