diff options
author | André Draszik <adraszik@tycoint.com> | 2017-11-01 11:16:32 +0000 |
---|---|---|
committer | Armin Kuster <akuster808@gmail.com> | 2017-11-06 12:18:24 -0800 |
commit | 9cb0957711a898b091ba720882d98e161af31255 (patch) | |
tree | 3965845f294a95d28dfa60ed8036ced37312b035 | |
parent | ebed429d201db47cdb9c18694c9d40ebe34be05b (diff) | |
download | meta-security-9cb0957711a898b091ba720882d98e161af31255.tar.gz |
trousers: make initscript more reliable
The combination of using start-stop-daemon and pidof is
not working reliably in all cases. Sometimes, the
tcsd daemon isn't running yet at the time pidof is being
invoked.
This results in an empty /var/run/tcsd.pid, making it
impossible to stop tcsd using the init script.
To solve this, one could either add a delay before calling
pidof, or alternatively use start-stop-daemon's built-in
functionality to achieve the same.
Let's do the latter.
Signed-off-by: André Draszik <adraszik@tycoint.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r-- | meta-tpm/recipes-tpm/trousers/files/trousers.init.sh | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/meta-tpm/recipes-tpm/trousers/files/trousers.init.sh b/meta-tpm/recipes-tpm/trousers/files/trousers.init.sh index 0ecf7cc..d0d6cb3 100644 --- a/meta-tpm/recipes-tpm/trousers/files/trousers.init.sh +++ b/meta-tpm/recipes-tpm/trousers/files/trousers.init.sh | |||
@@ -33,10 +33,12 @@ case "${1}" in | |||
33 | exit 0 | 33 | exit 0 |
34 | fi | 34 | fi |
35 | 35 | ||
36 | start-stop-daemon --start --quiet --oknodo --pidfile /var/run/${NAME}.pid --user ${USER} --chuid ${USER} --exec ${DAEMON} -- ${DAEMON_OPTS} | 36 | start-stop-daemon --start --quiet --oknodo \ |
37 | --pidfile /var/run/${NAME}.pid --make-pidfile --background \ | ||
38 | --user ${USER} --chuid ${USER} \ | ||
39 | --exec ${DAEMON} -- ${DAEMON_OPTS} --foreground | ||
37 | RETVAL="$?" | 40 | RETVAL="$?" |
38 | echo "$NAME." | 41 | echo "$NAME." |
39 | [ "$RETVAL" = 0 ] && pidof $DAEMON > /var/run/${NAME}.pid | ||
40 | exit $RETVAL | 42 | exit $RETVAL |
41 | ;; | 43 | ;; |
42 | 44 | ||