[PC-BSD Commits] r21592 - pcbsd/current/src-sh/warden/scripts/backend

svn at pcbsd.org svn at pcbsd.org
Wed Feb 20 10:40:50 PST 2013


Author: kris
Date: 2013-02-20 18:40:49 +0000 (Wed, 20 Feb 2013)
New Revision: 21592

Modified:
   pcbsd/current/src-sh/warden/scripts/backend/createjail.sh
Log:

Fix another error with warden creating jails via ZFS mount



Modified: pcbsd/current/src-sh/warden/scripts/backend/createjail.sh
===================================================================
--- pcbsd/current/src-sh/warden/scripts/backend/createjail.sh	2013-02-20 17:27:27 UTC (rev 21591)
+++ pcbsd/current/src-sh/warden/scripts/backend/createjail.sh	2013-02-20 18:40:49 UTC (rev 21592)
@@ -120,17 +120,12 @@
    isDirZFS "${JDIR}"
    if [ $? -eq 0 ] ; then
      # Create ZFS mount
-     tank=`getZFSTank "$JDIR"`
-     # Check the mount-point for this tank
-     zMnt=`getZFSMount "$tank"`
-     if [ zMnt = "/" ] ; then
-        zfs create -o mountpoint=${JAILDIR} -p ${tank}${JAILDIR}
-        if [ $? -ne 0 ] ; then exit_err "Failed creating ZFS dataset"; fi
-     else
-        tMnt=`echo $JAILDIR | sed "s|^${zMnt}||g"`
-        zfs create -o mountpoint=${JAILDIR} -p ${tank}${tMnt}
-        if [ $? -ne 0 ] ; then exit_err "Failed creating ZFS dataset"; fi
+     zData=`getZFSDataset "$JDIR"`
+     if [ -z "$zData" ] ; then
+        exit_err "Failed getting ZFS dataset for $JDIR..";
      fi
+     zfs create -o mountpoint=${JAILDIR} -p ${zData}/`basename ${JAILDIR}`
+     if [ $? -ne 0 ] ; then exit_err "Failed creating ZFS dataset"; fi
    else
      mkdir -p "${JAILDIR}"
    fi
@@ -143,18 +138,12 @@
 isDirZFS "${JDIR}"
 if [ $? -eq 0 ] ; then
    # Create ZFS CLONE
-   tank=`getZFSTank "$JDIR"`
-   # Check the mount-point for this tank
-   zMnt=`getZFSMount "$tank"`
-   if [ zMnt = "/" ] ; then
-      zfs clone ${tank}${WORLDCHROOT}@clean ${tank}${JAILDIR}
-      if [ $? -ne 0 ] ; then exit_err "Failed creating clean ZFS base clone"; fi
-    else
-      tMnt=`echo $JAILDIR | sed "s|^${zMnt}||g"`
-      crDir=`echo $WORLDCHROOT | sed "s|^${zMnt}||g"`
-      zfs clone ${tank}${crDir}@clean ${tank}${tMnt}
-      if [ $? -ne 0 ] ; then exit_err "Failed creating clean ZFS base clone"; fi
-    fi
+   zData=`getZFSDataset "$JDIR"`
+   if [ -z "$zData" ] ; then
+      exit_err "Failed getting ZFS dataset for $JDIR..";
+   fi
+   zfs clone ${zData}/`basename ${WORLDCHROOT}`@clean ${zData}/`basename ${JAILDIR}`
+   if [ $? -ne 0 ] ; then exit_err "Failed creating clean ZFS base clone"; fi
 else
    # Running on UFS
    mkdir -p "${JAILDIR}"



More information about the Commits mailing list