Fix site details with title

This commit is contained in:
Bob Mottram 2016-10-15 22:01:59 +01:00
parent 393022a97e
commit 3263fb3fe6
1 changed files with 22 additions and 18 deletions

View File

@ -174,9 +174,11 @@ function interactive_site_details_with_title {
SITE_BACKTITLE=$"Freedombone Configuration" SITE_BACKTITLE=$"Freedombone Configuration"
SITE_CONFIG_TITLE=$"${site_name^} Configuration" SITE_CONFIG_TITLE=$"${site_name^} Configuration"
SITE_FORM_TEXT=$"\nPlease enter your ${site_name^} details.\n\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" SITE_FORM_TEXT=$"\nPlease enter your ${site_name^} details.\n\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:"
SITE_TITLE=$2
SITE_DOMAIN_NAME=$3 SITE_TITLE=
SITE_CODE=$4 SITE_DOMAIN_NAME=
SITE_CODE=
SITE_DETAILS_COMPLETE= SITE_DETAILS_COMPLETE=
while [ ! $SITE_DETAILS_COMPLETE ] while [ ! $SITE_DETAILS_COMPLETE ]
do do
@ -203,37 +205,39 @@ function interactive_site_details_with_title {
1) exit 1;; 1) exit 1;;
255) exit 1;; 255) exit 1;;
esac esac
${!SITE_TITLE}=$(cat $data | sed -n 1p) SITE_TITLE=$(cat $data | sed -n 1p)
${!SITE_DOMAIN_NAME}=$(cat $data | sed -n 2p) SITE_DOMAIN_NAME=$(cat $data | sed -n 2p)
if [ ${!SITE_DOMAIN_NAME} ]; then site_domain_name_str="$SITE_DOMAIN_NAME"
TEST_DOMAIN_NAME=${!SITE_DOMAIN_NAME} if [ ${#site_domain_name_str} -gt 1 ]; then
TEST_DOMAIN_NAME="$SITE_DOMAIN_NAME"
validate_domain_name validate_domain_name
if [[ $TEST_DOMAIN_NAME != ${!SITE_DOMAIN_NAME} ]]; then if [[ "$TEST_DOMAIN_NAME" != "${SITE_DOMAIN_NAME}" ]]; then
${!SITE_DOMAIN_NAME}= SITE_DOMAIN_NAME=
dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50 dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
else else
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
${!SITE_CODE}=$(cat $data | sed -n 3p) SITE_CODE=$(cat $data | sed -n 3p)
validate_freedns_code "${!SITE_CODE}" validate_freedns_code "${SITE_CODE}"
if [ ! $VALID_CODE ]; then if [ ! $VALID_CODE ]; then
${!SITE_DOMAIN_NAME}= SITE_DOMAIN_NAME=
fi fi
fi fi
fi fi
fi fi
site_title_str="${!SITE_TITLE}" site_title_str="$SITE_TITLE"
if [ ${#site_title_str} -gt 0 ]; then if [ ${#site_title_str} -gt 0 ]; then
if [ ${!SITE_DOMAIN_NAME} ]; then if [ ${SITE_DOMAIN_NAME} ]; then
SITE_DETAILS_COMPLETE="yes" SITE_DETAILS_COMPLETE="yes"
fi fi
fi fi
done done
# save the results in the config file # save the results in the config file
write_config_param "$SITE_TITLE" "${!SITE_TITLE}" write_config_param "$2" "${!SITE_TITLE}"
write_config_param "$SITE_DOMAIN_NAME" "${!SITE_DOMAIN_NAME}" write_config_param "$3" "${!SITE_DOMAIN_NAME}"
if [ ${!SITE_CODE} ]; then site_code_str="$SITE_CODE"
write_config_param "$SITE_CODE" "${!SITE_CODE}" if [ ${#site_code_str} -gt 1 ]; then
write_config_param "$4" "${!SITE_CODE}"
fi fi
} }