Customising interactive installer for the mesh variant

This commit is contained in:
Bob Mottram 2015-07-19 14:59:00 +01:00
parent 32c290857e
commit 50b2b7860c
1 changed files with 157 additions and 151 deletions

View File

@ -487,7 +487,7 @@ function interactive_configuration {
7 Social off \
8 Media off \
9 Developer off \
10 Mesh off 2> $data
10 Mesh off 2> $data
sel=$?
case $sel in
1) exit 1;;
@ -508,8 +508,8 @@ function interactive_configuration {
save_configuration_file
if [[ SYSTEM_TYPE == "$VARIANT_MESH" ]]; then
ENABLE_BATMAN="yes"
ENABLE_CJDNS="no"
ENABLE_BATMAN="yes"
ENABLE_CJDNS="no"
fi
data=$(tempfile 2>/dev/null)
@ -562,27 +562,29 @@ function interactive_configuration {
fi
save_configuration_file
interactive_gpg
if [[ SYSTEM_TYPE != "$VARIANT_MESH" ]]; then
interactive_gpg
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
SOCIAL_KEY_STR="\nDo you wish to enable social key management, otherwise known as \"the unforgettable key\"?\n\nThis means that fragments of your GPG key will be included with any remote backups so that if you later lose your key then it can be reconstructed from your friends servers. If you select \"no\" then you can still do social key management, but offline using physical USB thumb drives, which is more secure but less convenient."
if [[ $(grep "ENABLE_SOCIAL_KEY_MANAGEMENT" temp.cfg | awk -F '=' '{print $2}') == "yes" ]]; then
dialog --title "Social Key Management" \
--backtitle "Freedombone Configuration" \
--yesno "$SOCIAL_KEY_STR" 15 60
else
dialog --title "Social Key Management" \
--backtitle "Freedombone Configuration" \
--defaultno \
--yesno "$SOCIAL_KEY_STR" 15 60
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
SOCIAL_KEY_STR="\nDo you wish to enable social key management, otherwise known as \"the unforgettable key\"?\n\nThis means that fragments of your GPG key will be included with any remote backups so that if you later lose your key then it can be reconstructed from your friends servers. If you select \"no\" then you can still do social key management, but offline using physical USB thumb drives, which is more secure but less convenient."
if [[ $(grep "ENABLE_SOCIAL_KEY_MANAGEMENT" temp.cfg | awk -F '=' '{print $2}') == "yes" ]]; then
dialog --title "Social Key Management" \
--backtitle "Freedombone Configuration" \
--yesno "$SOCIAL_KEY_STR" 15 60
else
dialog --title "Social Key Management" \
--backtitle "Freedombone Configuration" \
--defaultno \
--yesno "$SOCIAL_KEY_STR" 15 60
fi
sel=$?
case $sel in
0) ENABLE_SOCIAL_KEY_MANAGEMENT="yes";;
255) exit 1;;
esac
save_configuration_file
fi
sel=$?
case $sel in
0) ENABLE_SOCIAL_KEY_MANAGEMENT="yes";;
255) exit 1;;
esac
save_configuration_file
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
@ -804,83 +806,86 @@ function interactive_configuration {
esac
save_configuration_file
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 \
1 dyndns off \
2 freedns on \
3 zoneedit off \
4 no-ip off \
5 easydns off \
6 tzo off \
7 3322 off \
8 dnsomatic off \
9 tunnelbroker off \
10 dns.he.net off \
11 dynsip off \
12 sitelutions off \
13 dnsexit off \
14 changeip off 2> $data
sel=$?
case $sel in
1) exit 1;;
255) exit 1;;
esac
case $(cat $data) in
1) DDNS_PROVIDER="default@dyndns.org";;
2) DDNS_PROVIDER="default@freedns.afraid.org";;
3) DDNS_PROVIDER="default@zoneedit.com";;
4) DDNS_PROVIDER="default@no-ip.com";;
5) DDNS_PROVIDER="default@easydns.com";;
6) DDNS_PROVIDER="default@tzo.com";;
7) DDNS_PROVIDER="dyndns@3322.org";;
8) DDNS_PROVIDER="default@dnsomatic.com";;
9) DDNS_PROVIDER="ipv6tb@he.net";;
10) DDNS_PROVIDER="dyndns@he.net";;
11) DDNS_PROVIDER="default@dynsip.org";;
12) DDNS_PROVIDER="default@sitelutions.com";;
13) DDNS_PROVIDER="default@dnsexit.com";;
14) DDNS_PROVIDER="default@changeip.com";;
255) exit 1;;
esac
save_configuration_file
if [[ SYSTEM_TYPE != "$VARIANT_MESH" ]]; then
while [ ! $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
--radiolist "Choose Dynamic DNS provider:" 15 40 14 \
1 dyndns off \
2 freedns on \
3 zoneedit off \
4 no-ip off \
5 easydns off \
6 tzo off \
7 3322 off \
8 dnsomatic off \
9 tunnelbroker off \
10 dns.he.net off \
11 dynsip off \
12 sitelutions off \
13 dnsexit off \
14 changeip off 2> $data
sel=$?
case $sel in
0) DDNS_USERNAME=$(cat $data);;
1) exit 1;;
255) exit 1;;
esac
done
save_configuration_file
case $(cat $data) in
1) DDNS_PROVIDER="default@dyndns.org";;
2) DDNS_PROVIDER="default@freedns.afraid.org";;
3) DDNS_PROVIDER="default@zoneedit.com";;
4) DDNS_PROVIDER="default@no-ip.com";;
5) DDNS_PROVIDER="default@easydns.com";;
6) DDNS_PROVIDER="default@tzo.com";;
7) DDNS_PROVIDER="dyndns@3322.org";;
8) DDNS_PROVIDER="default@dnsomatic.com";;
9) DDNS_PROVIDER="ipv6tb@he.net";;
10) DDNS_PROVIDER="dyndns@he.net";;
11) DDNS_PROVIDER="default@dynsip.org";;
12) DDNS_PROVIDER="default@sitelutions.com";;
13) DDNS_PROVIDER="default@dnsexit.com";;
14) DDNS_PROVIDER="default@changeip.com";;
255) exit 1;;
esac
save_configuration_file
while [ ! $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) DDNS_PASSWORD=$(cat $data);;
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_file
while [ ! $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) DDNS_USERNAME=$(cat $data);;
1) exit 1;;
255) exit 1;;
esac
done
save_configuration_file
while [ ! $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) DDNS_PASSWORD=$(cat $data);;
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_file
fi
while [ ! $MY_NAME ]
do
@ -1236,78 +1241,79 @@ function interactive_configuration {
save_configuration_file
fi
DEFAULT_DOMAIN_DETAILS_COMPLETE=
while [ ! $DEFAULT_DOMAIN_DETAILS_COMPLETE ]
do
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
dialog --backtitle "Freedombone Configuration" \
--title "Default Domain" \
--form "\nWhich domain name should your email/XMPP/IRC/VoIP be associated with?" 11 55 3 \
"Domain:" 1 1 "$(grep 'DEFAULT_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 30 \
"Code:" 2 1 "$(grep 'DEFAULT_DOMAIN_CODE' temp.cfg | awk -F '=' '{print $2}')" 2 16 25 30 \
2> $data
sel=$?
case $sel in
1) exit 1;;
255) exit 1;;
esac
DEFAULT_DOMAIN_NAME=$(cat $data | sed -n 1p)
DEFAULT_DOMAIN_CODE=$(cat $data | sed -n 2p)
if [[ SYSTEM_TYPE != "$VARIANT_MESH" ]]; then
DEFAULT_DOMAIN_DETAILS_COMPLETE=
while [ ! $DEFAULT_DOMAIN_DETAILS_COMPLETE ]
do
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
dialog --backtitle "Freedombone Configuration" \
--title "Default Domain" \
--form "\nWhich domain name should your email/XMPP/IRC/VoIP be associated with?" 11 55 3 \
"Domain:" 1 1 "$(grep 'DEFAULT_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 30 \
"Code:" 2 1 "$(grep 'DEFAULT_DOMAIN_CODE' temp.cfg | awk -F '=' '{print $2}')" 2 16 25 30 \
2> $data
sel=$?
case $sel in
1) exit 1;;
255) exit 1;;
esac
DEFAULT_DOMAIN_NAME=$(cat $data | sed -n 1p)
DEFAULT_DOMAIN_CODE=$(cat $data | sed -n 2p)
if [ $DEFAULT_DOMAIN_NAME ]; then
if [ ${#DEFAULT_DOMAIN_CODE} -lt 30 ]; then
DEFAULT_DOMAIN_NAME=
dialog --title "FreeDNS code" --msgbox "$FREEDNS_MESSAGE" 15 50
fi
fi
else
dialog --backtitle "Freedombone Configuration" \
--inputbox "Which domain name should your email/XMPP/IRC/VoIP be associated with?" 10 45 \
"$(grep 'DEFAULT_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 2> $data
sel=$?
case $sel in
0) DEFAULT_DOMAIN_NAME=$(cat $data);;
1) exit 1;;
255) exit 1;;
esac
fi
if [ $DEFAULT_DOMAIN_NAME ]; then
if [ ${#DEFAULT_DOMAIN_CODE} -lt 30 ]; then
TEST_DOMAIN_NAME=$DEFAULT_DOMAIN_NAME
validate_domain_name
if [[ $TEST_DOMAIN_NAME != $DEFAULT_DOMAIN_NAME ]]; then
DEFAULT_DOMAIN_NAME=
dialog --title "FreeDNS code" --msgbox "$FREEDNS_MESSAGE" 15 50
dialog --title "Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
else
DEFAULT_DOMAIN_DETAILS_COMPLETE="yes"
fi
fi
else
done
save_configuration_file
while [ ${#MY_EMAIL_ADDRESS} -lt 5 ]
do
EMAIL_ADDRESS=$(grep 'MY_EMAIL_ADDRESS' temp.cfg | awk -F '=' '{print $2}')
if [ ! $EMAIL_ADDRESS ]; then
EMAIL_ADDRESS=$MY_USERNAME@$DEFAULT_DOMAIN_NAME
fi
if [ ${#MY_EMAIL_ADDRESS} -lt 5 ]; then
EMAIL_ADDRESS=$MY_USERNAME@$DEFAULT_DOMAIN_NAME
fi
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
dialog --backtitle "Freedombone Configuration" \
--inputbox "Which domain name should your email/XMPP/IRC/VoIP be associated with?" 10 45 \
"$(grep 'DEFAULT_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 2> $data
--inputbox "Your email address" 10 30 "$EMAIL_ADDRESS" 2> $data
sel=$?
case $sel in
0) DEFAULT_DOMAIN_NAME=$(cat $data);;
0) MY_EMAIL_ADDRESS=$(cat $data);;
1) exit 1;;
255) exit 1;;
esac
fi
if [ $DEFAULT_DOMAIN_NAME ]; then
TEST_DOMAIN_NAME=$DEFAULT_DOMAIN_NAME
validate_domain_name
if [[ $TEST_DOMAIN_NAME != $DEFAULT_DOMAIN_NAME ]]; then
DEFAULT_DOMAIN_NAME=
dialog --title "Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
else
DEFAULT_DOMAIN_DETAILS_COMPLETE="yes"
fi
fi
done
save_configuration_file
while [ ${#MY_EMAIL_ADDRESS} -lt 5 ]
do
EMAIL_ADDRESS=$(grep 'MY_EMAIL_ADDRESS' temp.cfg | awk -F '=' '{print $2}')
if [ ! $EMAIL_ADDRESS ]; then
EMAIL_ADDRESS=$MY_USERNAME@$DEFAULT_DOMAIN_NAME
fi
if [ ${#MY_EMAIL_ADDRESS} -lt 5 ]; then
EMAIL_ADDRESS=$MY_USERNAME@$DEFAULT_DOMAIN_NAME
fi
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
dialog --backtitle "Freedombone Configuration" \
--inputbox "Your email address" 10 30 "$EMAIL_ADDRESS" 2> $data
sel=$?
case $sel in
0) MY_EMAIL_ADDRESS=$(cat $data);;
1) exit 1;;
255) exit 1;;
esac
done
save_configuration_file
done
save_configuration_file
fi
# delete the temporary configuration file
if [ -f temp.cfg ]; then