|
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17 System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 User : nobody ( 99) PHP Version : 5.2.17 Disable Function : NONE Directory : /proc/21572/task/21572/root/etc/rc3.d/ |
Upload File : |
#!/bin/bash
#
# Init file for the TrouSerS TCG Core Services daemon
#
# chkconfig: - 90 10
# description: TrouSerS server daemon
#
# processname: tcsd
# config: /etc/tcsd.conf
# pidfile: /var/run/tcsd.pid
# source function library
. /etc/rc.d/init.d/functions
# pull in sysconfig settings
[ -f /etc/sysconfig/tcsd ] && . /etc/sysconfig/tcsd
RETVAL=0
prog="tcsd"
# Some variables to make the below more readable
TCSD=/usr/sbin/tcsd
PID_FILE=/var/run/tcsd.pid
MODPROBE=/sbin/modprobe
LSMOD=/sbin/lsmod
GREP=/bin/grep
PWD=/bin/pwd
MOD_DIR=/lib/modules/$(uname -r)/kernel/drivers/char/tpm
START_OPT=" start"
load_drivers()
{
CUR_DIR=`$PWD`
cd $MOD_DIR
# Must load tpm_bios.ko first
$MODPROBE tpm_bios >/dev/null 2>&1
RETVAL=$?
if [ $RETVAL -ne 0 ]; then
failure "Load tpm_bios"
echo
cd $CUR_DIR
return $RETVAL
fi
# Must load tpm.ko second
$MODPROBE tpm >/dev/null 2>&1
RETVAL=$?
if [ $RETVAL -ne 0 ]; then
failure "Load tpm"
echo
cd $CUR_DIR
return $RETVAL
fi
# Attempt to load remaining tpm_*.ko
# But do NOT return error if they fail
for d in `echo tpm_*`; do
if [ "$d" != "tpm_bios.ko" ]
then
m=${d%".ko"}
$MODPROBE $m >/dev/null 2>&1
fi
done
cd $CUR_DIR
success "Load tpm"
echo
return $RETVAL
}
check_drivers()
{
$LSMOD | $GREP tpm_ >/dev/null 2>&1
RETVAL=$?
return $RETVAL
}
start()
{
check_drivers
RETVAL=$?
if [ $RETVAL -ne 0 ]; then
load_drivers
RETVAL=$?
fi
if [ $RETVAL -ne 0 ]; then
failure $"Loading drivers"
fi
echo -n $"Starting $prog: "
$TCSD $START_OPT && success
echo
touch /var/lock/subsys/tcsd && success
RETVAL=$?
echo
return $RETVAL
}
stop()
{
echo -n $"Stopping $prog: "
if [ -n "`pidfileofproc $TCSD`" ] ; then
killproc $TCSD -HUP
else
failure $"Stopping $prog"
fi
RETVAL=$?
[ "$RETVAL" = 0 ] && rm -f /var/lock/subsys/tcsd
echo
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
reload)
restart
;;
condrestart)
if [ -f /var/lock/subsys/tcsd ] ; then
restart
fi
;;
status)
status $TCSD
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|condrestart|status}"
RETVAL=1
esac
exit $RETVAL