summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2013-04-20 00:34:58 +0000
committererdgeist <erdgeist@erdgeist.org>2013-04-20 00:34:58 +0000
commite38c8e43ef26eacffdfeaba417ac564b13ff757d (patch)
tree936b80ad802ec84a24f20799d04fc03eb2d79219
parent11f04b1db06efda8ee3526cd22e8a29ba0e6ad67 (diff)
Check for parent filesystem when using an alternative one
-rwxr-xr-xezjail-admin11
1 files changed, 7 insertions, 4 deletions
diff --git a/ezjail-admin b/ezjail-admin
index f22b6f8..1081388 100755
--- a/ezjail-admin
+++ b/ezjail-admin
@@ -410,8 +410,9 @@ check_for_zpool () {
410check_for_zfs_exist () { 410check_for_zfs_exist () {
411 # check if the zfs we want to use already exists or not, return 0 if it does and 1 if not 411 # check if the zfs we want to use already exists or not, return 0 if it does and 1 if not
412 _exit=1 412 _exit=1
413 _zfs_status=`/sbin/zfs list -H -o name ${ezjail_parentfs}/${ezjail_hostname} 2> /dev/null` 413 _to_check=$1
414 [ "${_zfs_status}" = "${ezjail_parentfs}/${ezjail_hostname}" ] && _exit=0 414 _zfs_status=`/sbin/zfs list -H -o name ${_to_check} 2> /dev/null`
415 [ "${_zfs_status}" = "${_to_check}" ] && _exit=0
415 return ${_exit} 416 return ${_exit}
416} 417}
417 418
@@ -619,14 +620,16 @@ create)
619 ezjail_device=${ezjail_imagedevice} 620 ezjail_device=${ezjail_imagedevice}
620 ;; 621 ;;
621 zfs) 622 zfs)
622 ${ezjail_parentfs=${ezjail_jailzfs}} 623 : ${ezjail_parentfs=${ezjail_jailzfs}}
623 if [ -z "${ezjail_exists}" ]; then 624 if [ -z "${ezjail_exists}" ]; then
624 [ "${ezjail_imagesize}" ] && ezjail_zfs_jail_properties="${ezjail_zfs_jail_properties} -o quota=${ezjail_imagesize}" 625 [ "${ezjail_imagesize}" ] && ezjail_zfs_jail_properties="${ezjail_zfs_jail_properties} -o quota=${ezjail_imagesize}"
625 [ -d "${ezjail_jaildir}/${ezjail_hostname}" ] && exerr "Error: Could not create jail root mount point ${ezjail_rootdir}" 626 [ -d "${ezjail_jaildir}/${ezjail_hostname}" ] && exerr "Error: Could not create jail root mount point ${ezjail_rootdir}"
626 627
628 check_for_zfs_exist "${ezjail_parentfs} || exerr "Error: The parent zfs dataset does not exist.\n Use 'zfs create -p ${ezjail_parentfs}' to create it."
629
627 /sbin/zfs create -o mountpoint=${ezjail_rootdir} ${ezjail_zfs_jail_properties} ${ezjail_parentfs}/${ezjail_hostname} 630 /sbin/zfs create -o mountpoint=${ezjail_rootdir} ${ezjail_zfs_jail_properties} ${ezjail_parentfs}/${ezjail_hostname}
628 else 631 else
629 check_for_zfs_exist || exerr "Error: The existing destination is not a ZFS filesystem." 632 check_for_zfs_exist "${ezjail_parentfs}/${ezjail_hostname}" || exerr "Error: The existing destination is not a ZFS filesystem."
630 fi 633 fi
631 ;; 634 ;;
632 635