Respect the -x option when creating a ZFS backed jail, do a check if the destinatiuon really is ZFS filesystem!

This commit is contained in:
cryx 2010-01-15 13:38:23 +00:00
parent 8ecd24f223
commit cc6ceaad9b

View File

@ -388,6 +388,14 @@ check_for_zpool () {
[ "${_zpoolstatus}" = "ONLINE" -o "${_zpoolstatus}" = "DEGRADED" ] || exerr "Error: Your zpool does not exist or is not online." [ "${_zpoolstatus}" = "ONLINE" -o "${_zpoolstatus}" = "DEGRADED" ] || exerr "Error: Your zpool does not exist or is not online."
} }
check_for_zfs_exist () {
# check if the zfs we want to use already exists or not, return 0 if it does and 1 if not
_exit=1
_zfs_status=`/sbin/zfs list -H -o name ${ezjail_jailzfs}/${ezjail_hostname} 2> /dev/null`
[ "${_zfs_status}" = "${ezjail_jailzfs}/${ezjail_hostname}" ] && _exit=0
return ${_exit}
}
############################# #############################
# End of function definitions # End of function definitions
# #
@ -562,12 +570,16 @@ create)
ezjail_device=${ezjail_imagedevice} ezjail_device=${ezjail_imagedevice}
;; ;;
zfs) zfs)
echo "ZFS: create the jail filesystem" if [ -z "${ezjail_exists}" ]; then
if [ ${ezjail_imagesize} ]; then echo "ZFS: create the jail filesystem"
ezjail_zfs_jail_properies="-o quota=${ezjail_imagesize} -o compression=lzjb" if [ ${ezjail_imagesize} ]; then
ezjail_zfs_jail_properies="-o quota=${ezjail_imagesize} -o compression=lzjb"
fi
[ -d "${ezjail_jaildir}/${ezjail_hostname}" ] && exerr "Error: Could not create jail root mount point ${ezjail_rootdir}"
/sbin/zfs create -p -o mountpoint=${ezjail_rootdir} ${ezjail_zfs_jail_properies} ${ezjail_jailzfs}/${ezjail_hostname}
else
check_for_zfs_exist || exerr "Error: The existing destination is not a ZFS filesystem."
fi fi
[ -d "${ezjail_jaildir}/${ezjail_hostname}" ] && exerr "Error: Could not create jail root mount point ${ezjail_rootdir}"
/sbin/zfs create -p -o mountpoint=${ezjail_rootdir} ${ezjail_zfs_jail_properies} ${ezjail_jailzfs}/${ezjail_hostname}
;; ;;
esac esac