From bbc9bfe16eeec91f127fdb37d642f6f97f5aa39e Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Thu, 15 Aug 2013 12:23:04 +0200 Subject: dracut-functions.sh: add find_mp_fsopts --- dracut-functions.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/dracut-functions.sh b/dracut-functions.sh index 1cd8e473..7ee45877 100755 --- a/dracut-functions.sh +++ b/dracut-functions.sh @@ -441,6 +441,22 @@ find_dev_fstype() { return 1 } +# find_mp_fsopts +# Echo the filesystem options for a given mountpoint. +# /proc/self/mountinfo is taken as the primary source of information +# and /etc/fstab is used as a fallback. +# No newline is appended! +# Example: +# $ find_mp_fsopts /;echo +# rw,relatime,discard,data=ordered +find_mp_fsopts() { + if [[ $use_fstab != yes ]]; then + findmnt -e -v -n -o 'OPTIONS' --target "$1" 2>/dev/null && return 0 + fi + + findmnt --fstab -e -v -n -o 'OPTIONS' --target "$1" +} + # find_dev_fsopts # Echo the filesystem options for a given device. # /proc/self/mountinfo is taken as the primary source of information -- cgit v1.2.3