Improving the interactive configuration
This commit is contained in:
parent
49f427b8e4
commit
b7019054df
|
@ -549,13 +549,25 @@ function interactive_configuration {
|
||||||
done
|
done
|
||||||
save_configuration_file
|
save_configuration_file
|
||||||
|
|
||||||
|
if [ ! $LOCAL_NETWORK_STATIC_IP_ADDRESS ]; then
|
||||||
|
LOCAL_NETWORK_STATIC_IP_ADDRESS=$(grep 'LOCAL_NETWORK_STATIC_IP_ADDRESS' temp.cfg | awk -F '=' '{print $2}')
|
||||||
|
if [ ! $LOCAL_NETWORK_STATIC_IP_ADDRESS ]; then
|
||||||
|
LOCAL_NETWORK_STATIC_IP_ADDRESS='192.168..'
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ ! $ROUTER_IP_ADDRESS ]; then
|
||||||
|
ROUTER_IP_ADDRESS=$(grep 'ROUTER_IP_ADDRESS' temp.cfg | awk -F '=' '{print $2}')
|
||||||
|
if [ ! $ROUTER_IP_ADDRESS ]; then
|
||||||
|
ROUTER_IP_ADDRESS='192.168..'
|
||||||
|
fi
|
||||||
|
fi
|
||||||
data=$(tempfile 2>/dev/null)
|
data=$(tempfile 2>/dev/null)
|
||||||
trap "rm -f $data" 0 1 2 5 15
|
trap "rm -f $data" 0 1 2 5 15
|
||||||
dialog --backtitle "Freedombone Configuration" \
|
dialog --backtitle "Freedombone Configuration" \
|
||||||
--title "Local Network Configuration" \
|
--title "Local Network Configuration" \
|
||||||
--form "\nPlease enter the IP addresses:" 11 55 3 \
|
--form "\nPlease enter the IP addresses:" 11 55 3 \
|
||||||
"This system:" 1 1 "$(grep 'LOCAL_NETWORK_STATIC_IP_ADDRESS' temp.cfg | awk -F '=' '{print $2}')" 1 16 16 15 \
|
"This system:" 1 1 "$LOCAL_NETWORK_STATIC_IP_ADDRESS" 1 16 16 15 \
|
||||||
"Internet router:" 2 1 "$(grep 'ROUTER_IP_ADDRESS' temp.cfg | awk -F '=' '{print $2}')" 2 16 16 15 \
|
"Internet router:" 2 1 "$ROUTER_IP_ADDRESS" 2 16 16 15 \
|
||||||
2> $data
|
2> $data
|
||||||
sel=$?
|
sel=$?
|
||||||
case $sel in
|
case $sel in
|
||||||
|
@ -742,7 +754,7 @@ function interactive_configuration {
|
||||||
data=$(tempfile 2>/dev/null)
|
data=$(tempfile 2>/dev/null)
|
||||||
trap "rm -f $data" 0 1 2 5 15
|
trap "rm -f $data" 0 1 2 5 15
|
||||||
dialog --backtitle "Freedombone Configuration" \
|
dialog --backtitle "Freedombone Configuration" \
|
||||||
--inputbox "Domain name" 10 30 "$(grep 'DEFAULT_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 2> $data
|
--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=$?
|
sel=$?
|
||||||
case $sel in
|
case $sel in
|
||||||
0) DEFAULT_DOMAIN_NAME=$(cat $data);;
|
0) DEFAULT_DOMAIN_NAME=$(cat $data);;
|
||||||
|
@ -755,10 +767,15 @@ function interactive_configuration {
|
||||||
|
|
||||||
while [ ! $MY_EMAIL_ADDRESS ]
|
while [ ! $MY_EMAIL_ADDRESS ]
|
||||||
do
|
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
|
||||||
|
|
||||||
data=$(tempfile 2>/dev/null)
|
data=$(tempfile 2>/dev/null)
|
||||||
trap "rm -f $data" 0 1 2 5 15
|
trap "rm -f $data" 0 1 2 5 15
|
||||||
dialog --backtitle "Freedombone Configuration" \
|
dialog --backtitle "Freedombone Configuration" \
|
||||||
--inputbox "Your email address" 10 30 "$(grep 'MY_EMAIL_ADDRESS' temp.cfg | awk -F '=' '{print $2}')" 2> $data
|
--inputbox "Your email address" 10 30 "$EMAIL_ADDRESS" 2> $data
|
||||||
sel=$?
|
sel=$?
|
||||||
case $sel in
|
case $sel in
|
||||||
0) MY_EMAIL_ADDRESS=$(cat $data);;
|
0) MY_EMAIL_ADDRESS=$(cat $data);;
|
||||||
|
@ -786,6 +803,90 @@ function show_result {
|
||||||
echo ''
|
echo ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function read_configuration {
|
||||||
|
if [ ! $CONFIGURATION_FILE ]; then
|
||||||
|
CONFIGURATION_FILE='freedombone.cfg'
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f $CONFIGURATION_FILE ]; then
|
||||||
|
if grep -q "MY_USERNAME" $CONFIGURATION_FILE; then
|
||||||
|
MY_USERNAME=$(grep "MY_USERNAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||||
|
fi
|
||||||
|
if grep -q "DOMAIN_NAME" $CONFIGURATION_FILE; then
|
||||||
|
# for backwards compatability
|
||||||
|
DEFAULT_DOMAIN_NAME=$(grep "DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||||
|
fi
|
||||||
|
if grep -q "DEFAULT_DOMAIN_NAME" $CONFIGURATION_FILE; then
|
||||||
|
DEFAULT_DOMAIN_NAME=$(grep "DEFAULT_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||||
|
fi
|
||||||
|
if grep -q "NAMESERVER1" $CONFIGURATION_FILE; then
|
||||||
|
NAMESERVER1=$(grep "NAMESERVER1" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||||
|
fi
|
||||||
|
if grep -q "NAMESERVER2" $CONFIGURATION_FILE; then
|
||||||
|
NAMESERVER2=$(grep "NAMESERVER2" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||||
|
fi
|
||||||
|
if grep -q "DEBIAN_REPO" $CONFIGURATION_FILE; then
|
||||||
|
DEBIAN_REPO=$(grep "DEBIAN_REPO" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||||
|
CHECK_MESSAGE="Check your internet connection, /etc/network/interfaces and /etc/resolv.conf, then delete $COMPLETION_FILE, run 'rm -fR /var/lib/apt/lists/* && apt-get update --fix-missing' and run this script again. If hash sum mismatches persist then try setting $DEBIAN_REPO to a different mirror and also change /etc/apt/sources.list."
|
||||||
|
fi
|
||||||
|
if grep -q "DDNS_PROVIDER" $CONFIGURATION_FILE; then
|
||||||
|
DDNS_PROVIDER=$(grep "DDNS_PROVIDER" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||||
|
fi
|
||||||
|
if grep -q "DDNS_USERNAME" $CONFIGURATION_FILE; then
|
||||||
|
DDNS_USERNAME=$(grep "DDNS_USERNAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||||
|
fi
|
||||||
|
if grep -q "DDNS_PASSWORD" $CONFIGURATION_FILE; then
|
||||||
|
DDNS_PASSWORD=$(grep "DDNS_PASSWORD" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||||
|
fi
|
||||||
|
if grep -q "LOCAL_NETWORK_STATIC_IP_ADDRESS" $CONFIGURATION_FILE; then
|
||||||
|
LOCAL_NETWORK_STATIC_IP_ADDRESS=$(grep "LOCAL_NETWORK_STATIC_IP_ADDRESS" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||||
|
fi
|
||||||
|
if grep -q "ENABLE_CJDNS" $CONFIGURATION_FILE; then
|
||||||
|
ENABLE_CJDNS=$(grep "ENABLE_CJDNS" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||||
|
fi
|
||||||
|
if grep -q "ROUTER_IP_ADDRESS" $CONFIGURATION_FILE; then
|
||||||
|
ROUTER_IP_ADDRESS=$(grep "ROUTER_IP_ADDRESS" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||||
|
fi
|
||||||
|
if grep -q "WIKI_TITLE" $CONFIGURATION_FILE; then
|
||||||
|
WIKI_TITLE=$(grep "WIKI_TITLE" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||||
|
fi
|
||||||
|
if grep -q "MY_NAME" $CONFIGURATION_FILE; then
|
||||||
|
MY_NAME=$(grep "MY_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||||
|
fi
|
||||||
|
if grep -q "MY_EMAIL_ADDRESS" $CONFIGURATION_FILE; then
|
||||||
|
MY_EMAIL_ADDRESS=$(grep "MY_EMAIL_ADDRESS" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||||
|
fi
|
||||||
|
if grep -q "INSTALLING_ON_BBB" $CONFIGURATION_FILE; then
|
||||||
|
INSTALLING_ON_BBB=$(grep "INSTALLING_ON_BBB" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||||
|
fi
|
||||||
|
if grep -q "PUBLIC_MAILING_LIST" $CONFIGURATION_FILE; then
|
||||||
|
PUBLIC_MAILING_LIST=$(grep "PUBLIC_MAILING_LIST" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||||
|
fi
|
||||||
|
if grep -q "MICROBLOG_DOMAIN_NAME" $CONFIGURATION_FILE; then
|
||||||
|
MICROBLOG_DOMAIN_NAME=$(grep "MICROBLOG_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||||
|
fi
|
||||||
|
if grep -q "REDMATRIX_DOMAIN_NAME" $CONFIGURATION_FILE; then
|
||||||
|
REDMATRIX_DOMAIN_NAME=$(grep "REDMATRIX_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||||
|
fi
|
||||||
|
if grep -q "OWNCLOUD_DOMAIN_NAME" $CONFIGURATION_FILE; then
|
||||||
|
OWNCLOUD_DOMAIN_NAME=$(grep "OWNCLOUD_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||||
|
fi
|
||||||
|
if grep -q "WIKI_DOMAIN_NAME" $CONFIGURATION_FILE; then
|
||||||
|
WIKI_DOMAIN_NAME=$(grep "WIKI_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||||
|
fi
|
||||||
|
if grep -q "FULLBLOG_DOMAIN_NAME" $CONFIGURATION_FILE; then
|
||||||
|
FULLBLOG_DOMAIN_NAME=$(grep "FULLBLOG_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||||
|
fi
|
||||||
|
if grep -q "MY_BLOG_TITLE" $CONFIGURATION_FILE; then
|
||||||
|
MY_BLOG_TITLE=$(grep "MY_BLOG_TITLE" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||||
|
fi
|
||||||
|
if grep -q "MY_BLOG_SUBTITLE" $CONFIGURATION_FILE; then
|
||||||
|
MY_BLOG_SUBTITLE=$(grep "MY_BLOG_SUBTITLE" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
read_configuration
|
||||||
interactive_configuration
|
interactive_configuration
|
||||||
show_result
|
show_result
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in New Issue