diff options
-rwxr-xr-x | ezjail-admin | 49 |
1 files changed, 28 insertions, 21 deletions
diff --git a/ezjail-admin b/ezjail-admin index c9d6af7..d248126 100755 --- a/ezjail-admin +++ b/ezjail-admin | |||
@@ -373,33 +373,40 @@ create) | |||
373 | ezjail_devicelink="${ezjail_rootdir}.device" | 373 | ezjail_devicelink="${ezjail_rootdir}.device" |
374 | 374 | ||
375 | [ $? -eq 0 ] || detach_images || exerr "Error: Could not attach image device. (Command failed was 'mdconfig -a -t vnode -f ${ezjail_image}')" | 375 | [ $? -eq 0 ] || detach_images || exerr "Error: Could not attach image device. (Command failed was 'mdconfig -a -t vnode -f ${ezjail_image}')" |
376 | case ${ezjail_imagetype} in | 376 | fi |
377 | bde|eli) | 377 | |
378 | # parse imageparams, generate attachparams | 378 | case ${ezjail_imagetype} in |
379 | ezjail_attachblocking="YES" | 379 | bde|eli) |
380 | if [ "${ezjail_imageparams}" ]; then | 380 | # parse imageparams, generate attachparams |
381 | ezjail_attachparams=`echo $0 _parse_g${ezjail_imagetype}_attach_args_ ${ezjail_imageparams} | /bin/sh` | 381 | ezjail_attachblocking="YES" |
382 | [ 5 -eq $? ] && exerr "processing of ezjail_imageparams failed" | 382 | if [ "${ezjail_imageparams}" ]; then |
383 | [ 3 -eq $? ] && unset ezjail_attachblocking | 383 | ezjail_attachparams=`echo $0 _parse_g${ezjail_imagetype}_attach_args_ ${ezjail_imageparams} | /bin/sh` |
384 | fi | 384 | [ 5 -eq $? ] && exerr "processing of ezjail_imageparams failed" |
385 | case ${ezjail_imagetype} in | 385 | [ 3 -eq $? ] && unset ezjail_attachblocking |
386 | bde) init_cmd="gbde init /dev/${ezjail_imagedevice} ${ezjail_imageparams}" | 386 | fi |
387 | attach_cmd="gbde attach /dev/${ezjail_imagedevice} ${ezjail_attachparams}";; | 387 | case ${ezjail_imagetype} in |
388 | eli) init_cmd="geli init ${ezjail_imageparams} /dev/${ezjail_imagedevice}" | 388 | bde) init_cmd="gbde init /dev/${ezjail_imagedevice} ${ezjail_imageparams}" |
389 | attach_cmd="geli attach ${ezjail_attachparams} /dev/${ezjail_imagedevice}";; | 389 | attach_cmd="gbde attach /dev/${ezjail_imagedevice} ${ezjail_attachparams}";; |
390 | esac | 390 | eli) init_cmd="geli init ${ezjail_imageparams} /dev/${ezjail_imagedevice}" |
391 | attach_cmd="geli attach ${ezjail_attachparams} /dev/${ezjail_imagedevice}";; | ||
392 | esac | ||
393 | |||
394 | if [ -z "${ezjail_exists} ]; then | ||
391 | [ "${ezjail_attachblocking}" ] && echo "Initialising crypto device. You will be asked to enter a new passphrase twice... " | 395 | [ "${ezjail_attachblocking}" ] && echo "Initialising crypto device. You will be asked to enter a new passphrase twice... " |
392 | ( echo ${init_cmd} | /bin/sh ) || detach_images || exerr "Error: Could not initialise crypto image." | 396 | ( echo ${init_cmd} | /bin/sh ) || detach_images || exerr "Error: Could not initialise crypto image." |
393 | 397 | ||
394 | [ "${ezjail_attachblocking}" ] && echo "Attaching crypto device. You will be asked to enter the new passphrase... " | 398 | [ "${ezjail_attachblocking}" ] && echo "Attaching crypto device. You will be asked to enter the new passphrase... " |
395 | ( echo ${attach_cmd} | /bin/sh ) || detach_images || exerr "Error: Could not attach crypto image." | 399 | ( echo ${attach_cmd} | /bin/sh ) || detach_images || exerr "Error: Could not attach crypto image." |
396 | ezjail_device="${ezjail_imagedevice}.${ezjail_imagetype}" | 400 | fi |
397 | ;; | 401 | |
398 | simple) | 402 | ezjail_device="${ezjail_imagedevice}.${ezjail_imagetype}" |
399 | ezjail_device=${ezjail_imagedevice} | 403 | ;; |
400 | ;; | 404 | simple) |
401 | esac | 405 | ezjail_device=${ezjail_imagedevice} |
406 | ;; | ||
407 | esac | ||
402 | 408 | ||
409 | if [ -z "${ezjail_exists} ]; then | ||
403 | # Format memory image | 410 | # Format memory image |
404 | newfs -U "/dev/${ezjail_device}" || detach_images || exerr "Error: Could not newfs /dev/${ezjail_device}." | 411 | newfs -U "/dev/${ezjail_device}" || detach_images || exerr "Error: Could not newfs /dev/${ezjail_device}." |
405 | # Create mount point and mount | 412 | # Create mount point and mount |