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

svn at pcbsd.org svn at pcbsd.org
Thu Feb 14 10:53:22 PST 2013


Author: kris
Date: 2013-02-14 18:53:22 +0000 (Thu, 14 Feb 2013)
New Revision: 21492

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

Add new function to get a ZFSDataset name of a directory



Modified: pcbsd/current/src-sh/libsh/functions.sh
===================================================================
--- pcbsd/current/src-sh/libsh/functions.sh	2013-02-14 15:07:16 UTC (rev 21491)
+++ pcbsd/current/src-sh/libsh/functions.sh	2013-02-14 18:53:22 UTC (rev 21492)
@@ -175,6 +175,17 @@
   return 1
 }
 
+# Get the ZFS dataset of a particular directory
+getZFSDataset() {
+  local mount="$1"
+  local zData=`mount | grep " on $mount " | grep "(zfs," | awk '{print $1}'`
+  if [ -n "$zData" ] ; then
+     echo "$zData"
+     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