summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarald Hoyer <harald@redhat.com>2013-08-15 12:23:04 +0200
committerHarald Hoyer <harald@redhat.com>2013-08-15 12:23:04 +0200
commitbbc9bfe16eeec91f127fdb37d642f6f97f5aa39e (patch)
tree1f7f1d4ce8157bb1a43e31366b5e2fca7d4ca1df
parent466a59984a095f33993cffd5a3bea40826469b03 (diff)
downloaddracut-bbc9bfe16eeec91f127fdb37d642f6f97f5aa39e.tar.gz
dracut-bbc9bfe16eeec91f127fdb37d642f6f97f5aa39e.tar.bz2
dracut-bbc9bfe16eeec91f127fdb37d642f6f97f5aa39e.zip
dracut-functions.sh: add find_mp_fsopts
-rwxr-xr-xdracut-functions.sh16
1 files changed, 16 insertions, 0 deletions
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 <mountpoint>
+# 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 <device>
# Echo the filesystem options for a given device.
# /proc/self/mountinfo is taken as the primary source of information