mirror of
https://github.com/NixOS/nix.git
synced 2024-11-22 14:52:55 +00:00
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:
parent
73a57a2f22
commit
1c7ce2a018
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user