policycoreutils: fixfiles: failure to create /.autorelabel is fatal

Fix the following ambiguous output (from booting with init=/bin/sh):

    # /usr/sbin/fixfiles onboot
    /usr/sbin/fixfiles: line 313: /.autorelabel: Read-only file system
    /usr/sbin/fixfiles: line 317: /.autorelabel: Read-only file system
    System will relabel on next boot

System will not relabel on next boot if we couldn't create ./autorelabel

(In case anyone reading this description is still confused: To run
`fixfiles onboot` after booting with init=/bin/sh, you must first run
`mount / -oremount,rw`).
This commit is contained in:
Alan Jenkins 2018-05-12 13:43:09 +01:00 committed by Stephen Smalley
parent 20c9b4971e
commit 5ddfc0371a

View File

@ -309,7 +309,7 @@ case "$1" in
usage
exit 1
fi
> /.autorelabel
> /.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