Commit fb957d2d authored by Michael Kropat's avatar Michael Kropat

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