#!/bin/bash
## kola:
##   exclusive: false
#
# It's easy for dracut modules to accidentally ship scripts without +x set.
# Check for those.

set -xeuo pipefail

. $KOLA_EXT_DATA/commonlib.sh

tmpd=$(mktemp -d)
( cd "${tmpd}" && lsinitrd --unpack /boot/ostree/*/init* )
if find "${tmpd}/usr/"{bin,sbin,libexec} ! -perm -0111 | grep -v clevis-luks-common-functions; then
    fatal "Found non-executable scripts in initrd"
fi
rm -r "${tmpd}"
ok "All initrd scripts are executable"
