From 7a96db56703b18139b19ba46ba7020a219d85541 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 2 Jul 2019 16:46:20 +0200 Subject: Add fs_path_ismountpoint --- modules/fs/path.inc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/fs/path.inc b/modules/fs/path.inc index f3a041b..c067049 100644 --- a/modules/fs/path.inc +++ b/modules/fs/path.inc @@ -32,6 +32,12 @@ fs_path_gettype() { awk '$2 == "'"$_mp"'" {print $3}' '/proc/mounts' } +# Returns true if the given path is the root of a mount point +# Does not normalize! +fs_path_ismountpoint() { + grep -Fq " $1 " /proc/mounts +} + # Helper to check whether given directory resides in RAM, either # by being mounted as tmpfs or not mounted at all in which case # we assume the same. Returns 0 if so, 1 if otherwise backed, -- cgit v1.2.3-55-g7522