From 449b3e543c6bbc1e9d539ca2298cc5a191b3233a Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Wed, 17 Jul 2013 11:28:23 -0400 Subject: init: rely on ConditionPathIsReadWrite for root fsck flag Add an annoying warning in case the root device is fsck'd and about to be mounted RO. Signed-off-by: Dave Reisner --- init_functions | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/init_functions b/init_functions index f356a14..474d6fa 100644 --- a/init_functions +++ b/init_functions @@ -205,9 +205,8 @@ fsck_root() { fsckret=$? if [ -n "$fsckret" ] && [ "$fsckret" -ne 255 ]; then - if [ "$fsckret" -eq 0 ] || bitfield_has_bit $fsckret 1; then - echo "$fsckret" > /run/initramfs/root-fsck - elif bitfield_has_bit "$fsckret" 4; then + # handle error conditions; do nothing on success. + if bitfield_has_bit "$fsckret" 4; then err "Bailing out. Run 'fsck $root' manually" printf '%s\n' \ "********** FILESYSTEM CHECK FAILED **********" \ @@ -239,6 +238,17 @@ fsck_root() { elif bitfield_has_bit "$fsckret" 128; then err "fatal error invoking fsck" fi + + # ensure that root is going to be mounted rw. Otherwise, systemd + # might fsck the device again. Annoy the user so that they fix this. + if [ "${rwopt:-ro}" != 'rw' ]; then + echo "********************** WARNING **********************" + echo "* *" + echo "* The root device is not configured to be mounted *" + echo "* read-write! It may be fsck'd again later. *" + echo "* *" + echo "*****************************************************" + fi fi } -- cgit v1.2.3-24-g4f1b