Assume yes if we have no TTY

Starve the TTY of input to ensure this works, but provide yes to the
current installer to handle the current broken case.
This commit is contained in:
Graham Christensen 2017-07-13 17:22:54 -04:00
parent 73a57a2f22
commit 1c7ce2a018
No known key found for this signature in database
GPG key ID: 06121D366FE9435C
2 changed files with 14 additions and 2 deletions

View file

@ -43,6 +43,12 @@ readonly EXTRACTED_NIX_PATH="$(dirname "$0")"
readonly ROOT_HOME="/var/root"
if [ -t 0 ]; then
readonly IS_HEADLESS='no'
else
readonly IS_HEADLESS='yes'
fi
contactme() {
echo "We'd love to help if you need it."
echo ""
@ -173,6 +179,11 @@ failure() {
ui_confirm() {
_textout "$GREEN$GREEN_UL" "$1"
if [ "$IS_HEADLESS" = "yes" ]; then
echo "No TTY, assuming you would say yes :)"
return 0
fi
local prompt="[y/n] "
echo -n "$prompt"
while read -r y; do

View file

@ -53,7 +53,8 @@ trap finish EXIT
# First setup Nix
cleanup
curl https://nixos.org/nix/install | bash
curl -o install https://nixos.org/nix/install
yes | bash ./install
verify
@ -82,7 +83,7 @@ verify
cleanup
yes | ./install
echo -n "" | ./install
verify
cleanup