diff options
-rwxr-xr-x | ezjail-admin | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/ezjail-admin b/ezjail-admin index 343cd58..7224d5c 100755 --- a/ezjail-admin +++ b/ezjail-admin | |||
@@ -41,7 +41,7 @@ ezjail_usage_ezjailadmin="${ezjail_admin} v3.0b\nUsage: ${ezjail_admin} [archive | |||
41 | ezjail_usage_install="Usage: ${ezjail_admin} install [-mMpPsS] [-h host] [-r release]" | 41 | ezjail_usage_install="Usage: ${ezjail_admin} install [-mMpPsS] [-h host] [-r release]" |
42 | ezjail_usage_create="Usage: ${ezjail_admin} create [-xbi] [-f flavour] [-r jailroot] [-s size] [-c bde|eli] [-C args] [-a archive] jailname jailip" | 42 | ezjail_usage_create="Usage: ${ezjail_admin} create [-xbi] [-f flavour] [-r jailroot] [-s size] [-c bde|eli] [-C args] [-a archive] jailname jailip" |
43 | ezjail_usage_delete="Usage: ${ezjail_admin} delete [-w] jailname" | 43 | ezjail_usage_delete="Usage: ${ezjail_admin} delete [-w] jailname" |
44 | ezjail_usage_update="Usage: ${ezjail_admin} update [-s sourcetree] [-i] [-pP]" | 44 | ezjail_usage_update="Usage: ${ezjail_admin} update [-s sourcetree] [-p] (-b|-i|-u|-P)" |
45 | ezjail_usage_config="Usage: ${ezjail_admin} config [-r run|norun] [-n newname] [-i attach|detach|fsck] jailname" | 45 | ezjail_usage_config="Usage: ${ezjail_admin} config [-r run|norun] [-n newname] [-i attach|detach|fsck] jailname" |
46 | ezjail_usage_console="Usage: ${ezjail_admin} console [-f] [-e command] jailname" | 46 | ezjail_usage_console="Usage: ${ezjail_admin} console [-f] [-e command] jailname" |
47 | ezjail_usage_archive="Usage: ${ezjail_admin} archive [-Af] [-a archive] [-d archivedir] jailname [jailname...]" | 47 | ezjail_usage_archive="Usage: ${ezjail_admin} archive [-Af] [-a archive] [-d archivedir] jailname [jailname...]" |
@@ -657,23 +657,33 @@ list) | |||
657 | ######################## ezjail-admin UPDATE ######################## | 657 | ######################## ezjail-admin UPDATE ######################## |
658 | setup|update) | 658 | setup|update) |
659 | # Clean variables, prevent polution | 659 | # Clean variables, prevent polution |
660 | unset ezjail_provideports | 660 | unset ezjail_provideports ezjail_installaction |
661 | ezjail_installaction="world" | ||
662 | 661 | ||
663 | shift; while getopts :ipPs: arg; do case ${arg} in | 662 | shift; while getopts :biupPs: arg; do case ${arg} in |
663 | b) ezjail_installaction="buildworld installword";; | ||
664 | i) ezjail_installaction="installworld";; | 664 | i) ezjail_installaction="installworld";; |
665 | u) ezjail_installaction="freebsd-update";; | ||
665 | s) ezjail_sourcetree=${OPTARG};; | 666 | s) ezjail_sourcetree=${OPTARG};; |
666 | p) ezjail_provideports="YES";; | ||
667 | P) ezjail_provideports="YES"; ezjail_installaction="none";; | 667 | P) ezjail_provideports="YES"; ezjail_installaction="none";; |
668 | p) ezjail_provideports="YES";; | ||
668 | ?) exerr ${ezjail_usage_update};; | 669 | ?) exerr ${ezjail_usage_update};; |
669 | esac; done; shift $(( ${OPTIND} - 1 )) | 670 | esac; done; shift $(( ${OPTIND} - 1 )) |
670 | 671 | ||
671 | [ $# -eq 0 ] || exerr ${ezjail_usage_update} | 672 | [ $# -eq 0 ] || exerr ${ezjail_usage_update} |
672 | 673 | ||
674 | # Check if some action was requested | ||
675 | [ "${ezjail_installaction}" ] || exerr "Error: No install action has been chosen.\n Please note that ezjails behaviour changed. Rebuilding the world no longer is default.\n Run '${ezjail_admin} update -b' to build and install a world from source or '${ezjail_admin} update -i' to install an already built world." | ||
676 | |||
673 | if [ "${ezjail_installaction}" = "none" ]; then | 677 | if [ "${ezjail_installaction}" = "none" ]; then |
674 | # check, whether ezjail has been setup correctly. existence of | 678 | # check, whether ezjail has been setup correctly. existence of |
675 | # ezjail_jailbase is our indicator | 679 | # ezjail_jailbase is our indicator |
676 | [ -d "${ezjail_jailbase}" ] || exerr "Error: base jail does not exist.\n You cannot fill base jails ports tree before creating it.\n Please run '${ezjail_admin} update' or '${ezjail_admin} install' first." | 680 | [ -d "${ezjail_jailbase}" ] || exerr "Error: base jail does not exist.\n You cannot fill base jails ports tree before creating it.\n Please run '${ezjail_admin} update' or '${ezjail_admin} install' first." |
681 | elif [ "${ezjail_installaction}" = "freebsd-update" ]; then | ||
682 | [ -d "${ezjail_jailbase}" ] || exerr "Error: base jail does not exist.\n You cannot update a base jail until it is created.\n Please run '${ezjail_admin} update' or '${ezjail_admin} install' first." | ||
683 | |||
684 | # If ran from cron be kind to freebsds update servers and sleep first | ||
685 | [ -z "$TERM" -o "$TERM" = "dumb" ] && sleep $(( ${RANDOM} % 3600 )) | ||
686 | freebsd-update -b ${ezjail_jailbase} fetch install | ||
677 | else | 687 | else |
678 | # Bump the user for some of the most common errors | 688 | # Bump the user for some of the most common errors |
679 | [ -d "${ezjail_sourcetree}" ] || exerr "Error: Cannot find your copy of the FreeBSD source tree in ${ezjail_sourcetree}.\n Consider using '${ezjail_admin} install' to create the base jail from an ftp server." | 689 | [ -d "${ezjail_sourcetree}" ] || exerr "Error: Cannot find your copy of the FreeBSD source tree in ${ezjail_sourcetree}.\n Consider using '${ezjail_admin} install' to create the base jail from an ftp server." |