Populate default values before echoing help text

Testing showed that it may take a few seconds for the default values to
populate.  If the help text is shown, “Enter the public IP address…,”
but no prompt is shown, the user may get confused and try to enter the
IP address before mailinabox has had a chance to figure out and display
a suitable default value.
This commit is contained in:
Michael Kropat 2014-06-08 18:44:08 -04:00
parent ae67409603
commit fb957d2de7
1 changed files with 15 additions and 15 deletions

View File

@ -24,6 +24,11 @@ fi
# Gather information from the user about the hostname and public IP
# address of this host.
if [ -z "$PUBLIC_HOSTNAME" ]; then
if [ -z "$DEFAULT_PUBLIC_HOSTNAME" ]; then
# set a default on first run
DEFAULT_PUBLIC_HOSTNAME=`get_default_hostname`
fi
echo
echo "Enter the hostname you want to assign to this machine."
echo "We've guessed a value. Just backspace it if it's wrong."
@ -31,39 +36,34 @@ if [ -z "$PUBLIC_HOSTNAME" ]; then
echo "be similar."
echo
if [ -z "$DEFAULT_PUBLIC_HOSTNAME" ]; then
# set a default on first run
DEFAULT_PUBLIC_HOSTNAME=`get_default_hostname`
fi
read -e -i "$DEFAULT_PUBLIC_HOSTNAME" -p "Hostname: " PUBLIC_HOSTNAME
fi
if [ -z "$PUBLIC_IP" ]; then
if [ -z "$DEFAULT_PUBLIC_IP" ]; then
# set a default on first run
DEFAULT_PUBLIC_IP=`get_default_publicip`
fi
echo
echo "Enter the public IP address of this machine, as given to"
echo "you by your ISP. We've guessed a value, but just backspace"
echo "it if it's wrong."
echo
if [ -z "$DEFAULT_PUBLIC_IP" ]; then
# set a default on first run
DEFAULT_PUBLIC_IP=`get_default_publicip`
fi
read -e -i "$DEFAULT_PUBLIC_IP" -p "Public IP: " PUBLIC_IP
fi
if [ -z "$PUBLIC_IPV6" ]; then
echo
echo "(Optional) Enter the IPv6 address of this machine. Leave blank"
echo " if the machine does not have an IPv6 address."
if [ -z "$DEFAULT_PUBLIC_IPV6" ]; then
if [ -z "$DEFAULT_PUBLIC_IPV6" ]; then
# set a default on first run
DEFAULT_PUBLIC_IPV6=`get_default_publicipv6`
fi
echo
echo "(Optional) Enter the IPv6 address of this machine. Leave blank"
echo " if the machine does not have an IPv6 address."
read -e -i "$DEFAULT_PUBLIC_IPV6" -p "Public IPv6: " PUBLIC_IPV6
fi