blob: c0652f2fcd635b93120f0656941db02e624610a2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
#!/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-0.5.1,v 1.1 2009/09/21 10:40:39 robbat2 Exp $
opts="save clear deactivated"
STARTUP_MODE="${STARTUP_MODE:-'save'}"
LOGFILE=/var/log/tpm/tpm-emulator.log
depend() {
use logger
after coldplug
}
checkconfig() {
lsmod | grep -q "^tpmd_dev\b" \
|| modprobe tpmd_dev &>/dev/null \
|| eerror "Failed to load module tpmd_dev, assuming you have it built-in to kernel.";
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 \
--background --stdout $LOGFILE --stderr $LOGFILE \
--exec /usr/sbin/tpmd -- -f ${DEBUG:+-d} $STARTUP_MODE
sleep 1
chmod g+w /var/run/tpm/tpmd_socket:0
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 $?
}
|