summaryrefslogtreecommitdiffstats
path: root/libexec/container
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@open-infrastructure.net>2021-12-10 00:16:57 +0000
committerDaniel Baumann <daniel.baumann@open-infrastructure.net>2021-12-10 00:18:49 +0000
commit140dae9d52b7012001c5598d0627bca0ec23ee70 (patch)
treef872ac4f48586927b6633ffb170d13b22c237e56 /libexec/container
parentReleasing version 20211117. (diff)
downloadcompute-tools-140dae9d52b7012001c5598d0627bca0ec23ee70.tar.xz
compute-tools-140dae9d52b7012001c5598d0627bca0ec23ee70.zip
Adding interactive option to container update command to ease skipping containers.
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
Diffstat (limited to '')
-rwxr-xr-xlibexec/container/update54
1 files changed, 51 insertions, 3 deletions
diff --git a/libexec/container/update b/libexec/container/update
index adfee65..077160c 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."
@@ -152,9 +157,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 "################################################################################"