Give user chance to confirm DNS name. Just in case they fat-fingered.

This commit is contained in:
Kaladin Light 2016-04-30 16:00:02 -04:00
parent 2ee04c6c9b
commit 6032aa7f2e

View file

@ -708,7 +708,7 @@ confOVPN() {
exitstatus=$? exitstatus=$?
if [ $exitstatus != 0 ]; then if [ $exitstatus != 0 ]; then
echo "::: Cancel selected. Exiting..." echo "::: Cancel selected. Exiting..."
exit 1 exit 1
fi fi
@ -717,15 +717,22 @@ confOVPN() {
if [ "$METH" == "$IPv4pub" ]; then if [ "$METH" == "$IPv4pub" ]; then
$SUDO sed -i 's/IPv4pub/'$IPv4pub'/' /etc/openvpn/easy-rsa/keys/Default.txt $SUDO sed -i 's/IPv4pub/'$IPv4pub'/' /etc/openvpn/easy-rsa/keys/Default.txt
else else
PUBLICDNS=$(whiptail --title "PiVPN Setup" --inputbox "What is the public DNS name of this Raspberry Pi?" $r $c 3>&1 1>&2 2>&3) until [[ $publicDNSCorrect = True ]]
exitstatus=$? do
if [ $exitstatus = 0 ]; then PUBLICDNS=$(whiptail --title "PiVPN Setup" --inputbox "What is the public DNS name of this Server?" $r $c 3>&1 1>&2 2>&3)
$SUDO sed -i 's/IPv4pub/'$PUBLICDNS'/' /etc/openvpn/easy-rsa/keys/Default.txt exitstatus=$?
whiptail --title "Setup OpenVPN" --infobox "Using PUBLIC DNS: $PUBLICDNS" $r $c if [ $exitstatus != 0 ]; then
else echo "::: Cancel selected. Exiting..."
whiptail --title "Setup OpenVPN" --infobox "Cancelled" $r $c
exit 1 exit 1
fi fi
if (whiptail --backtitle "Confirm DNS Name" --title "Confirm DNS Name" --yesno "Is this correct?\n\n Public DNS Name: $PUBLICDNS" $r $c) then
publicDNSCorrect=True
$SUDO sed -i 's/IPv4pub/'$PUBLICDNS'/' /etc/openvpn/easy-rsa/keys/Default.txt
else
publicDNSCorrect=False
fi
done
fi fi
# if they modified port put value in Default.txt for clients to use # if they modified port put value in Default.txt for clients to use