Commit 4ed69cba authored by Joshua Tauberer's avatar Joshua Tauberer

replace '-t 0' test with an environment variable since '-t 0' is false when...

replace '-t 0' test with an environment variable since '-t 0' is false when standard input has been redirected and doesn't tell us whether or not we can use dialog for input, but Vagrant must be non-interactive
parent 9576594c
...@@ -18,6 +18,7 @@ Vagrant.configure("2") do |config| ...@@ -18,6 +18,7 @@ Vagrant.configure("2") do |config|
# machine figure out its own public IP and it'll take a # machine figure out its own public IP and it'll take a
# subdomain on our justtesting.email domain so we can get # subdomain on our justtesting.email domain so we can get
# started quickly. # started quickly.
export NONINTERACTIVE=1
export PUBLIC_IP=auto export PUBLIC_IP=auto
export PUBLIC_IPV6=auto export PUBLIC_IPV6=auto
export PRIMARY_HOSTNAME=auto-easy export PRIMARY_HOSTNAME=auto-easy
......
...@@ -36,11 +36,12 @@ if [ ! -d /vagrant ]; then ...@@ -36,11 +36,12 @@ if [ ! -d /vagrant ]; then
fi fi
fi fi
if [ -t 0 ]; then if [ -z "$NONINTERACTIVE" ]; then
# In an interactive shell...
# Install 'dialog' so we can ask the user questions. The original motivation for # Install 'dialog' so we can ask the user questions. The original motivation for
# this was being able to ask the user for input even if stdin has been redirected, # this was being able to ask the user for input even if stdin has been redirected,
# e.g. if we piped a bootstrapping install script to bash to get started. # e.g. if we piped a bootstrapping install script to bash to get started. In that
# case, the nifty '[ -t 0 ]' test won't work. But with Vagrant we must suppress so we
# use a shell flag instead.
apt_install dialog apt_install dialog
message_box "Mail-in-a-Box Installation" \ message_box "Mail-in-a-Box Installation" \
"Hello and thanks for deploying a Mail-in-a-Box! "Hello and thanks for deploying a Mail-in-a-Box!
...@@ -317,7 +318,7 @@ if [ -z "`tools/mail.py user`" ]; then ...@@ -317,7 +318,7 @@ if [ -z "`tools/mail.py user`" ]; then
# If we didn't ask for an email address at the start, do so now. # If we didn't ask for an email address at the start, do so now.
if [ -z "$EMAIL_ADDR" ]; then if [ -z "$EMAIL_ADDR" ]; then
# In an interactive shell, ask the user for an email address. # In an interactive shell, ask the user for an email address.
if [ -t 0 ]; then if [ -z "$NONINTERACTIVE" ]; then
input_box "Mail Account" \ input_box "Mail Account" \
"Let's create your first mail account. "Let's create your first mail account.
\n\nWhat email address do you want?" \ \n\nWhat email address do you want?" \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment