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
12
ezjail-admin
12
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."
|
[ "${_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)
|
||||||
|
if [ -z "${ezjail_exists}" ]; then
|
||||||
echo "ZFS: create the jail filesystem"
|
echo "ZFS: create the jail filesystem"
|
||||||
if [ ${ezjail_imagesize} ]; then
|
if [ ${ezjail_imagesize} ]; then
|
||||||
ezjail_zfs_jail_properies="-o quota=${ezjail_imagesize} -o compression=lzjb"
|
ezjail_zfs_jail_properies="-o quota=${ezjail_imagesize} -o compression=lzjb"
|
||||||
fi
|
fi
|
||||||
[ -d "${ezjail_jaildir}/${ezjail_hostname}" ] && exerr "Error: Could not create jail root mount point ${ezjail_rootdir}"
|
[ -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}
|
/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
|
||||||
;;
|
;;
|
||||||
|
|
||||||
esac
|
esac
|
||||||
|
Loading…
x
Reference in New Issue
Block a user