diff options
| author | cryx <cryx@h3q.com> | 2009-05-24 14:11:23 +0000 |
|---|---|---|
| committer | cryx <cryx@h3q.com> | 2009-05-24 14:11:23 +0000 |
| commit | 18ff633ddc11657ef4f790b0daa2ac5e296d8094 (patch) | |
| tree | 513422cc74db1352fb9b1de3423be31d24cdc0d9 | |
| parent | 835d1b588574ea024b1445ce7cc0a7bee6d22bcd (diff) | |
Do the testing in a nicer way.
| -rwxr-xr-x | ezjail-admin | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/ezjail-admin b/ezjail-admin index 79233ce..e004b97 100755 --- a/ezjail-admin +++ b/ezjail-admin | |||
| @@ -339,7 +339,7 @@ check_for_zfs () { | |||
| 339 | # check if ZFS is enabled when managing basejail/newjail in ZFS | 339 | # check if ZFS is enabled when managing basejail/newjail in ZFS |
| 340 | . /etc/rc.subr | 340 | . /etc/rc.subr |
| 341 | load_rc_config_var zfs zfs_enable | 341 | load_rc_config_var zfs zfs_enable |
| 342 | if [ "${ezjail_use_zfs}" = "YES" ] && [ "${zfs_enable}" != "YES" ]; then | 342 | if [ "${ezjail_use_zfs}" = "YES" -a "${zfs_enable}" != "YES" ]; then |
| 343 | echo "WARNING: You should enable ZFS in /etc/rc.conf" | 343 | echo "WARNING: You should enable ZFS in /etc/rc.conf" |
| 344 | fi | 344 | fi |
| 345 | } | 345 | } |
| @@ -483,7 +483,7 @@ create) | |||
| 483 | case ${ezjail_imagetype} in bde|eli) ezjail_sourcedevice="/dev/random";; simple) ezjail_sourcedevice="/dev/zero";; esac | 483 | case ${ezjail_imagetype} in bde|eli) ezjail_sourcedevice="/dev/random";; simple) ezjail_sourcedevice="/dev/zero";; esac |
| 484 | 484 | ||
| 485 | # If NOT exist and imagetype not ZFS, create image | 485 | # If NOT exist and imagetype not ZFS, create image |
| 486 | if [ -z "${ezjail_exists}" ] && [ ! ${ezjail_imagetype} = "zfs" ]; then | 486 | if [ -z "${ezjail_exists}" -a ${ezjail_imagetype} != "zfs" ]; then |
| 487 | [ -e "${ezjail_image}" ] && exerr "Error: A file exists at ${ezjail_image}.\n Won't overwrite an existing image." | 487 | [ -e "${ezjail_image}" ] && exerr "Error: A file exists at ${ezjail_image}.\n Won't overwrite an existing image." |
| 488 | 488 | ||
| 489 | # Now create jail disc image | 489 | # Now create jail disc image |
| @@ -541,7 +541,7 @@ create) | |||
| 541 | 541 | ||
| 542 | esac | 542 | esac |
| 543 | 543 | ||
| 544 | if [ -z "${ezjail_exists}" ] && [ ! ${ezjail_imagetype} = "zfs" ]; then | 544 | if [ -z "${ezjail_exists}" -a ${ezjail_imagetype} != "zfs" ]; then |
| 545 | # Format memory image | 545 | # Format memory image |
| 546 | newfs -U "/dev/${ezjail_device}" || detach_images || exerr "Error: Could not newfs /dev/${ezjail_device}." | 546 | newfs -U "/dev/${ezjail_device}" || detach_images || exerr "Error: Could not newfs /dev/${ezjail_device}." |
| 547 | # Create mount point and mount | 547 | # Create mount point and mount |
| @@ -564,7 +564,7 @@ create) | |||
| 564 | [ $? -eq 0 ] || detach_images || exerr "Error: Could not extract archive from ${ezjail_fromarchive}." | 564 | [ $? -eq 0 ] || detach_images || exerr "Error: Could not extract archive from ${ezjail_fromarchive}." |
| 565 | elif [ -z "${ezjail_exists}" ]; then | 565 | elif [ -z "${ezjail_exists}" ]; then |
| 566 | # now take a copy of our template jail | 566 | # now take a copy of our template jail |
| 567 | if [ "${ezjail_imagetype}" = "zfs" ] && [ "${ezjail_use_zfs}" = "YES" ]; then | 567 | if [ "${ezjail_imagetype}" = "zfs" -a "${ezjail_use_zfs}" = "YES" ]; then |
| 568 | # create ZFS filesystem first when using ZFS | 568 | # create ZFS filesystem first when using ZFS |
| 569 | /sbin/zfs snapshot ${ezjail_jailzfs}/newjail@_createnewjailtmp | 569 | /sbin/zfs snapshot ${ezjail_jailzfs}/newjail@_createnewjailtmp |
| 570 | /sbin/zfs send ${ezjail_jailzfs}/newjail@_createnewjailtmp | zfs receive -F ${ezjail_jailzfs}/${ezjail_hostname} | 570 | /sbin/zfs send ${ezjail_jailzfs}/newjail@_createnewjailtmp | zfs receive -F ${ezjail_jailzfs}/${ezjail_hostname} |
| @@ -650,7 +650,7 @@ create) | |||
| 650 | [ $? -eq 0 ] && echo -e "Warning: Some services already seem to be listening on all IP, (including ${ezjail_ip})\n This may cause some confusion, here they are:\n${ezjail_listener}" | 650 | [ $? -eq 0 ] && echo -e "Warning: Some services already seem to be listening on all IP, (including ${ezjail_ip})\n This may cause some confusion, here they are:\n${ezjail_listener}" |
| 651 | IFS=${TIFS} | 651 | IFS=${TIFS} |
| 652 | 652 | ||
| 653 | [ "${ezjail_imagetype}" ] && [ "${ezjail_imagetype}" != "zfs" ] && echo "Note: To administrate your image jail, attach it using the '${ezjail_admin} config -i attach ${ezjail_hostname}' command." | 653 | [ "${ezjail_imagetype}" -a "${ezjail_imagetype}" != "zfs" ] && echo "Note: To administrate your image jail, attach it using the '${ezjail_admin} config -i attach ${ezjail_hostname}' command." |
| 654 | ;; | 654 | ;; |
| 655 | ######################## ezjail-admin DELETE ######################## | 655 | ######################## ezjail-admin DELETE ######################## |
| 656 | delete) | 656 | delete) |
