From 7730d020ee890921c4d43abe9396fba2b4b87eb3 Mon Sep 17 00:00:00 2001 From: Julien Rouhaud Date: Sun, 16 Jun 2024 12:22:56 +0800 Subject: [PATCH] Add a -y (assume yes) option to the build scripts This will be used by various workflows to automatically build and push images. --- Makefile | 5 +++++ build_all.sh | 18 +++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 8e856e1..2555198 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,13 @@ BUILD_CMD = ./build_all.sh + ifneq ($(filter-out undefined, ${CONTAINER_PUSH} ${PODMAN_PUSH} ${DOCKER_PUSH}),) BUILD_CMD += -p endif +ifneq ($(filter-out undefined, ${CONTAINER_PUSH_YES}),) +BUILD_CMD += -y +endif + .PHONY: git git-misc powa-archivist powa-archivist-git powa-web-git powa-collector-git all: powa-web-misc powa-collector-misc diff --git a/build_all.sh b/build_all.sh index 7ee5197..27ebeef 100755 --- a/build_all.sh +++ b/build_all.sh @@ -16,6 +16,7 @@ function usage { echo " image. Requires usage of -i option, and only" echo " supported for powa-archivist." echo " -v Verbose mode" + echo " -y Assume yes" } DIRNAME="$(dirname $0)" @@ -25,6 +26,7 @@ specific_subver= noclean="false" do_push="false" quiet_flag="-q" +assume_yes="false" while getopts "hi:nps:u:v" name; do case "${name}" in @@ -62,6 +64,9 @@ while getopts "hi:nps:u:v" name; do v) quiet_flag="" ;; + y) + assume_yes="true" + ;; *) usage exit 1 @@ -230,12 +235,15 @@ if [[ "${do_push}" == "true" ]]; then fi echo "===================================" echo "" -echo "Build images ? [y/N]" -read cont -if [ "$cont" != "y" -a "$cont" != "Y" ]; then - echo "Stopping now" - exit 1 +if [[ "${assume_yes}" != "true" ]]; then + echo "Build images ? [y/N]" + read cont + + if [ "$cont" != "y" -a "$cont" != "Y" ]; then + echo "Stopping now" + exit 1 + fi fi if should_be_built "powa-archivist"; then