unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: rsiddharth <s@ricketyspace.net>
To: 33134@debbugs.gnu.org
Cc: rsiddharth <s@ricketyspace.net>
Subject: [bug#33134] [PATCH 0/4] [Refactor 0] Add auto yes/no switch to guix-install.sh
Date: Thu,  8 Nov 2018 23:13:01 -0500	[thread overview]
Message-ID: <20181109041301.39042-1-s@ricketyspace.net> (raw)
In-Reply-To: <20181024001542.16368-1-s@ricketyspace.net>

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

  parent reply	other threads:[~2018-11-09  4:14 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-24  0:15 [bug#33134] [PATCH 0/1] guix-install.sh: Add ability to run it non-interactively rsiddharth
2018-10-24  0:21 ` [bug#33134] [PATCH 1/1] guix-install.sh: Update welcome rsiddharth
2018-10-24 11:54 ` [bug#33134] [PATCH 0/1] guix-install.sh: Add ability to run it non-interactively Efraim Flashner
2018-10-24 13:24   ` Tobias Geerinckx-Rice
2018-10-24 13:27     ` Efraim Flashner
2018-11-03  1:10   ` [bug#33134] [PATCH 0/5] Add auto yes/no switch to guix-install.sh rsiddharth
2018-11-03  1:10   ` [bug#33134] [PATCH 1/5] guix-install.sh: Update welcome rsiddharth
2018-11-06 11:32     ` Danny Milosavljevic
2018-11-03  1:10   ` [bug#33134] [PATCH 2/5] guix-install.sh: Add parse_args rsiddharth
2018-11-06 11:27     ` Danny Milosavljevic
2018-11-03  1:10   ` [bug#33134] [PATCH 3/5] guix-install.sh: Update main rsiddharth
2018-11-06 11:28     ` Danny Milosavljevic
2018-11-03  1:11   ` [bug#33134] [PATCH 4/5] guix-install.sh: Update welcome rsiddharth
2018-11-03  1:11   ` [bug#33134] [PATCH 5/5] guix-install.sh: Update sys_authorize_build_farms rsiddharth
2018-11-06 11:31     ` Danny Milosavljevic
2018-11-09  4:13 ` rsiddharth [this message]
2018-11-09  4:14   ` [bug#33134] [PATCH 1/4] guix-install.sh: Add parse_args rsiddharth
2018-11-09  4:15   ` [bug#33134] [PATCH 2/4] guix-install.sh: Update main rsiddharth
2018-11-09  4:15   ` [bug#33134] [PATCH 3/4] guix-install.sh: Update welcome rsiddharth
2018-11-09  4:15   ` [bug#33134] [PATCH 4/4] guix-install.sh: Update sys_authorize_build_farms rsiddharth
2021-07-13 12:01 ` bug#33134: [PATCH 0/1] guix-install.sh: Add ability to run it non-interactively Maxim Cournoyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181109041301.39042-1-s@ricketyspace.net \
    --to=s@ricketyspace.net \
    --cc=33134@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).