findmnt --raw --noheadings --output options --target SOME_DIRECTORY | grep -qE '(^|,)ro($|,)'
findmntis a handy alternative tomountwhen writing scripts- SOME_DIRECTORY does not have to correspond to a mountpoint. If it doesn't, findmnt will traverse its parent directories until it finds the corresponding filesystem / mountpoint.
- a simple
grep rowould also match options likeerrors=remount-ro, so we make sure to only match the singlerooption. It must be delimited by commas or the start/end of the option string.