SVN: rc-scripts/trunk/rc.d/init.d/functions

baggins baggins at pld-linux.org
Mon Mar 9 16:54:48 CET 2009


Author: baggins
Date: Mon Mar  9 16:54:48 2009
New Revision: 10177

Modified:
   rc-scripts/trunk/rc.d/init.d/functions
Log:
- added is_fsmounted function to check if a given filesystem is mounted,
  requires /bin/stat (i.e. coreutils >= 7.1-2)


Modified: rc-scripts/trunk/rc.d/init.d/functions
==============================================================================
--- rc-scripts/trunk/rc.d/init.d/functions	(original)
+++ rc-scripts/trunk/rc.d/init.d/functions	Mon Mar  9 16:54:48 2009
@@ -990,6 +990,21 @@
 	return 0
 }
 
+# is_fsmounted fstype mntpoint
+# Check if filesystem fstype is mounted on mntpoint
+is_fsmounted() {
+	typeset fstype=$1
+	typeset mntpoint=$2
+
+	[ -n "$fstype" -a -n "$mntpoint" ] || return 1
+
+	if [ "$(/bin/stat -L -f -c %T $mntpoint 2>/dev/null)" = "$fstype" ]; then
+		return 0
+	else
+		return 1
+	fi
+}
+
 rc_cache_init() {
 	# If we have cachefile, use it.
 	# If we don't, create memory variables and try to save silently,


More information about the pld-cvs-commit mailing list