about summary refs log tree commit diff
path: root/scripts/install-darwin-multi-user.sh
diff options
context:
space:
mode:
authorGraham Christensen <graham@grahamc.com>2017-07-13T21·22-0400
committerGraham Christensen <graham@grahamc.com>2017-07-14T16·11-0400
commit1c7ce2a018a081dd90dfefee6d1ca7e0c9fd66d9 (patch)
treea053fc84ac08e1763b153196905946b7dfee3f8f /scripts/install-darwin-multi-user.sh
parent73a57a2f22668394740e1f642573b67a1316dee7 (diff)
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.
Diffstat (limited to 'scripts/install-darwin-multi-user.sh')
-rw-r--r--scripts/install-darwin-multi-user.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/scripts/install-darwin-multi-user.sh b/scripts/install-darwin-multi-user.sh
index 01a0e4ffb4e1..368d9957e110 100644
--- a/scripts/install-darwin-multi-user.sh
+++ b/scripts/install-darwin-multi-user.sh
@@ -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