We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b0fdba7 commit 0533d1dCopy full SHA for 0533d1d
sbin/safeboot
@@ -874,15 +874,17 @@ remount_ro()
874
{
875
DEV="${1:-${ROOTDEV}}"
876
877
- warn "${DEV}: remounting read-only"
+ if [ "$(blockdev --getro "${DEV}")" == 1 ] ; then
878
+ warn "${DEV}: already read-only"
879
+ return 0
880
+ fi
881
882
+ warn "${DEV}: remounting read-only"
883
if mount -o ro,noatime,remount "${DEV}" ; then
884
- if [ "$(blockdev --getro "${DEV}")" != 1 ] ; then
- warn "${DEV}: forcing fsck"
- fsck.ext4 -f "${DEV}" \
- || die "${DEV}: Could not fsck"
885
- fi
+ warn "${DEV}: forcing fsck"
886
+ fsck.ext4 -f "${DEV}" \
887
+ || die "${DEV}: Could not fsck"
888
889
warn "${DEV}: setting block dev readonly"
890
blockdev --setro "${DEV}" \
0 commit comments