build/confirm: simple but effective confirmation dialog
This commit is contained in:
parent
06632806dc
commit
418b0eec9a
8
Makefile
8
Makefile
|
@ -23,10 +23,10 @@
|
||||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
# SUCH DAMAGE.
|
# SUCH DAMAGE.
|
||||||
|
|
||||||
STEPS= arm base boot chroot clean compress core distfiles download \
|
STEPS= arm base boot chroot clean compress confirm core distfiles \
|
||||||
dvd info kernel nano plugins ports prefetch print rebase \
|
download dvd info kernel nano plugins ports prefetch print \
|
||||||
release rename serial sign skim test update upload verify \
|
rebase release rename serial sign skim test update upload \
|
||||||
vga vm xtools
|
verify vga vm xtools
|
||||||
SCRIPTS= batch nightly refresh pkg_fingerprint pkg_sign
|
SCRIPTS= batch nightly refresh pkg_fingerprint pkg_sign
|
||||||
.PHONY: ${STEPS}
|
.PHONY: ${STEPS}
|
||||||
|
|
||||||
|
|
|
@ -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
|
Additionally, UPLOADDIR can be used to specify a remote location. At
|
||||||
this point only "logs" upload cleares and creates directories on the fly.
|
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
|
Last but not least, a refresh of OPNsense core and plugins on package
|
||||||
sets is invoked using:
|
sets is invoked using:
|
||||||
|
|
||||||
|
|
|
@ -241,13 +241,17 @@ export PRODUCT_CORE="${PRODUCT_TYPE}${PRODUCT_SUFFIX}"
|
||||||
export PRODUCT_PLUGINS="os-*"
|
export PRODUCT_PLUGINS="os-*"
|
||||||
export PRODUCT_PLUGIN="os-*${PRODUCT_SUFFIX}"
|
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
|
if [ -z "${PRINT_ENV_SKIP}" ]; then
|
||||||
export PRINT_ENV_SKIP=1
|
export PRINT_ENV_SKIP=1
|
||||||
env | sort
|
env | sort
|
||||||
fi
|
fi
|
||||||
echo ">>> Running build step: ${SELF}"
|
echo ">>> Running build step: ${SELF}"
|
||||||
fi
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
git_reset()
|
git_reset()
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Copyright (c) 2018 Franco Fichtner <franco@opnsense.org>
|
||||||
|
#
|
||||||
|
# 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
|
Loading…
Reference in New Issue