scripts: default to non-interactive mode.
This commit is contained in:
parent
31cbec8a16
commit
9897655a9e
|
@ -28,8 +28,8 @@ fatal ()
|
|||
exit 255
|
||||
}
|
||||
|
||||
UPDATE=no
|
||||
HELP=no
|
||||
INTERACTIVE=no
|
||||
|
||||
split ()
|
||||
{
|
||||
|
@ -43,12 +43,12 @@ split ()
|
|||
if [ $# -gt 0 ]
|
||||
then
|
||||
case "$1" in
|
||||
--update)
|
||||
UPDATE=yes
|
||||
--help|-h)
|
||||
HELP=yes
|
||||
shift 1
|
||||
;;
|
||||
--help)
|
||||
HELP=yes
|
||||
--interactive|-i)
|
||||
INTERACTIVE=yes
|
||||
shift 1
|
||||
;;
|
||||
*)
|
||||
|
@ -67,11 +67,11 @@ s/--enable-\([^ =]\+\)/USE_\1=yes/g;
|
|||
s/--disable-\([^ =]\+\)/USE_\1=no/g;
|
||||
s/--\([^ =]\+\)/\1/g;
|
||||
' | sed -n '/^[^ =]\+=./p' >> .config
|
||||
UPDATE=yes;
|
||||
INTERACTIVE=no;
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $HELP != yes ] && [ $UPDATE != yes ]
|
||||
if [ $HELP != yes ] && [ $INTERACTIVE != no ]
|
||||
then
|
||||
if ! ( [ -t 0 ] && [ -t 1 ] )
|
||||
then
|
||||
|
@ -102,7 +102,7 @@ ask ()
|
|||
|
||||
echo -n "$BLACK$BOLD::$SGR0 ${1}? [$BOLD${D}$SGR0] "
|
||||
|
||||
if [ $UPDATE = yes ]
|
||||
if [ $INTERACTIVE = no ]
|
||||
then
|
||||
A="$D"
|
||||
echo
|
||||
|
@ -207,7 +207,7 @@ begin_options ()
|
|||
if [ $HELP = yes ]
|
||||
then
|
||||
echo
|
||||
warn "This is a ${BOLD}non-configure${SGR0} script. Run without any arguments and you will be prompted"
|
||||
warn "This is a ${BOLD}non-configure${SGR0} script. Run with ${BOLD}--interactive${SGR0} argument and you will be prompted"
|
||||
warn "with configuration choices. Alternatively, you may use the following autoconf style"
|
||||
warn "arguments for non-interactive configuration."
|
||||
echo
|
||||
|
@ -218,11 +218,11 @@ begin_options ()
|
|||
append "# This file was automatically generated on `date`. Any changes may be lost!"
|
||||
append "## options"
|
||||
|
||||
if [ $UPDATE = yes ]
|
||||
if [ $INTERACTIVE = no ]
|
||||
then
|
||||
info "Updating configuration"
|
||||
info "Non-interactively updating configuration"
|
||||
else
|
||||
info "Configuration required"
|
||||
info "Interactive configuration requested"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue