Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion autodecrypt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ function test_clevis_unlock {
}

function check_initramfs_hooks {
local clevis_found=0
echo "Checking initramfs hooks..."

if [ ! -f "/usr/share/initramfs-tools/hooks/clevis" ]; then
Expand All @@ -161,7 +162,11 @@ function check_initramfs_hooks {
fi

# Check if clevis hook is in the generated initramfs
if ! lsinitramfs /boot/initrd.img-$(uname -r) 2>/dev/null | grep -q clevis; then
set +o pipefail
# if grep finds a match, lsinitramfs gets SIGPIPE but we still want a success
lsinitramfs /boot/initrd.img-$(uname -r) 2>/dev/null | grep -q clevis && clevis_found=1
set -o pipefail
if [ "$clevis_found" = 0 ]; then
echo "WARNING: Clevis not found in current initramfs. Will update initramfs."
return 1
fi
Expand Down