From aac83f659118689e773949aa139336a72b7c0546 Mon Sep 17 00:00:00 2001 From: Philipp Wuensche Date: Wed, 14 Aug 2019 14:27:45 +0200 Subject: Add -K option to install, which can be used to upgrade basejail to a newer FreeBSD version without loosing old libs inside the basejail. Could replace "update -U". --- ezjail-admin | 7 ++++--- man8/ezjail-admin.8 | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ezjail-admin b/ezjail-admin index 609907d..a58eece 100755 --- a/ezjail-admin +++ b/ezjail-admin @@ -42,7 +42,7 @@ case `uname -p` in amd64) ezjail_dirlist="${ezjail_dirlist} usr/lib32"; ezjail_b # Synopsis messages ezjail_usage_ezjailadmin="${ezjail_admin} v3.4.2\nUsage: ${ezjail_admin} [archive|config|console|create|delete|freeze|install|list|restore|snapshot|troubleshoot|update] {params}" -ezjail_usage_install="Usage: ${ezjail_admin} install [-mMpPsS] [-h host] [-r release]" +ezjail_usage_install="Usage: ${ezjail_admin} install [-mMpPsSK] [-h host] [-r release]" ezjail_usage_create="Usage: ${ezjail_admin} create [-xbi] [-f flavour] [-r jailroot] [-s size] [-c bde|eli|zfs] [-C args] [-a archive] [-z parentzfs] jailname jailip" ezjail_usage_delete="Usage: ${ezjail_admin} delete [-wf] jailname" ezjail_usage_update="Usage: ${ezjail_admin} update [-s sourcetree|sourceosversion] [-p] (-b|-i|-u|-U|-P)" @@ -286,7 +286,7 @@ ezjail_splitworld() { # directories with permission 0700 which is bad mkdir -p "${ezjail_jailbase}/usr" for dir in ${ezjail_dirlist}; do - find ${dir} | cpio -d -p -v "${ezjail_jailbase}" || exerr "Error: Installation of ${dir} failed." + find ${dir} | cpio -d -p -v ${ezjail_keep_basejail} "${ezjail_jailbase}" || exerr "Error: Installation of ${dir} failed." chflags -R noschg ${dir}; rm -r ${dir}; ln -s /basejail/${dir} ${dir} done mkdir basejail @@ -1067,7 +1067,7 @@ install) # Clean variables, prevent pollution unset ezjail_release ezjail_installmanpages ezjail_installports ezjail_installsources ezjail_dir ezjail_ftpserverqueried ezjail_proto ezjail_disturi - shift; while getopts :mMpPsSh:r: arg; do case ${arg} in + shift; while getopts :mMpPsSh:Kr: arg; do case ${arg} in m) ezjail_installmanpages=" manpages";; M) ezjail_installmanpages=" manpages"; unset ezjail_basesystem;; s) ezjail_installsources=" src";; @@ -1075,6 +1075,7 @@ install) p) ezjail_installports="YES";; P) ezjail_installports="YES"; unset ezjail_basesystem;; h) ezjail_ftphost=${OPTARG};; + K) ezjail_keep_basejail="-u";; r) ezjail_release=${OPTARG};; ?) exerr ${ezjail_usage_install};; esac; done; shift $(( ${OPTIND} - 1 )) diff --git a/man8/ezjail-admin.8 b/man8/ezjail-admin.8 index f40f73a..5274f2d 100644 --- a/man8/ezjail-admin.8 +++ b/man8/ezjail-admin.8 @@ -6,7 +6,7 @@ .Nd Administrate ezjail environment .Sh SYNOPSIS .Nm Cm install -.Op Fl mMpPsS +.Op Fl mMpPsSK .Op Fl h Ar host .Op Fl r Ar release .Nm @@ -123,6 +123,9 @@ for details or .Xr portsnap 8 . .It Fl P Fetch and extract a ports tree, without (re)installing the base jail. +.It Fl K +Reinstall the base jail and the new jail template. Can be used together with -r +to upgrade both to a newer FreeBSD version. .It Fl h Ar host Set the remote host to fetch FreeBSD distribution sets from. If absent the default host -- cgit v1.2.3