policycoreutils/fixfiles: Force full relabel when SELinux is disabled

The previous check used getfilecon to check whether / slash contains a label,
but getfilecon fails only when SELinux is disabled. Therefore it's better to
check this using selinuxenabled.

Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
This commit is contained in:
Petr Lautrbach 2019-09-24 21:08:54 +02:00 committed by Stephen Smalley
parent d3a8fc4c03
commit f4e741a144

View file

@ -313,8 +313,8 @@ case "$1" in
> /.autorelabel || exit $?
[ -z "$FORCEFLAG" ] || echo -n "$FORCEFLAG " >> /.autorelabel
[ -z "$BOOTTIME" ] || echo -N $BOOTTIME >> /.autorelabel
# Force full relabel if / does not have a label on it
getfilecon / > /dev/null 2>&1 || echo -F >/.autorelabel
# Force full relabel if SELinux is not enabled
selinuxenabled || echo -F > /.autorelabel
echo "System will relabel on next boot"
;;
*)