summaryrefslogtreecommitdiff
path: root/ezjail-admin
diff options
context:
space:
mode:
authorcryx <cryx@h3q.com>2010-01-15 13:38:23 +0000
committercryx <cryx@h3q.com>2010-01-15 13:38:23 +0000
commitcc6ceaad9bb3ef70f231ad09ab857a0e79eb302f (patch)
tree8671706cb207788fc183e0bcb400944d96abbb2d /ezjail-admin
parent8ecd24f223cd43a723720ef11bd79c4d00c4b666 (diff)
Respect the -x option when creating a ZFS backed jail, do a check if the destinatiuon really is ZFS filesystem!
Diffstat (limited to 'ezjail-admin')
-rwxr-xr-xezjail-admin24
1 files changed, 18 insertions, 6 deletions
diff --git a/ezjail-admin b/ezjail-admin
index 585823a..557ae9e 100755
--- a/ezjail-admin
+++ b/ezjail-admin
@@ -388,6 +388,14 @@ check_for_zpool () {
388 [ "${_zpoolstatus}" = "ONLINE" -o "${_zpoolstatus}" = "DEGRADED" ] || exerr "Error: Your zpool does not exist or is not online." 388 [ "${_zpoolstatus}" = "ONLINE" -o "${_zpoolstatus}" = "DEGRADED" ] || exerr "Error: Your zpool does not exist or is not online."
389} 389}
390 390
391check_for_zfs_exist () {
392 # check if the zfs we want to use already exists or not, return 0 if it does and 1 if not
393 _exit=1
394 _zfs_status=`/sbin/zfs list -H -o name ${ezjail_jailzfs}/${ezjail_hostname} 2> /dev/null`
395 [ "${_zfs_status}" = "${ezjail_jailzfs}/${ezjail_hostname}" ] && _exit=0
396 return ${_exit}
397}
398
391############################# 399#############################
392# End of function definitions 400# End of function definitions
393# 401#
@@ -561,13 +569,17 @@ create)
561 simple) 569 simple)
562 ezjail_device=${ezjail_imagedevice} 570 ezjail_device=${ezjail_imagedevice}
563 ;; 571 ;;
564 zfs) 572 zfs)
565 echo "ZFS: create the jail filesystem" 573 if [ -z "${ezjail_exists}" ]; then
566 if [ ${ezjail_imagesize} ]; then 574 echo "ZFS: create the jail filesystem"
567 ezjail_zfs_jail_properies="-o quota=${ezjail_imagesize} -o compression=lzjb" 575 if [ ${ezjail_imagesize} ]; then
576 ezjail_zfs_jail_properies="-o quota=${ezjail_imagesize} -o compression=lzjb"
577 fi
578 [ -d "${ezjail_jaildir}/${ezjail_hostname}" ] && exerr "Error: Could not create jail root mount point ${ezjail_rootdir}"
579 /sbin/zfs create -p -o mountpoint=${ezjail_rootdir} ${ezjail_zfs_jail_properies} ${ezjail_jailzfs}/${ezjail_hostname}
580 else
581 check_for_zfs_exist || exerr "Error: The existing destination is not a ZFS filesystem."
568 fi 582 fi
569 [ -d "${ezjail_jaildir}/${ezjail_hostname}" ] && exerr "Error: Could not create jail root mount point ${ezjail_rootdir}"
570 /sbin/zfs create -p -o mountpoint=${ezjail_rootdir} ${ezjail_zfs_jail_properies} ${ezjail_jailzfs}/${ezjail_hostname}
571 ;; 583 ;;
572 584
573 esac 585 esac