diff --git a/Makefile b/Makefile index 1025d8c..09c4de9 100644 --- a/Makefile +++ b/Makefile @@ -23,10 +23,10 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. -STEPS= arm base boot chroot clean compress core distfiles download \ - dvd info kernel nano plugins ports prefetch print rebase \ - release rename serial sign skim test update upload verify \ - vga vm xtools +STEPS= arm base boot chroot clean compress confirm core distfiles \ + download dvd info kernel nano plugins ports prefetch print \ + rebase release rename serial sign skim test update upload \ + verify vga vm xtools SCRIPTS= batch nightly refresh pkg_fingerprint pkg_sign .PHONY: ${STEPS} diff --git a/README.md b/README.md index 165e747..72d7500 100644 --- a/README.md +++ b/README.md @@ -416,6 +416,11 @@ specify the remote end, e.g. SERVER=user@does.not.exist Additionally, UPLOADDIR can be used to specify a remote location. At this point only "logs" upload cleares and creates directories on the fly. +If you want to script interactive prompts you may use the confirm target +to operate yes or no questions before an action: + + # make info confirm dvd + Last but not least, a refresh of OPNsense core and plugins on package sets is invoked using: diff --git a/build/common.sh b/build/common.sh index ead9798..fb6dd23 100644 --- a/build/common.sh +++ b/build/common.sh @@ -241,13 +241,17 @@ export PRODUCT_CORE="${PRODUCT_TYPE}${PRODUCT_SUFFIX}" export PRODUCT_PLUGINS="os-*" export PRODUCT_PLUGIN="os-*${PRODUCT_SUFFIX}" -if [ "${SELF}" != print -a "${SELF}" != info ]; then +case "${SELF}" in +confirm|info|print) + ;; +*) if [ -z "${PRINT_ENV_SKIP}" ]; then export PRINT_ENV_SKIP=1 env | sort fi echo ">>> Running build step: ${SELF}" -fi + ;; +esac git_reset() { diff --git a/build/confirm.sh b/build/confirm.sh new file mode 100644 index 0000000..c622807 --- /dev/null +++ b/build/confirm.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +# Copyright (c) 2018 Franco Fichtner +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +set -e + +SELF=confirm + +. ./common.sh + +read -p "Proceed with this action? [y/N]: " YN + +case ${YN} in +[yY]) + ;; +*) + exit 1 + ;; +esac