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:
parent
8ecd24f223
commit
cc6ceaad9b
24
ezjail-admin
24
ezjail-admin
@ -388,6 +388,14 @@ check_for_zpool () {
|
||||
[ "${_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
|
||||
#
|
||||
@ -561,13 +569,17 @@ create)
|
||||
simple)
|
||||
ezjail_device=${ezjail_imagedevice}
|
||||
;;
|
||||
zfs)
|
||||
echo "ZFS: create the jail filesystem"
|
||||
if [ ${ezjail_imagesize} ]; then
|
||||
ezjail_zfs_jail_properies="-o quota=${ezjail_imagesize} -o compression=lzjb"
|
||||
zfs)
|
||||
if [ -z "${ezjail_exists}" ]; then
|
||||
echo "ZFS: create the jail filesystem"
|
||||
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
|
||||
[ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user