[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ezjail] ezjail + zfs bug



Hi again,

On 07/31/13 19:27, Fredrik Eriksson wrote:
I noticed that ezjail won't create mountpoints for new zfs filesystems unless the underlying filesystem has a mountpoint, thus 'ezjail-admin install' will fail.

I believe attached diff is a fix, but don't take my word for it. ;)


--
Fredrik

--- ezjail-admin	2013-07-31 19:37:11.000000000 +0200
+++ /usr/local/bin/ezjail-admin	2013-07-31 20:02:14.000000000 +0200
@@ -262,7 +262,7 @@
 
   if [ "${ezjail_use_zfs}" = "YES" ]; then
     ensure_jailzfs
-    /sbin/zfs create ${ezjail_jailzfs}/basejail
+    /sbin/zfs create -o mountpoint=${ezjail_jaildir}/basejail ${ezjail_jailzfs}/basejail
     /sbin/zfs snapshot ${ezjail_jailzfs}/basejail@`date -v -7d +"%C%y%m%d_%H:%M:%S"`
   fi
 
@@ -284,6 +284,7 @@
     [ -d "${ezjail_jailtemplate}" ] && zfs destroy -R ${ezjail_jailzfs}/newjail && rm -rf "${ezjail_jailtemplate}"
     cd ${ezjail_jaildir}
     zfs rename ${ezjail_jailzfs}/fulljail ${ezjail_jailzfs}/newjail
+    zfs set mountpoint=${ezjail_jaildir}/newjail ${ezjail_jailzfs}/newjail
   else
     [ -d "${ezjail_jailtemplate}" ] && chflags -R noschg "${ezjail_jailtemplate}" && rm -rf "${ezjail_jailtemplate}"
     mv "${ezjail_jailfull}" "${ezjail_jailtemplate}"
@@ -432,7 +433,7 @@
   _zfs_status=`/sbin/zfs list -H -o name ${ezjail_jailzfs} 2> /dev/null`
   [ "${_zfs_status}" = "${ezjail_jailzfs}" ] && return
 
-  # if a directoy already exists in that place, make sure it is empty, else bump user
+  # if a directory already exists in that place, make sure it is empty, else bump user
   [ -d "${ezjail_jaildir}" -a -n "`ls -A ${ezjail_jaildir}`" ] && exerr "Error: Can not create zfs at ${ezjail_jaildir}.\n  There is a non-empty directory in the way."
 
   # create all parent file systems if necessary
@@ -440,7 +441,7 @@
 
   # create the ezjail root zfs
   # Note, we can not use -p here, because the -o options are ignored
-  /sbin/zfs create -o mountpoint=${ezjail_jaildir} ${ezjail_zfs_properties} ${ezjail_jailzfs}
+  /sbin/zfs create ${ezjail_zfs_properties} ${ezjail_jailzfs}
 }
 
 #############################
@@ -932,7 +933,7 @@
     if [ "${ezjail_use_zfs}" = "YES" ]; then
       ensure_jailzfs
       [ -d "${ezjail_jailfull}" ] && /sbin/zfs destroy -R "${ezjail_jailzfs}/fulljail" 2>/dev/null && rm -rf "${ezjail_jailfull}"
-      /sbin/zfs create "${ezjail_jailzfs}/fulljail" || exerr "Error: Cannot create temporary Jail directory."
+      /sbin/zfs create -o mountpoint="${ezjail_jaildir}/fulljail" "${ezjail_jailzfs}/fulljail" || exerr "Error: Cannot create temporary Jail directory."
     else
       [ -d "${ezjail_jailfull}" ] && chflags -R noschg "${ezjail_jailfull}" && rm -rf "${ezjail_jailfull}"
       mkdir -p "${ezjail_jailfull}" || exerr "Error: Cannot create temporary Jail directory."
@@ -1013,7 +1014,7 @@
   if [ "${ezjail_use_zfs}" = "YES" ]; then
     ensure_jailzfs
     [ -d "${ezjail_jailfull}" ] && /sbin/zfs destroy -R "${ezjail_jailzfs}/fulljail" 2>/dev/null && rm -rf "${ezjail_jailfull}"
-    /sbin/zfs create "${ezjail_jailzfs}/fulljail" || exerr "Error: Cannot create temporary Jail directory."
+    /sbin/zfs create -o mountpoint="${ezjail_jaildir}/fulljail" "${ezjail_jailzfs}/fulljail" || exerr "Error: Cannot create temporary Jail directory."
   else
     [ -d "${ezjail_jailfull}" ] && chflags -R noschg "${ezjail_jailfull}" && rm -rf "${ezjail_jailfull}"
     mkdir -p "${ezjail_jailfull}" || exerr "Error: Cannot create temporary Jail directory."