summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2008-07-16 04:25:35 +0000
committererdgeist <erdgeist@erdgeist.org>2008-07-16 04:25:35 +0000
commit0191e01c580da7b52886b460fb2fc4981d08ba45 (patch)
tree2ebd51ffd3305f69faab7d684716e83266ed5bbe
parent80d20cecdd2c30789351ac7ac6961fc8cab3c00e (diff)
Finally modernize behaviour of ezjail-admin update.
It no longer rebuilds the whole world by default. Also add a -u option that utilies freebsd-update to update the world.
-rwxr-xr-xezjail-admin20
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
41ezjail_usage_install="Usage: ${ezjail_admin} install [-mMpPsS] [-h host] [-r release]" 41ezjail_usage_install="Usage: ${ezjail_admin} install [-mMpPsS] [-h host] [-r release]"
42ezjail_usage_create="Usage: ${ezjail_admin} create [-xbi] [-f flavour] [-r jailroot] [-s size] [-c bde|eli] [-C args] [-a archive] jailname jailip" 42ezjail_usage_create="Usage: ${ezjail_admin} create [-xbi] [-f flavour] [-r jailroot] [-s size] [-c bde|eli] [-C args] [-a archive] jailname jailip"
43ezjail_usage_delete="Usage: ${ezjail_admin} delete [-w] jailname" 43ezjail_usage_delete="Usage: ${ezjail_admin} delete [-w] jailname"
44ezjail_usage_update="Usage: ${ezjail_admin} update [-s sourcetree] [-i] [-pP]" 44ezjail_usage_update="Usage: ${ezjail_admin} update [-s sourcetree] [-p] (-b|-i|-u|-P)"
45ezjail_usage_config="Usage: ${ezjail_admin} config [-r run|norun] [-n newname] [-i attach|detach|fsck] jailname" 45ezjail_usage_config="Usage: ${ezjail_admin} config [-r run|norun] [-n newname] [-i attach|detach|fsck] jailname"
46ezjail_usage_console="Usage: ${ezjail_admin} console [-f] [-e command] jailname" 46ezjail_usage_console="Usage: ${ezjail_admin} console [-f] [-e command] jailname"
47ezjail_usage_archive="Usage: ${ezjail_admin} archive [-Af] [-a archive] [-d archivedir] jailname [jailname...]" 47ezjail_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 ########################
658setup|update) 658setup|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."