Allow for onion only interactive install

This commit is contained in:
Bob Mottram 2015-12-30 21:51:26 +00:00
parent 69945cf49d
commit 9837ceac5f
1 changed files with 362 additions and 320 deletions

View File

@ -123,6 +123,7 @@ function show_help {
echo $' -m --min Minimum password length (characters)' echo $' -m --min Minimum password length (characters)'
echo $' -w --www Freedombone web site' echo $' -w --www Freedombone web site'
echo $' -b --bm Freedombone support Bitmessage address' echo $' -b --bm Freedombone support Bitmessage address'
echo $' -o --onion [yes|no] Whether to only create .onion sites'
echo $' --minimal [yes|no] For minimalistic "consumer grade" installs' echo $' --minimal [yes|no] For minimalistic "consumer grade" installs'
echo '' echo ''
exit 0 exit 0
@ -161,6 +162,10 @@ do
shift shift
MINIMAL_INSTALL="$1" MINIMAL_INSTALL="$1"
;; ;;
-o|--onion)
shift
ONION_ONLY="$1"
;;
*) *)
# unknown option # unknown option
;; ;;
@ -1236,386 +1241,420 @@ function interactive_configuration {
fi fi
if [[ $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_FULL" ]]; then if [[ $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_FULL" ]]; then
WIKI_DETAILS_COMPLETE= if [[ $ONION_ONLY != "no" ]]; then
while [ ! $WIKI_DETAILS_COMPLETE ] WIKI_TITLE='My Wiki'
do WIKI_DOMAIN_NAME='wiki.onion'
data=$(tempfile 2>/dev/null) else
trap "rm -f $data" 0 1 2 5 15 WIKI_DETAILS_COMPLETE=
while [ ! $WIKI_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 if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
dialog --backtitle $"Freedombone Configuration" \ dialog --backtitle $"Freedombone Configuration" \
--title $"Wiki Configuration" \ --title $"Wiki Configuration" \
--form $"\nPlease enter your wiki details:" 11 55 4 \ --form $"\nPlease enter your wiki details:" 11 55 4 \
$"Title:" 1 1 "$(grep 'WIKI_TITLE' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 40 \ $"Title:" 1 1 "$(grep 'WIKI_TITLE' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 40 \
$"Domain:" 2 1 "$(grep 'WIKI_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 2 16 25 40 \ $"Domain:" 2 1 "$(grep 'WIKI_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 2 16 25 40 \
$"Code:" 3 1 "$(grep 'WIKI_CODE' temp.cfg | awk -F '=' '{print $2}')" 3 16 25 40 \ $"Code:" 3 1 "$(grep 'WIKI_CODE' temp.cfg | awk -F '=' '{print $2}')" 3 16 25 40 \
2> $data 2> $data
else
dialog --backtitle $"Freedombone Configuration" \
--title $"Wiki Configuration" \
--form $"\nPlease enter your wiki details:" 11 55 3 \
$"Title:" 1 1 "$(grep 'WIKI_TITLE' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 40 \
$"Domain:" 2 1 "$(grep 'WIKI_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 2 16 25 40 \
2> $data
fi
sel=$?
case $sel in
1) exit 1;;
255) exit 1;;
esac
WIKI_TITLE=$(cat $data | sed -n 1p)
WIKI_DOMAIN_NAME=$(cat $data | sed -n 2p)
if [ $WIKI_DOMAIN_NAME ]; then
TEST_DOMAIN_NAME=$WIKI_DOMAIN_NAME
validate_domain_name
if [[ $TEST_DOMAIN_NAME != $WIKI_DOMAIN_NAME ]]; then
WIKI_DOMAIN_NAME=
dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
else else
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then dialog --backtitle $"Freedombone Configuration" \
WIKI_CODE=$(cat $data | sed -n 3p) --title $"Wiki Configuration" \
if [ ${#WIKI_CODE} -lt 30 ]; then --form $"\nPlease enter your wiki details:" 11 55 3 \
WIKI_DOMAIN_NAME= $"Title:" 1 1 "$(grep 'WIKI_TITLE' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 40 \
dialog --title $"FreeDNS code" --msgbox "$FREEDNS_MESSAGE" 15 50 $"Domain:" 2 1 "$(grep 'WIKI_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 2 16 25 40 \
2> $data
fi
sel=$?
case $sel in
1) exit 1;;
255) exit 1;;
esac
WIKI_TITLE=$(cat $data | sed -n 1p)
WIKI_DOMAIN_NAME=$(cat $data | sed -n 2p)
if [ $WIKI_DOMAIN_NAME ]; then
TEST_DOMAIN_NAME=$WIKI_DOMAIN_NAME
validate_domain_name
if [[ $TEST_DOMAIN_NAME != $WIKI_DOMAIN_NAME ]]; then
WIKI_DOMAIN_NAME=
dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
else
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
WIKI_CODE=$(cat $data | sed -n 3p)
if [ ${#WIKI_CODE} -lt 30 ]; then
WIKI_DOMAIN_NAME=
dialog --title $"FreeDNS code" --msgbox "$FREEDNS_MESSAGE" 15 50
fi
fi fi
fi fi
fi fi
fi if [ $WIKI_DOMAIN_NAME ]; then
if [ $WIKI_DOMAIN_NAME ]; then WIKI_DETAILS_COMPLETE="yes"
WIKI_DETAILS_COMPLETE="yes" fi
fi done
done fi
save_configuration_file save_configuration_file
fi fi
if [[ $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_FULL" ]]; then if [[ $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_FULL" ]]; then
FULLBLOG_DETAILS_COMPLETE= if [[ $ONION_ONLY != "no" ]]; then
while [ ! $FULLBLOG_DETAILS_COMPLETE ] MY_BLOG_TITLE='My Blog'
do FULLBLOG_DOMAIN_NAME='blog.onion'
data=$(tempfile 2>/dev/null) else
trap "rm -f $data" 0 1 2 5 15 FULLBLOG_DETAILS_COMPLETE=
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then while [ ! $FULLBLOG_DETAILS_COMPLETE ]
dialog --backtitle $"Freedombone Configuration" \ do
--title $"Blog Configuration" \ data=$(tempfile 2>/dev/null)
--form $"\nPlease enter your blog details:" 11 55 4 \ trap "rm -f $data" 0 1 2 5 15
$"Title:" 1 1 "$(grep 'MY_BLOG_TITLE' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 30 \ if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
$"Domain:" 2 1 "$(grep 'FULLBLOG_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 2 16 25 30 \ dialog --backtitle $"Freedombone Configuration" \
$"Code:" 3 1 "$(grep 'FULLBLOG_CODE' temp.cfg | awk -F '=' '{print $2}')" 3 16 25 30 \ --title $"Blog Configuration" \
2> $data --form $"\nPlease enter your blog details:" 11 55 4 \
else $"Title:" 1 1 "$(grep 'MY_BLOG_TITLE' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 30 \
dialog --backtitle $"Freedombone Configuration" \ $"Domain:" 2 1 "$(grep 'FULLBLOG_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 2 16 25 30 \
--title $"Blog Configuration" \ $"Code:" 3 1 "$(grep 'FULLBLOG_CODE' temp.cfg | awk -F '=' '{print $2}')" 3 16 25 30 \
--form $"\nPlease enter your blog details:" 11 55 3 \ 2> $data
$"Title:" 1 1 "$(grep 'MY_BLOG_TITLE' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 30 \
$"Domain:" 2 1 "$(grep 'FULLBLOG_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 2 16 25 30 \
2> $data
fi
sel=$?
case $sel in
1) exit 1;;
255) exit 1;;
esac
MY_BLOG_TITLE=$(cat $data | sed -n 1p)
FULLBLOG_DOMAIN_NAME=$(cat $data | sed -n 2p)
if [ $FULLBLOG_DOMAIN_NAME ]; then
if [[ $FULLBLOG_DOMAIN_NAME == "$WIKI_DOMAIN_NAME" ]]; then
FULLBLOG_DOMAIN_NAME=""
fi
TEST_DOMAIN_NAME=$FULLBLOG_DOMAIN_NAME
validate_domain_name
if [[ $TEST_DOMAIN_NAME != $FULLBLOG_DOMAIN_NAME ]]; then
FULLBLOG_DOMAIN_NAME=
dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
else else
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then dialog --backtitle $"Freedombone Configuration" \
FULLBLOG_CODE=$(cat $data | sed -n 3p) --title $"Blog Configuration" \
if [ ${#FULLBLOG_CODE} -lt 30 ]; then --form $"\nPlease enter your blog details:" 11 55 3 \
FULLBLOG_DOMAIN_NAME= $"Title:" 1 1 "$(grep 'MY_BLOG_TITLE' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 30 \
dialog --title $"FreeDNS code" --msgbox "$FREEDNS_MESSAGE" 15 50 $"Domain:" 2 1 "$(grep 'FULLBLOG_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 2 16 25 30 \
2> $data
fi
sel=$?
case $sel in
1) exit 1;;
255) exit 1;;
esac
MY_BLOG_TITLE=$(cat $data | sed -n 1p)
FULLBLOG_DOMAIN_NAME=$(cat $data | sed -n 2p)
if [ $FULLBLOG_DOMAIN_NAME ]; then
if [[ $FULLBLOG_DOMAIN_NAME == "$WIKI_DOMAIN_NAME" ]]; then
FULLBLOG_DOMAIN_NAME=""
fi
TEST_DOMAIN_NAME=$FULLBLOG_DOMAIN_NAME
validate_domain_name
if [[ $TEST_DOMAIN_NAME != $FULLBLOG_DOMAIN_NAME ]]; then
FULLBLOG_DOMAIN_NAME=
dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
else
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
FULLBLOG_CODE=$(cat $data | sed -n 3p)
if [ ${#FULLBLOG_CODE} -lt 30 ]; then
FULLBLOG_DOMAIN_NAME=
dialog --title $"FreeDNS code" --msgbox "$FREEDNS_MESSAGE" 15 50
fi
fi fi
fi fi
fi fi
fi if [ $FULLBLOG_DOMAIN_NAME ]; then
if [ $FULLBLOG_DOMAIN_NAME ]; then FULLBLOG_DETAILS_COMPLETE="yes"
FULLBLOG_DETAILS_COMPLETE="yes" fi
fi done
done fi
save_configuration_file save_configuration_file
fi fi
if [[ $SYSTEM_TYPE == "$VARIANT_CLOUD" || $SYSTEM_TYPE == "$VARIANT_FULL" ]]; then if [[ $SYSTEM_TYPE == "$VARIANT_CLOUD" || $SYSTEM_TYPE == "$VARIANT_FULL" ]]; then
OWNCLOUD_DETAILS_COMPLETE= if [[ $ONION_ONLY != "no" ]]; then
while [ ! $OWNCLOUD_DETAILS_COMPLETE ] OWNCLOUD_DOMAIN_NAME='owncloud.onion'
do else
data=$(tempfile 2>/dev/null) OWNCLOUD_DETAILS_COMPLETE=
trap "rm -f $data" 0 1 2 5 15 while [ ! $OWNCLOUD_DETAILS_COMPLETE ]
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then do
dialog --backtitle $"Freedombone Configuration" \ data=$(tempfile 2>/dev/null)
--title $"Owncloud Configuration" \ trap "rm -f $data" 0 1 2 5 15
--form $"\nPlease enter your Owncloud details:" 11 55 3 \ if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
$"Domain:" 1 1 "$(grep 'OWNCLOUD_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 30 \ dialog --backtitle $"Freedombone Configuration" \
$"Code:" 2 1 "$(grep 'OWNCLOUD_CODE' temp.cfg | awk -F '=' '{print $2}')" 2 16 25 30 \ --title $"Owncloud Configuration" \
2> $data --form $"\nPlease enter your Owncloud details:" 11 55 3 \
else $"Domain:" 1 1 "$(grep 'OWNCLOUD_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 30 \
dialog --backtitle $"Freedombone Configuration" \ $"Code:" 2 1 "$(grep 'OWNCLOUD_CODE' temp.cfg | awk -F '=' '{print $2}')" 2 16 25 30 \
--title $"Owncloud Configuration" \ 2> $data
--form $"\nPlease enter your Owncloud details:" 11 55 3 \
$"Domain:" 1 1 "$(grep 'OWNCLOUD_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 30 \
2> $data
fi
sel=$?
case $sel in
1) exit 1;;
255) exit 1;;
esac
OWNCLOUD_DOMAIN_NAME=$(cat $data | sed -n 1p)
if [ $OWNCLOUD_DOMAIN_NAME ]; then
TEST_DOMAIN_NAME=$OWNCLOUD_DOMAIN_NAME
validate_domain_name
if [[ $TEST_DOMAIN_NAME != $OWNCLOUD_DOMAIN_NAME ]]; then
OWNCLOUD_DOMAIN_NAME=
dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
else else
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then dialog --backtitle $"Freedombone Configuration" \
OWNCLOUD_CODE=$(cat $data | sed -n 2p) --title $"Owncloud Configuration" \
if [ ${#OWNCLOUD_CODE} -lt 30 ]; then --form $"\nPlease enter your Owncloud details:" 11 55 3 \
OWNCLOUD_DOMAIN_NAME= $"Domain:" 1 1 "$(grep 'OWNCLOUD_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 30 \
dialog --title $"FreeDNS code" --msgbox "$FREEDNS_MESSAGE" 15 50 2> $data
fi
sel=$?
case $sel in
1) exit 1;;
255) exit 1;;
esac
OWNCLOUD_DOMAIN_NAME=$(cat $data | sed -n 1p)
if [ $OWNCLOUD_DOMAIN_NAME ]; then
TEST_DOMAIN_NAME=$OWNCLOUD_DOMAIN_NAME
validate_domain_name
if [[ $TEST_DOMAIN_NAME != $OWNCLOUD_DOMAIN_NAME ]]; then
OWNCLOUD_DOMAIN_NAME=
dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
else
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
OWNCLOUD_CODE=$(cat $data | sed -n 2p)
if [ ${#OWNCLOUD_CODE} -lt 30 ]; then
OWNCLOUD_DOMAIN_NAME=
dialog --title $"FreeDNS code" --msgbox "$FREEDNS_MESSAGE" 15 50
fi
fi fi
fi fi
fi fi
fi if [ $OWNCLOUD_DOMAIN_NAME ]; then
if [ $OWNCLOUD_DOMAIN_NAME ]; then OWNCLOUD_DETAILS_COMPLETE="yes"
OWNCLOUD_DETAILS_COMPLETE="yes" fi
fi done
done fi
save_configuration_file save_configuration_file
fi fi
if [[ $SYSTEM_TYPE == "$VARIANT_SOCIAL" || $SYSTEM_TYPE == "$VARIANT_FULL" ]]; then if [[ $SYSTEM_TYPE == "$VARIANT_SOCIAL" || $SYSTEM_TYPE == "$VARIANT_FULL" ]]; then
HUBZILLA_DETAILS_COMPLETE= if [[ $ONION_ONLY != "no" ]]; then
while [ ! $HUBZILLA_DETAILS_COMPLETE ] HUBZILLA_DOMAIN_NAME='hubzilla.onion'
do else
data=$(tempfile 2>/dev/null) HUBZILLA_DETAILS_COMPLETE=
trap "rm -f $data" 0 1 2 5 15 while [ ! $HUBZILLA_DETAILS_COMPLETE ]
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then do
dialog --backtitle $"Freedombone Configuration" \ data=$(tempfile 2>/dev/null)
--title $"Hubzilla Configuration" \ trap "rm -f $data" 0 1 2 5 15
--form $"\nPlease enter your Hubzilla details.\n\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 14 55 3 \ if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
$"Domain:" 1 1 "$(grep 'HUBZILLA_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 30 \ dialog --backtitle $"Freedombone Configuration" \
$"Code:" 2 1 "$(grep 'HUBZILLA_CODE' temp.cfg | awk -F '=' '{print $2}')" 2 16 25 30 \ --title $"Hubzilla Configuration" \
2> $data --form $"\nPlease enter your Hubzilla details.\n\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 14 55 3 \
else $"Domain:" 1 1 "$(grep 'HUBZILLA_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 30 \
dialog --backtitle $"Freedombone Configuration" \ $"Code:" 2 1 "$(grep 'HUBZILLA_CODE' temp.cfg | awk -F '=' '{print $2}')" 2 16 25 30 \
--title $"Hubzilla Configuration" \ 2> $data
--form $"\nPlease enter your Hubzilla details\n\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 11 55 3 \
$"Domain:" 1 1 "$(grep 'HUBZILLA_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 30 \
2> $data
fi
sel=$?
case $sel in
1) exit 1;;
255) exit 1;;
esac
HUBZILLA_DOMAIN_NAME=$(cat $data | sed -n 1p)
if [ $HUBZILLA_DOMAIN_NAME ]; then
TEST_DOMAIN_NAME=$HUBZILLA_DOMAIN_NAME
validate_domain_name
if [[ $TEST_DOMAIN_NAME != $HUBZILLA_DOMAIN_NAME ]]; then
HUBZILLA_DOMAIN_NAME=
dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
else else
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then dialog --backtitle $"Freedombone Configuration" \
HUBZILLA_CODE=$(cat $data | sed -n 2p) --title $"Hubzilla Configuration" \
if [ ${#HUBZILLA_CODE} -lt 30 ]; then --form $"\nPlease enter your Hubzilla details\n\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 11 55 3 \
HUBZILLA_DOMAIN_NAME= $"Domain:" 1 1 "$(grep 'HUBZILLA_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 30 \
dialog --title $"FreeDNS code" --msgbox "$FREEDNS_MESSAGE" 15 50 2> $data
fi
sel=$?
case $sel in
1) exit 1;;
255) exit 1;;
esac
HUBZILLA_DOMAIN_NAME=$(cat $data | sed -n 1p)
if [ $HUBZILLA_DOMAIN_NAME ]; then
TEST_DOMAIN_NAME=$HUBZILLA_DOMAIN_NAME
validate_domain_name
if [[ $TEST_DOMAIN_NAME != $HUBZILLA_DOMAIN_NAME ]]; then
HUBZILLA_DOMAIN_NAME=
dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
else
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
HUBZILLA_CODE=$(cat $data | sed -n 2p)
if [ ${#HUBZILLA_CODE} -lt 30 ]; then
HUBZILLA_DOMAIN_NAME=
dialog --title $"FreeDNS code" --msgbox "$FREEDNS_MESSAGE" 15 50
fi
fi fi
fi fi
fi fi
fi if [ $HUBZILLA_DOMAIN_NAME ]; then
if [ $HUBZILLA_DOMAIN_NAME ]; then HUBZILLA_DETAILS_COMPLETE="yes"
HUBZILLA_DETAILS_COMPLETE="yes" fi
fi done
done fi
save_configuration_file save_configuration_file
fi fi
if [[ $SYSTEM_TYPE == "$VARIANT_SOCIAL" || $SYSTEM_TYPE == "$VARIANT_FULL" ]]; then if [[ $SYSTEM_TYPE == "$VARIANT_SOCIAL" || $SYSTEM_TYPE == "$VARIANT_FULL" ]]; then
MICROBLOG_DETAILS_COMPLETE= if [[ $ONION_ONLY != "no" ]]; then
while [ ! $MICROBLOG_DETAILS_COMPLETE ] MICROBLOG_DOMAIN_NAME='microblog.onion'
do else
data=$(tempfile 2>/dev/null) MICROBLOG_DETAILS_COMPLETE=
trap "rm -f $data" 0 1 2 5 15 while [ ! $MICROBLOG_DETAILS_COMPLETE ]
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then do
dialog --backtitle $"Freedombone Configuration" \ data=$(tempfile 2>/dev/null)
--title $"Microblog Configuration" \ trap "rm -f $data" 0 1 2 5 15
--form $"\nPlease enter your Microblog details\n\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 11 55 3 \ if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
$"Domain:" 1 1 "$(grep 'MICROBLOG_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 30 \ dialog --backtitle $"Freedombone Configuration" \
$"Code:" 2 1 "$(grep 'MICROBLOG_CODE' temp.cfg | awk -F '=' '{print $2}')" 2 16 25 30 \ --title $"Microblog Configuration" \
2> $data --form $"\nPlease enter your Microblog details\n\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 11 55 3 \
else $"Domain:" 1 1 "$(grep 'MICROBLOG_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 30 \
dialog --backtitle $"Freedombone Configuration" \ $"Code:" 2 1 "$(grep 'MICROBLOG_CODE' temp.cfg | awk -F '=' '{print $2}')" 2 16 25 30 \
--title $"Microblog Configuration" \ 2> $data
--form $"\nPlease enter your Microblog details\n\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 11 55 3 \
$"Domain:" 1 1 "$(grep 'MICROBLOG_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 30 \
2> $data
fi
sel=$?
case $sel in
1) exit 1;;
255) exit 1;;
esac
MICROBLOG_DOMAIN_NAME=$(cat $data | sed -n 1p)
if [ $MICROBLOG_DOMAIN_NAME ]; then
if [[ $MICROBLOG_DOMAIN_NAME == "$HUBZILLA_DOMAIN_NAME" ]]; then
MICROBLOG_DOMAIN_NAME=""
fi
TEST_DOMAIN_NAME=$MICROBLOG_DOMAIN_NAME
validate_domain_name
if [[ $TEST_DOMAIN_NAME != $MICROBLOG_DOMAIN_NAME ]]; then
MICROBLOG_DOMAIN_NAME=
dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
else else
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then dialog --backtitle $"Freedombone Configuration" \
MICROBLOG_CODE=$(cat $data | sed -n 2p) --title $"Microblog Configuration" \
if [ ${#MICROBLOG_CODE} -lt 30 ]; then --form $"\nPlease enter your Microblog details\n\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 11 55 3 \
MICROBLOG_DOMAIN_NAME= $"Domain:" 1 1 "$(grep 'MICROBLOG_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 30 \
dialog --title $"FreeDNS code" --msgbox "$FREEDNS_MESSAGE" 15 50 2> $data
fi
sel=$?
case $sel in
1) exit 1;;
255) exit 1;;
esac
MICROBLOG_DOMAIN_NAME=$(cat $data | sed -n 1p)
if [ $MICROBLOG_DOMAIN_NAME ]; then
if [[ $MICROBLOG_DOMAIN_NAME == "$HUBZILLA_DOMAIN_NAME" ]]; then
MICROBLOG_DOMAIN_NAME=""
fi
TEST_DOMAIN_NAME=$MICROBLOG_DOMAIN_NAME
validate_domain_name
if [[ $TEST_DOMAIN_NAME != $MICROBLOG_DOMAIN_NAME ]]; then
MICROBLOG_DOMAIN_NAME=
dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
else
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
MICROBLOG_CODE=$(cat $data | sed -n 2p)
if [ ${#MICROBLOG_CODE} -lt 30 ]; then
MICROBLOG_DOMAIN_NAME=
dialog --title $"FreeDNS code" --msgbox "$FREEDNS_MESSAGE" 15 50
fi
fi fi
fi fi
fi fi
fi if [ $MICROBLOG_DOMAIN_NAME ]; then
if [ $MICROBLOG_DOMAIN_NAME ]; then MICROBLOG_DETAILS_COMPLETE="yes"
MICROBLOG_DETAILS_COMPLETE="yes" fi
fi done
done fi
save_configuration_file save_configuration_file
fi fi
if [[ $SYSTEM_TYPE == "$VARIANT_DEVELOPER" || $SYSTEM_TYPE == "$VARIANT_FULL" ]]; then if [[ $SYSTEM_TYPE == "$VARIANT_DEVELOPER" || $SYSTEM_TYPE == "$VARIANT_FULL" ]]; then
DEVELOPER_DETAILS_COMPLETE= if [[ $ONION_ONLY != "no" ]]; then
while [ ! $DEVELOPER_DETAILS_COMPLETE ] GIT_DOMAIN_NAME='git.onion'
do else
data=$(tempfile 2>/dev/null) DEVELOPER_DETAILS_COMPLETE=
trap "rm -f $data" 0 1 2 5 15 while [ ! $DEVELOPER_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 if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
dialog --backtitle $"Freedombone Configuration" \ dialog --backtitle $"Freedombone Configuration" \
--title $"Developer Configuration" \ --title $"Developer Configuration" \
--form $"\nPlease enter your Git hosting site details.\nIf You don't need developer tools then just select Ok" 11 55 3 \ --form $"\nPlease enter your Git hosting site details.\nIf You don't need developer tools then just select Ok" 11 55 3 \
$"Domain:" 1 1 "$(grep 'GIT_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 40 \ $"Domain:" 1 1 "$(grep 'GIT_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 40 \
$"Code:" 2 1 "$(grep 'GIT_CODE' temp.cfg | awk -F '=' '{print $2}')" 2 16 25 40 \ $"Code:" 2 1 "$(grep 'GIT_CODE' temp.cfg | awk -F '=' '{print $2}')" 2 16 25 40 \
2> $data 2> $data
else
dialog --backtitle $"Freedombone Configuration" \
--title $"Developer Configuration" \
--form $"\nPlease enter your Git hosting site details.\nIf You don't need developer tools then just select Ok" 11 55 2 \
$"Domain:" 1 1 "$(grep 'GIT_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 40 \
2> $data
fi
sel=$?
case $sel in
1) exit 1;;
255) exit 1;;
esac
GIT_DOMAIN_NAME=$(cat $data | sed -n 1p)
if [ $GIT_DOMAIN_NAME ]; then
TEST_DOMAIN_NAME=$GIT_DOMAIN_NAME
validate_domain_name
if [[ $TEST_DOMAIN_NAME != $GIT_DOMAIN_NAME ]]; then
GIT_DOMAIN_NAME=
dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
else else
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then dialog --backtitle $"Freedombone Configuration" \
GIT_CODE=$(cat $data | sed -n 2p) --title $"Developer Configuration" \
if [ ${#GIT_CODE} -lt 30 ]; then --form $"\nPlease enter your Git hosting site details.\nIf You don't need developer tools then just select Ok" 11 55 2 \
GIT_DOMAIN_NAME= $"Domain:" 1 1 "$(grep 'GIT_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 40 \
dialog --title $"FreeDNS code" --msgbox "$FREEDNS_MESSAGE" 15 50 2> $data
fi
sel=$?
case $sel in
1) exit 1;;
255) exit 1;;
esac
GIT_DOMAIN_NAME=$(cat $data | sed -n 1p)
if [ $GIT_DOMAIN_NAME ]; then
TEST_DOMAIN_NAME=$GIT_DOMAIN_NAME
validate_domain_name
if [[ $TEST_DOMAIN_NAME != $GIT_DOMAIN_NAME ]]; then
GIT_DOMAIN_NAME=
dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
else
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
GIT_CODE=$(cat $data | sed -n 2p)
if [ ${#GIT_CODE} -lt 30 ]; then
GIT_DOMAIN_NAME=
dialog --title $"FreeDNS code" --msgbox "$FREEDNS_MESSAGE" 15 50
fi
fi fi
fi fi
else
DEVELOPER_DETAILS_COMPLETE="yes"
fi fi
else if [ $GIT_DOMAIN_NAME ]; then
DEVELOPER_DETAILS_COMPLETE="yes" DEVELOPER_DETAILS_COMPLETE="yes"
fi fi
if [ $GIT_DOMAIN_NAME ]; then done
DEVELOPER_DETAILS_COMPLETE="yes" fi
fi
done
save_configuration_file save_configuration_file
fi fi
if [[ $SYSTEM_TYPE != "$VARIANT_MESH" ]]; then if [[ $SYSTEM_TYPE != "$VARIANT_MESH" ]]; then
DEFAULT_DOMAIN_DETAILS_COMPLETE= if [[ $ONION_ONLY != "no" ]]; then
while [ ! $DEFAULT_DOMAIN_DETAILS_COMPLETE ] DEFAULT_DOMAIN_NAME="${PROJECT_NAME}.onion"
do else
data=$(tempfile 2>/dev/null) DEFAULT_DOMAIN_DETAILS_COMPLETE=
trap "rm -f $data" 0 1 2 5 15 while [ ! $DEFAULT_DOMAIN_DETAILS_COMPLETE ]
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then do
dialog --backtitle $"Freedombone Configuration" \ data=$(tempfile 2>/dev/null)
--title $"Your main domain name" \ trap "rm -f $data" 0 1 2 5 15
--form $"\nWhich domain name should your email/XMPP/IRC/VoIP be associated with?" 11 55 3 \ if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
$"Domain:" 1 1 "$(grep 'DEFAULT_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 30 \ dialog --backtitle $"Freedombone Configuration" \
$"Code:" 2 1 "$(grep 'DEFAULT_DOMAIN_CODE' temp.cfg | awk -F '=' '{print $2}')" 2 16 25 30 \ --title $"Your main domain name" \
2> $data --form $"\nWhich domain name should your email/XMPP/IRC/VoIP be associated with?" 11 55 3 \
sel=$? $"Domain:" 1 1 "$(grep 'DEFAULT_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 30 \
case $sel in $"Code:" 2 1 "$(grep 'DEFAULT_DOMAIN_CODE' temp.cfg | awk -F '=' '{print $2}')" 2 16 25 30 \
1) exit 1;; 2> $data
255) exit 1;; sel=$?
esac case $sel in
DEFAULT_DOMAIN_NAME=$(cat $data | sed -n 1p) 1) exit 1;;
DEFAULT_DOMAIN_CODE=$(cat $data | sed -n 2p) 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_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= 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
fi fi
else done
fi
save_configuration_file
if [[ $ONION_ONLY != "no" ]]; then
EMAIL_ADDRESS=$MY_USERNAME@$DEFAULT_DOMAIN_NAME
else
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" \ dialog --backtitle $"Freedombone Configuration" \
--inputbox $"Which domain name should your email/XMPP/IRC/VoIP be associated with?" 10 45 \ --inputbox $"Your email address" 10 30 "$EMAIL_ADDRESS" 2> $data
"$(grep 'DEFAULT_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 2> $data
sel=$? sel=$?
case $sel in case $sel in
0) DEFAULT_DOMAIN_NAME=$(cat $data);; 0) MY_EMAIL_ADDRESS=$(cat $data);;
1) exit 1;; 1) exit 1;;
255) exit 1;; 255) exit 1;;
esac esac
fi done
if [ $DEFAULT_DOMAIN_NAME ]; then fi
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 save_configuration_file
fi fi
@ -1768,6 +1807,9 @@ function read_configuration {
if grep -q "WIFI_CHANNEL" $CONFIGURATION_FILE; then if grep -q "WIFI_CHANNEL" $CONFIGURATION_FILE; then
WIFI_CHANNEL=$(grep "WIFI_CHANNEL" $CONFIGURATION_FILE | awk -F '=' '{print $2}') WIFI_CHANNEL=$(grep "WIFI_CHANNEL" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi fi
if grep -q "ONION_ONLY" $CONFIGURATION_FILE; then
ONION_ONLY=$(grep "ONION_ONLY" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
fi fi
} }