From e86bd108c7fdb7267af64aae18197fe0fd5d5a8c Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 31 Dec 2021 06:15:26 +0100 Subject: Merging upstream version 20211231. Signed-off-by: Daniel Baumann --- CHANGELOG.txt | 8 ++++++ VERSION.txt | 2 +- libexec/container/update | 59 ++++++++++++++++++++++++++++++++++++++-- share/man/container-update.1.rst | 3 ++ 4 files changed, 68 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 213e516..d992a85 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,11 @@ +2021-12-31 Daniel Baumann + + * Releasing version 20211231. + + [ Daniel Baumann ] + * Adding interactive option to container update command to ease skipping containers. + * Making name argument mandatory in container update command. + 2021-11-17 Daniel Baumann * Releasing version 20211117. diff --git a/VERSION.txt b/VERSION.txt index 530e4a5..9e7c11d 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -20211117 +20211231 diff --git a/libexec/container/update b/libexec/container/update index adfee65..c5ff6c2 100755 --- a/libexec/container/update +++ b/libexec/container/update @@ -28,8 +28,8 @@ HOOKS="/etc/${SOFTWARE}/hooks" Parameters () { - GETOPT_LONGOPTIONS="name:,full-upgrade,autoremove,purge,yes," - GETOPT_OPTIONS="n:,f,r,p,y," + GETOPT_LONGOPTIONS="name:,full-upgrade,interactive,autoremove,purge,yes," + GETOPT_OPTIONS="n:,f,i,r,p,y," PARAMETERS="$(getopt --longoptions ${GETOPT_LONGOPTIONS} --name=${COMMAND} --options ${GETOPT_OPTIONS} --shell sh -- ${@})" @@ -54,6 +54,11 @@ Parameters () shift 1 ;; + -i|--interactive) + INTERACTIVE="true" + shift 1 + ;; + -r|--autoremove) AUTOREMOVE="true" shift 1 @@ -84,7 +89,7 @@ Parameters () Usage () { - echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME [-f|--full-upgrade] [-r|--autoremove] [-p|--purge] [-y|--yes]" >&2 + echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME [-f|--full-upgrade] [-i|--interactive] [-r|--autoremove] [-p|--purge] [-y|--yes]" >&2 echo echo "See ${COMMAND}(1), ${PROGRAM}(1) and ${PROJECT}(7) for more information." @@ -93,6 +98,11 @@ Usage () Parameters "${@}" +if [ -z "${NAME}" ] +then + Usage +fi + Notification () { TYPE="${1}" @@ -152,9 +162,52 @@ do fi done +if [ $(echo ${NAMES} | wc -w) -gt 1 ] +then + NAME_LOOP="true" +else + NAME_LOOP="false" +fi + # Run for NAME in ${NAMES} do + case "${INTERACTIVE}" in + true) + case "${NAME_LOOP}" in + true) + echo + ;; + esac + + echo -n "'${NAME}': update container '${NAME}' [y|N|a]? " + read UPDATE + + UPDATE="$(echo ${UPDATE} | tr '[A-Z]' '[a-z]')" + + case "${UPDATE}" in + a|all) + INTERACTIVE="false" + ;; + + y|yes) + ;; + + *) + case "${NAME_LOOP}" in + true) + continue + ;; + + *) + exit 1 + ;; + esac + ;; + esac + ;; + esac + echo "################################################################################" echo "Updating ${NAME}" echo "################################################################################" diff --git a/share/man/container-update.1.rst b/share/man/container-update.1.rst index 7b17ae2..58dcb73 100644 --- a/share/man/container-update.1.rst +++ b/share/man/container-update.1.rst @@ -50,6 +50,9 @@ The following **container update** options are available: -f, --full-upgrade: Runs an additional 'apt full-upgrade' after 'apt upgrade'. +-i, --interactive: + Prompt before every container update. + -r, --autoremove: Runs an additional 'apt autoremove' after 'apt upgrade'. -- cgit v1.2.3