Skip to content

Commit 24d8f35

Browse files
dtardonjohannbg
authored andcommitted
fix(dracut-initramfs-restore.sh): check if SELINUXTYPE is set
It can happen that SELINUXTYPE is not set, e.g., in Fedora/RHEL installation images /etc/selinux/config is an empty file. That means that setfiles fails, which makes dracut-initramfs-restore fail too because it uses "set -x", which means that dracut-shutdown.service fails. But, after commit 7ab1d00, a failure of dracut-shutdown.service means that the final switch back into initrd is skipped. Let's just add an additional sanity check to workaround that.
1 parent a38d9ec commit 24d8f35

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: dracut-initramfs-restore.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ fi
7676

7777
if [ -e /etc/selinux/config -a -x /usr/sbin/setfiles ]; then
7878
. /etc/selinux/config
79-
/usr/sbin/setfiles -v -r /run/initramfs /etc/selinux/"${SELINUXTYPE}"/contexts/files/file_contexts /run/initramfs > /dev/null
79+
[ -n "${SELINUXTYPE}" ] && /usr/sbin/setfiles -v -r /run/initramfs /etc/selinux/"${SELINUXTYPE}"/contexts/files/file_contexts /run/initramfs > /dev/null
8080
fi
8181

8282
exit 0

0 commit comments

Comments
 (0)