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

svn at pcbsd.org svn at pcbsd.org
Tue Jul 3 10:55:58 PDT 2012


Author: kris
Date: 2012-07-03 17:55:57 +0000 (Tue, 03 Jul 2012)
New Revision: 17607

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

Fix some issues importing jails.

If on ZFS, make sure we create the dataset
Fix importing host / ip properly



Modified: pcbsd/current/src-sh/warden/scripts/backend/importjail.sh
===================================================================
--- pcbsd/current/src-sh/warden/scripts/backend/importjail.sh	2012-07-03 17:53:37 UTC (rev 17606)
+++ pcbsd/current/src-sh/warden/scripts/backend/importjail.sh	2012-07-03 17:55:57 UTC (rev 17607)
@@ -144,8 +144,19 @@
 echo "Importing ${IFILE} with IP: ${IP}..."
 
 # Make the new directory
-mkdir -p "${JDIR}/${IP}"
+JAILDIR="${JDIR}/${IP}"
+isDirZFS "${JDIR}"
+if [ $? -eq 0 ] ; then
+  # Create ZFS mount
+  tank=`getZFSTank "$JDIR"`
+  zfs create -p ${tank}${JAILDIR}
+else
+  mkdir -p "${JAILDIR}"
+fi
+
+# Create the meta-dir
 set_warden_metadir
+mkdir ${JMETADIR}
 
 # Extract the jail contents
 tail +${SKIP} ${IFILE} | tar xpf - -C "${JDIR}/${IP}" 2>/dev/null
@@ -153,6 +164,10 @@
 # Make sure we have an IP address saved
 echo "${IP}" >"${JMETADIR}/ip"
 
+if [ "$HOST" = "OFF" -o -z "${HOST}" ] ; then
+  HOST="$FHOST"
+fi
+
 # Create the host for this device
 if [ "${HOST}" != "OFF" -a ! -z "${HOST}" ]
 then



More information about the Commits mailing list