GNU bug report logs -
#33134
[PATCH 0/1] guix-install.sh: Add ability to run it non-interactively.
Previous Next
Reported by: rsiddharth <s <at> ricketyspace.net>
Date: Wed, 24 Oct 2018 00:17:01 UTC
Severity: normal
Tags: patch
Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #50 received at 33134 <at> debbugs.gnu.org (full text, mbox):
Thanks Danny, I've refactored the patch based on your feedack.
Danny Milosavljevic wrote:
>> + # process -y / -n arg.
>> + export AUTO_YN=${1:1:1}
>> + if [ -z $AUTO_YN ]; then
>> + export AUTO_YN=""
>> + fi
> Why "export" ? Now all the child processes get it, making their environment
> different from before. This makes parse_args have system-wide side effects.
Remove the `export`.
>> ...
>>
>> main()
>> {
>> + parse_args $@
>> +
> Should be
>
> "$@"
>
>with quotes
Done.
>> ...
>> ...
>> https://www.gnu.org/software/guix/
>> EOF
>> echo -n "Press return to continue..."
>> - read -r ANSWER
>> + read -N 1 -r ANSWER
> While it's nice for the interactive user, doesn't this break
>
> yes | ./guix-install.sh
>
> because now it doesn't wait for the newline?
Yes, it would break `yes | ./guix-install.sh`. I've removed `-N 1` from the `read` statement.
>> - *) _msg "Please answer yes or no.";
>> + *) _msg "Please answer yes or no."; yn=""
> Does this make it conditionally interactive? Would it be better to "exit 1" here?
When the user is running the script interactively and answers, say "Oui", we
arrive at the:
*) _msg "Please answer yes or no.";
case. After this, we go to the beginning of the loop:
[[ -n $yn ]] || read -p "Permit downloading pre-built package binaries from the project's build farms? (yes/no) " yn
Since $yn is "Oui" `[[ -n $yn ]]` will evaluate to true, the user won't be
prompted again, we'll go back to:
*) _msg "Please answer yes or no."
and this will repeat infinitely.
The `yn=""` was added:
*) _msg "Please answer yes or no."; yn=""
to reset the value of yn, so that `[[ -n $yn ]]` will evaluate to false and
the user will be prompted again for answer.
rsiddharth (4):
guix-install.sh: Add parse_args.
guix-install.sh: Update main.
guix-install.sh: Update welcome.
guix-install.sh: Update sys_authorize_build_farms.
etc/guix-install.sh | 26 +++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
--
2.19.1
This bug report was last modified 3 years and 309 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.