Option to select no dynamic dns provider

This commit is contained in:
Bob Mottram 2017-05-14 23:40:11 +01:00
parent afe945c377
commit c49b94f9ff
1 changed files with 61 additions and 52 deletions

View File

@ -253,7 +253,7 @@ function choose_dynamic_dns {
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
dialog --backtitle $"Freedombone Configuration" \
--radiolist $"Choose Dynamic DNS provider:" 15 40 14 \
--radiolist $"Choose Dynamic DNS provider:" 16 40 15 \
1 dyndns off \
2 freedns on \
3 zoneedit off \
@ -267,7 +267,8 @@ function choose_dynamic_dns {
11 dynsip off \
12 sitelutions off \
13 dnsexit off \
14 changeip off 2> $data
13 changeip off \
14 none off 2> $data
sel=$?
case $sel in
1) exit 1;;
@ -288,63 +289,71 @@ function choose_dynamic_dns {
12) DDNS_PROVIDER="default@sitelutions.com";;
13) DDNS_PROVIDER="default@dnsexit.com";;
14) DDNS_PROVIDER="default@changeip.com";;
15) DDNS_PROVIDER="none";;
255) exit 1;;
esac
save_configuration_values
valid_ddns_username=
while [ ! $valid_ddns_username ]
do
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
dialog --backtitle $"Freedombone Configuration" \
--inputbox $"Dynamic DNS provider username" 10 30 "$(grep 'DDNS_USERNAME' temp.cfg | awk -F '=' '{print $2}')" 2> $data
sel=$?
case $sel in
0) possible_username=$(cat $data)
if [ "$possible_username" ]; then
if [ ${#possible_username} -gt 1 ]; then
valid_ddns_username=$(cat $data)
DDNS_USERNAME=$valid_ddns_username
break;
fi
fi
;;
1) exit 1;;
255) exit 1;;
esac
done
save_configuration_values
valid_ddns_password=
while [ ! $valid_ddns_password ]
do
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
dialog --backtitle $"Freedombone Configuration" \
--clear \
--insecure \
--passwordbox $"Dynamic DNS provider password" 10 30 "$(grep 'DDNS_PASSWORD' temp.cfg | awk -F '=' '{print $2}')" 2> $data
sel=$?
case $sel in
0) possible_password=$(cat $data)
if [ "$possible_password" ]; then
if [ ${#possible_password} -gt 1 ]; then
valid_ddns_password=$(cat $data)
DDNS_PASSWORD=$valid_ddns_password
break;
fi
fi
;;
1) exit 1;;
255) exit 1;;
esac
if [ ${#DDNS_PASSWORD} -lt $MINIMUM_PASSWORD_LENGTH ]; then
dialog --title $"Password quality check" --msgbox $"The password given was too short. It must be at least $MINIMUM_PASSWORD_LENGTH characters. You may need to change your password on the dynamic DNS provider's web site." 10 40
DDNS_PASSWORD=""
if [[ "$DDNS_PROVIDER" == "none" ]]; then
if [ -f /etc/systemd/system/inadyn.service ]; then
systemctl stop inadyn
systemctl disable inadyn
fi
done
save_configuration_values
else
while [ ! $valid_ddns_username ]
do
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
dialog --backtitle $"Freedombone Configuration" \
--inputbox $"Dynamic DNS provider username" 10 30 "$(grep 'DDNS_USERNAME' temp.cfg | awk -F '=' '{print $2}')" 2> $data
sel=$?
case $sel in
0) possible_username=$(cat $data)
if [ "$possible_username" ]; then
if [ ${#possible_username} -gt 1 ]; then
valid_ddns_username=$(cat $data)
DDNS_USERNAME=$valid_ddns_username
break;
fi
fi
;;
1) exit 1;;
255) exit 1;;
esac
done
save_configuration_values
while [ ! $valid_ddns_password ]
do
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
dialog --backtitle $"Freedombone Configuration" \
--clear \
--insecure \
--passwordbox $"Dynamic DNS provider password" 10 30 "$(grep 'DDNS_PASSWORD' temp.cfg | awk -F '=' '{print $2}')" 2> $data
sel=$?
case $sel in
0) possible_password=$(cat $data)
if [ "$possible_password" ]; then
if [ ${#possible_password} -gt 1 ]; then
valid_ddns_password=$(cat $data)
DDNS_PASSWORD=$valid_ddns_password
break;
fi
fi
;;
1) exit 1;;
255) exit 1;;
esac
if [ ${#DDNS_PASSWORD} -lt $MINIMUM_PASSWORD_LENGTH ]; then
dialog --title $"Password quality check" --msgbox $"The password given was too short. It must be at least $MINIMUM_PASSWORD_LENGTH characters. You may need to change your password on the dynamic DNS provider's web site." 10 40
DDNS_PASSWORD=""
fi
done
save_configuration_values
fi
fi
}