Can specify microblog welcome message during interactive install

This commit is contained in:
Bob Mottram 2016-02-04 15:16:51 +00:00
parent 674b3f010c
commit 04860eb32c
1 changed files with 19 additions and 6 deletions

View File

@ -95,6 +95,7 @@ HUBZILLA_DOMAIN_NAME=
HUBZILLA_CODE=
MICROBLOG_DOMAIN_NAME=
MICROBLOG_CODE=
MICROBLOG_WELCOME_MESSAGE=$"<h1>Welcome to \$MICROBLOG_DOMAIN_NAME a federated microblog</h1><p>Another $PROJECT_NAME site</p>"
GIT_DOMAIN_NAME=
GIT_CODE=
MEDIAGOBLIN_DOMAIN_NAME=
@ -257,6 +258,9 @@ function save_configuration_file {
if [ $MICROBLOG_CODE ]; then
echo "MICROBLOG_CODE=$MICROBLOG_CODE" >> $CONFIGURATION_FILE
fi
if [ $MICROBLOG_WELCOME_MESSAGE ]; then
echo "MICROBLOG_WELCOME_MESSAGE=$MICROBLOG_WELCOME_MESSAGE" >> $CONFIGURATION_FILE
fi
if [ $GIT_DOMAIN_NAME ]; then
echo "GIT_DOMAIN_NAME=$GIT_DOMAIN_NAME" >> $CONFIGURATION_FILE
fi
@ -1572,15 +1576,17 @@ function interactive_configuration {
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
dialog --backtitle $"Freedombone Configuration" \
--title $"Microblog Configuration" \
--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 \
$"Code:" 2 1 "$(grep 'MICROBLOG_CODE' temp.cfg | awk -F '=' '{print $2}')" 2 16 25 30 \
--form $"\nPlease enter your Microblog details\n\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 14 65 3 \
$"Domain:" 1 1 "$(grep 'MICROBLOG_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 20 25 30 \
$"Welcome Message:" 2 1 "$(grep '$MICROBLOG_WELCOME_MESSAGE' temp.cfg | awk -F '=' '{print $2}')" 3 20 50 30 \
$"Code:" 3 1 "$(grep 'MICROBLOG_CODE' temp.cfg | awk -F '=' '{print $2}')" 2 20 25 30 \
2> $data
else
dialog --backtitle $"Freedombone Configuration" \
--title $"Microblog Configuration" \
--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 \
--form $"\nPlease enter your Microblog details\n\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 13 65 3 \
$"Domain:" 1 1 "$(grep 'MICROBLOG_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 20 25 30 \
$"Welcome Message:" 2 1 "$(grep '$MICROBLOG_WELCOME_MESSAGE' temp.cfg | awk -F '=' '{print $2}')" 2 20 50 30 \
2> $data
fi
sel=$?
@ -1589,6 +1595,10 @@ function interactive_configuration {
255) exit 1;;
esac
MICROBLOG_DOMAIN_NAME=$(cat $data | sed -n 1p)
welcome_msg=$(cat $data | sed -n 2p)
if [ ${#welcome_msg} -gt 1 ]; then
MICROBLOG_WELCOME_MESSAGE=$welcome_msg
fi
if [ $MICROBLOG_DOMAIN_NAME ]; then
if [[ $MICROBLOG_DOMAIN_NAME == "$HUBZILLA_DOMAIN_NAME" ]]; then
MICROBLOG_DOMAIN_NAME=""
@ -1600,7 +1610,7 @@ function interactive_configuration {
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)
MICROBLOG_CODE=$(cat $data | sed -n 3p)
if [ ${#MICROBLOG_CODE} -lt 30 ]; then
MICROBLOG_DOMAIN_NAME=
dialog --title $"FreeDNS code" --msgbox "$FREEDNS_MESSAGE" 15 50
@ -1867,6 +1877,9 @@ function read_configuration {
if grep -q "MICROBLOG_CODE" $CONFIGURATION_FILE; then
MICROBLOG_CODE=$(grep "MICROBLOG_CODE" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "MICROBLOG_WELCOME_MESSAGE" $CONFIGURATION_FILE; then
MICROBLOG_WELCOME_MESSAGE=$(grep "MICROBLOG_WELCOME_MESSAGE" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "HUBZILLA_DOMAIN_NAME" $CONFIGURATION_FILE; then
HUBZILLA_DOMAIN_NAME=$(grep "HUBZILLA_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi