diff options
author | erdgeist <erdgeist@erdgeist.org> | 2010-02-08 05:05:04 +0000 |
---|---|---|
committer | erdgeist <erdgeist@erdgeist.org> | 2010-02-08 05:05:04 +0000 |
commit | bd9c44955201b34fa55d2d9821b2031fca0433ba (patch) | |
tree | fbafc69435ed61b11666a90bc9c4f2b309070de5 | |
parent | 9d981caa73abde57e9e3a43ea97adb5a2c278247 (diff) |
Consider this to be the second part of the changes that started in 1.247
We no allow multiple flavours to be installed at once, feed them space separated to the -f option in ezjail-admin create
This installs several ezjail.flavour scripts into / of the new jail, enumerating them /ezjail.flavour.0001 through 9999
It also adds a new script to /etc/rc.d/ezjail-config in the new jail which executes /ezjail.flavour.* as it finds them.
On an unrelated note ezjail-admin delete and console will now use the onestop and onestart parameters if used with -f, so they even work with ezjail_enable not set.
-rwxr-xr-x | ezjail-admin | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/ezjail-admin b/ezjail-admin index 86787dd..2ea7328 100755 --- a/ezjail-admin +++ b/ezjail-admin | |||
@@ -128,7 +128,7 @@ detach_images () { | |||
128 | # Find and execute our rc script | 128 | # Find and execute our rc script |
129 | start_stop_jail_by_script () { | 129 | start_stop_jail_by_script () { |
130 | ezjail_action=$1 | 130 | ezjail_action=$1 |
131 | [ "${ezjail_action}" = "start" ] && ezjail_success_check="-n" || ezjail_success_check="-z" | 131 | [ "${ezjail_action}" = "onestart" ] && ezjail_success_check="-n" || ezjail_success_check="-z" |
132 | 132 | ||
133 | # Try to locate and run ezjails rc.d script | 133 | # Try to locate and run ezjails rc.d script |
134 | if [ -x "${ezjail_prefix}/etc/rc.d/ezjail" ]; then | 134 | if [ -x "${ezjail_prefix}/etc/rc.d/ezjail" ]; then |
@@ -399,7 +399,7 @@ check_for_zfs_exist () { | |||
399 | 399 | ||
400 | ############################# | 400 | ############################# |
401 | # End of function definitions | 401 | # End of function definitions |
402 | # " | 402 | # |
403 | 403 | ||
404 | # check for command | 404 | # check for command |
405 | [ $# -gt 0 ] || exerr ${ezjail_usage_ezjailadmin} | 405 | [ $# -gt 0 ] || exerr ${ezjail_usage_ezjailadmin} |
@@ -494,7 +494,7 @@ create) | |||
494 | 494 | ||
495 | # do some sanity checks on the selected flavour (if any) | 495 | # do some sanity checks on the selected flavour (if any) |
496 | for ezjail_flavour in ${ezjail_flavours}; do | 496 | for ezjail_flavour in ${ezjail_flavours}; do |
497 | [-d "${ezjail_flavours_dir}/${ezjail_flavour}" ] || exerr "Error: Flavour config directory ${ezjail_flavours_dir}/${ezjail_flavour} not found.\n Refer to ${ezjail_admin}s man page for details on flavours." | 497 | [ -d "${ezjail_flavours_dir}/${ezjail_flavour}" ] || exerr "Error: Flavour config directory ${ezjail_flavours_dir}/${ezjail_flavour} not found.\n Refer to ${ezjail_admin}s man page for details on flavours." |
498 | done | 498 | done |
499 | 499 | ||
500 | # check for restore circumstances, normally this is invoked by the restore command | 500 | # check for restore circumstances, normally this is invoked by the restore command |
@@ -640,7 +640,7 @@ create) | |||
640 | 640 | ||
641 | # Final steps for flavour installation | 641 | # Final steps for flavour installation |
642 | if [ -z "${ezjail_exists}" ]; then | 642 | if [ -z "${ezjail_exists}" ]; then |
643 | _installed_flavours=0 | 643 | installed_flavours=0 |
644 | for ezjail_flavour in ${ezjail_flavours}; do | 644 | for ezjail_flavour in ${ezjail_flavours}; do |
645 | # install files and config to new jail | 645 | # install files and config to new jail |
646 | cd "${ezjail_flavours_dir}/${ezjail_flavour}" && find . | cpio -p -u -v "${ezjail_rootdir}" > /dev/null | 646 | cd "${ezjail_flavours_dir}/${ezjail_flavour}" && find . | cpio -p -u -v "${ezjail_rootdir}" > /dev/null |
@@ -652,20 +652,20 @@ create) | |||
652 | # If a config is found, make it auto run on jails startup | 652 | # If a config is found, make it auto run on jails startup |
653 | if [ -f "${ezjail_rootdir}/ezjail.flavour" ]; then | 653 | if [ -f "${ezjail_rootdir}/ezjail.flavour" ]; then |
654 | chmod 0755 "${ezjail_rootdir}/ezjail.flavour" | 654 | chmod 0755 "${ezjail_rootdir}/ezjail.flavour" |
655 | mv "${ezjail_rootdir}/ezjail.flavour" "${ezjail_rootdir}/ezjail.flavour".`printf %04d ${_installed_flavours}` | 655 | mv "${ezjail_rootdir}/ezjail.flavour" "${ezjail_rootdir}/ezjail.flavour".`printf %04d $(( installed_flavours+=1 ))` |
656 | echo "Note: Shell scripts for flavour ${ezjail_flavour} installed, flavourizing on jails first startup." | 656 | echo "Note: Shell scripts for flavour ${ezjail_flavour} installed, flavourizing on jails first startup." |
657 | fi | 657 | fi |
658 | 658 | ||
659 | echo << "EOF" | 659 | cat > "${ezjail_rootdir}/etc/rc.d/ezjail-config" <<"EOF" |
660 | #!/bin/sh | 660 | #!/bin/sh |
661 | # | 661 | # |
662 | # BEFORE: DAEMON | 662 | # BEFORE: DAEMON |
663 | # PROVIDES: ezjail-config | 663 | # PROVIDES: ezjail-config |
664 | # | 664 | # |
665 | case "$1" in | 665 | case "$1" in |
666 | start) | 666 | *start) |
667 | rm -f "${0}" | 667 | rm -f "${0}" |
668 | for ezjail_flavour in /ezjail.flavour*; do | 668 | for ezjail_flavour in /ezjail.flavour.*; do |
669 | [ -x "${ezjail_flavour}" ] && "${ezjail_flavour}" | 669 | [ -x "${ezjail_flavour}" ] && "${ezjail_flavour}" |
670 | rm -f "${ezjail_flavour}" | 670 | rm -f "${ezjail_flavour}" |
671 | done | 671 | done |
@@ -673,9 +673,8 @@ case "$1" in | |||
673 | *) | 673 | *) |
674 | ;; | 674 | ;; |
675 | esac | 675 | esac |
676 | |||
677 | EOF | 676 | EOF |
678 | > "${ezjail_rootdir}/etc/rc.d/ezjail-config" | 677 | chmod 0755 "${ezjail_rootdir}/etc/rc.d/ezjail-config" |
679 | done | 678 | done |
680 | fi | 679 | fi |
681 | 680 | ||
@@ -735,7 +734,7 @@ delete) | |||
735 | [ "${ezjail_forcestop}" ] || exerr "Error: Jail appears to be still running.\n '${ezjail_admin} stop ${ezjail_name}' it first or use '${ezjail_admin} delete -f ${ezjail_name}' to force stop." | 734 | [ "${ezjail_forcestop}" ] || exerr "Error: Jail appears to be still running.\n '${ezjail_admin} stop ${ezjail_name}' it first or use '${ezjail_admin} delete -f ${ezjail_name}' to force stop." |
736 | 735 | ||
737 | # This one will also exerr on failure | 736 | # This one will also exerr on failure |
738 | start_stop_jail_by_script stop | 737 | start_stop_jail_by_script onestop |
739 | fi | 738 | fi |
740 | 739 | ||
741 | if [ "${ezjail_attached}" ]; then | 740 | if [ "${ezjail_attached}" ]; then |
@@ -1002,7 +1001,7 @@ console) | |||
1002 | [ "$ezjail_forcestart}" ] || exerr "Error: Jail ${ezjail_name} appears not to be running\n Start it first, or use '${ezjail_admin} console -f ${ezjail_name}' to force start." | 1001 | [ "$ezjail_forcestart}" ] || exerr "Error: Jail ${ezjail_name} appears not to be running\n Start it first, or use '${ezjail_admin} console -f ${ezjail_name}' to force start." |
1003 | 1002 | ||
1004 | # This one will also exerr on failure | 1003 | # This one will also exerr on failure |
1005 | start_stop_jail_by_script start | 1004 | start_stop_jail_by_script onestart |
1006 | fi | 1005 | fi |
1007 | 1006 | ||
1008 | # use the jails FIB if there is one | 1007 | # use the jails FIB if there is one |