Blob Blame History Raw
From 6eba228a763ea319a8f0a9b9ba1e76e66cef733c Mon Sep 17 00:00:00 2001
From: Sergio Correia <scorreia@redhat.com>
Date: Sat, 5 Sep 2020 09:09:06 -0300
Subject: [PATCH] systemd: clevis-luks-askpass: exit cleanly with SIGTERM

Especially when running in early boot, clevis-luks-askpass may be
looping because e.g. we still have devices remaining to unlock, as
per crypttab, or we were unable to determine if there are any devices
left to be unlocked.

Eventually we may receive a SIGTERM, from e.g. systemd and we should
exit cleanly in this situation.
---
 src/luks/systemd/clevis-luks-askpass | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/luks/systemd/clevis-luks-askpass b/src/luks/systemd/clevis-luks-askpass
index d17d122..285bba4 100755
--- a/src/luks/systemd/clevis-luks-askpass
+++ b/src/luks/systemd/clevis-luks-askpass
@@ -22,6 +22,9 @@ set -eu
 
 . clevis-luks-common-functions
 
+# Make sure to exit cleanly if SIGTERM is received.
+trap 'echo "Exiting due to SIGTERM" && exit 0' TERM
+
 loop=
 path=/run/systemd/ask-password
 while getopts ":lp:" o; do
-- 
2.28.0