#!/sbin/runscript # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/app-crypt/tpm-emulator/files/tpm-emulator.initd,v 1.1 2007/06/23 20:00:20 alonbl Exp $ opts="save clear deactivated" STARTUP_MODE='save'; depend() { use logger after coldplug } checkconfig() { lsmod | grep -q "^tpmd_dev\b" \ || modprobe tpmd_dev &>/dev/null \ || eerror "Failed to load module tpmd_dev"; if [ ! -c /dev/tpm ] && [ ! -c /dev/tpm0 ] ; then eerror "No TPM device found!" return 1 fi return 0 } start() { ebegin "Starting tpm-emulator daemon with mode '$STARTUP_MODE' (tpmd)" checkconfig || eend $? start-stop-daemon --start --chuid tss --exec /usr/sbin/tpmd $STARTUP_MODE > /dev/null eend $? } save() { STARTUP_MODE='save'; svc_restart } clear() { STARTUP_MODE='clear'; svc_restart } deactivated() { STARTUP_MODE='deactivated'; svc_restart } stop() { ebegin "Stopping tpm-emulator daemon (tpmd)" start-stop-daemon --stop --exec /usr/sbin/tpmd --user tss > /dev/null eend $? }