summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2011-03-14 01:31:14 +0000
committererdgeist <erdgeist@erdgeist.org>2011-03-14 01:31:14 +0000
commit283c672f391e73d0b83211f3763acfa13d6a6a41 (patch)
tree7c44e12ac5832238d477c275a19cd2d7c1e33bec
parentb3c7e95edbe869118f9e5a9c2e9495712fa42ee0 (diff)
Include experimental support for upgrading the basejail
-rwxr-xr-xezjail-admin21
-rw-r--r--man7/ezjail.712
-rw-r--r--man8/ezjail-admin.827
3 files changed, 54 insertions, 6 deletions
diff --git a/ezjail-admin b/ezjail-admin
index 418c89d..5f7fcdc 100755
--- a/ezjail-admin
+++ b/ezjail-admin
@@ -47,7 +47,7 @@ ezjail_usage_ezjailadmin="${ezjail_admin} v3.1.1b\nUsage: ${ezjail_admin} [archi
47ezjail_usage_install="Usage: ${ezjail_admin} install [-mMpPsS] [-h host] [-r release]" 47ezjail_usage_install="Usage: ${ezjail_admin} install [-mMpPsS] [-h host] [-r release]"
48ezjail_usage_create="Usage: ${ezjail_admin} create [-xbi] [-f flavour] [-r jailroot] [-s size] [-c bde|eli|zfs] [-C args] [-a archive] jailname jailip" 48ezjail_usage_create="Usage: ${ezjail_admin} create [-xbi] [-f flavour] [-r jailroot] [-s size] [-c bde|eli|zfs] [-C args] [-a archive] jailname jailip"
49ezjail_usage_delete="Usage: ${ezjail_admin} delete [-wf] jailname" 49ezjail_usage_delete="Usage: ${ezjail_admin} delete [-wf] jailname"
50ezjail_usage_update="Usage: ${ezjail_admin} update [-s sourcetree] [-p] (-b|-i|-u|-P)" 50ezjail_usage_update="Usage: ${ezjail_admin} update [-s sourcetree|sourceosversion] [-p] (-b|-i|-u|-U|-P)"
51ezjail_usage_config="Usage: ${ezjail_admin} config [-r run|norun] [-n newname] [-c cpuset] [-z zfs-datasets] [-f fib] [-i attach|detach|fsck] jailname" 51ezjail_usage_config="Usage: ${ezjail_admin} config [-r run|norun] [-n newname] [-c cpuset] [-z zfs-datasets] [-f fib] [-i attach|detach|fsck] jailname"
52ezjail_usage_console="Usage: ${ezjail_admin} console [-f] [-e command] jailname" 52ezjail_usage_console="Usage: ${ezjail_admin} console [-f] [-e command] jailname"
53ezjail_usage_archive="Usage: ${ezjail_admin} archive [-Af] [-a archive] [-d archivedir] jailname [jailname...]" 53ezjail_usage_archive="Usage: ${ezjail_admin} archive [-Af] [-a archive] [-d archivedir] jailname [jailname...]"
@@ -837,12 +837,13 @@ list)
837######################## ezjail-admin UPDATE ######################## 837######################## ezjail-admin UPDATE ########################
838setup|update) 838setup|update)
839 # Clean variables, prevent polution 839 # Clean variables, prevent polution
840 unset ezjail_provideports ezjail_installaction 840 unset ezjail_provideports ezjail_installaction ezjail_osversion_source ezjail_osversion_destination
841 841
842 shift; while getopts :biupPs: arg; do case ${arg} in 842 shift; while getopts :biupPs: arg; do case ${arg} in
843 b) ezjail_installaction="buildworld installworld";; 843 b) ezjail_installaction="buildworld installworld";;
844 i) ezjail_installaction="installworld";; 844 i) ezjail_installaction="installworld";;
845 u) ezjail_installaction="freebsd-update";; 845 u) ezjail_installaction="freebsd-update";;
846 U) ezjail_installaction="freebsd-upgrade";;
846 s) ezjail_sourcetree=${OPTARG};; 847 s) ezjail_sourcetree=${OPTARG};;
847 P) ezjail_provideports="YES"; ezjail_installaction="none";; 848 P) ezjail_provideports="YES"; ezjail_installaction="none";;
848 p) ezjail_provideports="YES";; 849 p) ezjail_provideports="YES";;
@@ -870,6 +871,22 @@ setup|update)
870 [ -z "$TERM" -o "$TERM" = "dumb" ] && ezjail_urgency="cron" || ezjail_urgency="fetch" 871 [ -z "$TERM" -o "$TERM" = "dumb" ] && ezjail_urgency="cron" || ezjail_urgency="fetch"
871 [ "${ezjail_use_zfs}" = "YES" ] && zfs snapshot ${ezjail_jailzfs}/basejail@`date -v -7d +"%C%y%m%d_%H:%M:%S"` 872 [ "${ezjail_use_zfs}" = "YES" ] && zfs snapshot ${ezjail_jailzfs}/basejail@`date -v -7d +"%C%y%m%d_%H:%M:%S"`
872 freebsd-update -b ${ezjail_jailbase} ${ezjail_urgency} install 873 freebsd-update -b ${ezjail_jailbase} ${ezjail_urgency} install
874 elif [ "${ezjail_installaction}" == "freebsd-upgrade" ]; then
875 [ -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."
876
877 [ -z "${ezjail_sourcetree}" ] && exerr "Error: Can not (yet automatically) infer the basejail's osversion.\n Please run ${ezjail_admin} update -U -s X.X-RELEASE, with X.X-RELEASE being to osversion currently installed in the basejail in need of an upgrade."
878
879 # That would be the part where we try to lookup the osversion from a file in the basejail
880 ezjail_osversion_source="${ezjail_sourcetree}"
881
882 # Make the host systems os version our target version
883 # Users can override this by setting the UNAME_r environment variable
884 ezjail_osversion_target="`uname -r`"
885
886 # Finally run freebsd-update to upgrade our basejail
887 env UNAME_r="${ezjail_osversion_source}" freebsd-update -b ${ezjail_jailbase} -r ${ezjail_osversion_target} upgrade install
888
889 # Here we should write the file with the new osversion in case of success
873 else 890 else
874 # Bump the user for some of the most common errors 891 # Bump the user for some of the most common errors
875 [ -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." 892 [ -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."
diff --git a/man7/ezjail.7 b/man7/ezjail.7
index cef662c..adf9eb0 100644
--- a/man7/ezjail.7
+++ b/man7/ezjail.7
@@ -566,6 +566,18 @@ Update the base jail to the next release using
566.Xr freebsd-update 8 566.Xr freebsd-update 8
567(i.e. using binary packages). This may be used only to update an 567(i.e. using binary packages). This may be used only to update an
568existing installation. 568existing installation.
569.It Nm Cm update Fl U s Ar 8.0-RELEASE
570Upgrade the base jail to the host system's release using
571.Xr freebsd-update 8 . This may be used only to upgrade an
572existing installation. Tell freebsd-update which OS version to expect
573in the basejail via the
574.Fl s No option.
575.Pp
576Note: Check
577.Xr uname 1
578and especially the
579.Pa UNAME_r
580environment variable to upgrade to different versions.
569.El 581.El
570.Ss Jail Creation Examples 582.Ss Jail Creation Examples
571.Bl -tag -width indent 583.Bl -tag -width indent
diff --git a/man8/ezjail-admin.8 b/man8/ezjail-admin.8
index 9af6866..250cd7e 100644
--- a/man8/ezjail-admin.8
+++ b/man8/ezjail-admin.8
@@ -54,9 +54,9 @@
54.Ar archive | jailname... 54.Ar archive | jailname...
55.Nm 55.Nm
56.Cm update 56.Cm update
57.Op Fl s Ar sourcetree 57.Op Fl s Ar sourcetree | sourceosversion
58.Op Fl p 58.Op Fl p
59.Fl b | Fl i | Fl P | Fl u 59.Fl b | Fl i | Fl P | Fl u | Fl U
60.Sh DESCRIPTION 60.Sh DESCRIPTION
61The 61The
62.Nm 62.Nm
@@ -535,6 +535,19 @@ uses
535to determine the currently running system, the base jail and the host 535to determine the currently running system, the base jail and the host
536need to be updated at the same time, without rebooting on the new 536need to be updated at the same time, without rebooting on the new
537kernel in the meantime. 537kernel in the meantime.
538.It Fl U
539Use
540.Xr freebsd-update 8
541to upgrade the basejail to the hosts operating system version, or a version
542you may pass freebsd-update's call to
543.Dq uname -r
544via the
545.Pa UNAME_r
546environment variable. Since there currently is no way of infering the
547osversion currently installed in the basejail, you need to remember the
548original osversion and pass it to this script using the
549.Fl s
550option.
538.It Fl P 551.It Fl P
539Install only the ports tree, assuming the basejail has already been 552Install only the ports tree, assuming the basejail has already been
540created. This can be done while jails are running. The 553created. This can be done while jails are running. The
@@ -548,13 +561,19 @@ The following options are available:
548Give the new basejail a copy of FreeBSD's ports tree. The 561Give the new basejail a copy of FreeBSD's ports tree. The
549.Xr portsnap 8 562.Xr portsnap 8
550utility is invoked to do the actual work. 563utility is invoked to do the actual work.
551.It Fl s Ar sourcedir 564.It Fl s Ar sourcedir | sourceosversion
552Use the sources in 565In the
566.Fl b No and Fl i No case: Use the sources in
553.Ar sourcedir 567.Ar sourcedir
554instead of 568instead of
555.Pa /usr/src . 569.Pa /usr/src .
556Variable: 570Variable:
557.Dq Li $ezjail_sourcetree . 571.Dq Li $ezjail_sourcetree .
572.Pp
573In the
574.Fl U No case: Pass this release tag to
575.Xr freebsd-update 8
576as the source OS version of the basejail.
558.El 577.El
559.Pp 578.Pp
560See the 579See the