summaryrefslogtreecommitdiff
path: root/app-crypt/tpm-emulator/files/tpm-emulator.initd
diff options
context:
space:
mode:
Diffstat (limited to 'app-crypt/tpm-emulator/files/tpm-emulator.initd')
-rw-r--r--app-crypt/tpm-emulator/files/tpm-emulator.initd46
1 files changed, 46 insertions, 0 deletions
diff --git a/app-crypt/tpm-emulator/files/tpm-emulator.initd b/app-crypt/tpm-emulator/files/tpm-emulator.initd
new file mode 100644
index 000000000000..abfbef900d00
--- /dev/null
+++ b/app-crypt/tpm-emulator/files/tpm-emulator.initd
@@ -0,0 +1,46 @@
+#!/sbin/openrc-run
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2 or later
+
+STARTUP_MODE="${STARTUP_MODE:-save}";
+
+extra_started_commands="clear save deactivated"
+description="TPM emulator"
+command="/usr/bin/tpmd"
+my_command_args="-f"
+command_background=1
+command_user="tss:tss"
+pidfile="/var/run/${RC_SVCNAME}.pid"
+
+depend() {
+ use logger
+ after coldplug
+}
+
+start_pre() {
+ checkpath -d -m 0775 -o tss /var/run/tpm
+ service_set_value STARTUP_MODE "${STARTUP_MODE}"
+}
+
+start() {
+ command_args="${my_command_args} $(service_get_value STARTUP_MODE)"
+ default_start
+}
+
+_doit() {
+ service_set_value STARTUP_MODE "$1"
+ stop
+ start
+}
+
+clear() {
+ _doit clear
+}
+
+save() {
+ _doit save
+}
+
+deactivated() {
+ _doit deactivated
+}