[PC-BSD Commits] r20921 - pcbsd/current/src-sh/libsh

svn at pcbsd.org svn at pcbsd.org
Thu Jan 10 08:54:48 PST 2013


Author: kris
Date: 2013-01-10 16:54:48 +0000 (Thu, 10 Jan 2013)
New Revision: 20921

Modified:
   pcbsd/current/src-sh/libsh/functions.sh
Log:

Add function to get the mount-point of a particular zpool or zfs dataset



Modified: pcbsd/current/src-sh/libsh/functions.sh
===================================================================
--- pcbsd/current/src-sh/libsh/functions.sh	2013-01-10 10:23:45 UTC (rev 20920)
+++ pcbsd/current/src-sh/libsh/functions.sh	2013-01-10 16:54:48 UTC (rev 20921)
@@ -163,6 +163,18 @@
   return 1
 }
 
+# Gets the mount-point of a particular zpool / dataset
+# Arg1 = zpool to check
+getZFSMount() {
+  local zpool="$1"
+  local mnt=`mount | grep "^${zpool} on" | grep "(zfs," | awk '{print $3}'`
+  if [ -n "$mnt" ] ; then
+     echo "$mnt"
+     return 0
+  fi
+  return 1
+}
+
 # Get the ZFS tank name for a directory
 # Arg1 = Directory to check
 getZFSTank() {



More information about the Commits mailing list