This commit is contained in:
Bob Mottram 2016-10-09 11:24:54 +01:00
parent a15ec75aff
commit e4bb83835c
1 changed files with 20 additions and 115 deletions

View File

@ -181,125 +181,30 @@ function check_system_type {
echo "System type: $SYSTEM_TYPE" echo "System type: $SYSTEM_TYPE"
} }
# check that domain names are sensible # check that domain names are valid and that they are unique for each app
function check_domains { function check_domains {
if [ ${#WIKI_DOMAIN_NAME} -gt 1 ]; then specified_domains=$(cat $CONFIGURATION_FILE | grep "_DOMAIN_NAME" | uniq)
function_check test_domain_name domains_array=($specified_domains)
test_domain_name "$WIKI_DOMAIN_NAME" checked_domains=()
if [[ "$test_domain_name" == "$FULLBLOG_DOMAIN_NAME" ]]; then for d in "${domains_array[@]}"
echo $'Wiki domain name is the same as blog domain name. They must be different' do
exit 97326 domain_param=$(echo "$d" | awk -F '=' '{print $1}')
fi if [[ $domain_param != "DEFAULT_DOMAIN_NAME" ]]; then
if [[ "$test_domain_name" == "$MICROBLOG_DOMAIN_NAME" ]]; then domain_value=$(echo "$d" | awk -F '=' '{print $2}')
echo $'Wiki domain name is the same as microblog domain name. They must be different' item_in_array "${domain_value}" "${checked_domains[@]}"
exit 36827 if [[ $? != 0 ]]; then
fi # test that this is a valid domain name
if [[ "$test_domain_name" == "$HUBZILLA_DOMAIN_NAME" ]]; then function_check test_domain_name
echo $'Wiki domain name is the same as hubzilla domain name. They must be different' test_domain_name "$domain_value"
exit 65848 # add it to the list of domains
fi checked_domains+=("$domain_value")
if [ ${#GIT_DOMAIN_NAME} -gt 1 ]; then else
if [[ "$test_domain_name" == "$GIT_DOMAIN_NAME" ]]; then echo $"Domain ${domain_value} collides with another app. The domain for each app should be unique."
echo $'Wiki domain name is the same as Gogs domain name. They must be different' exit 673925
exit 73529
fi fi
fi fi
fi done
if [ ${#FULLBLOG_DOMAIN_NAME} -gt 1 ]; then
function_check test_domain_name
test_domain_name "$FULLBLOG_DOMAIN_NAME"
if [[ "$test_domain_name" == "$WIKI_DOMAIN_NAME" ]]; then
echo $'Blog domain name is the same as wiki domain name. They must be different'
exit 62348
fi
if [[ "$test_domain_name" == "$MICROBLOG_DOMAIN_NAME" ]]; then
echo $'Blog domain name is the same as microblog domain name. They must be different'
exit 38236
fi
if [[ "$test_domain_name" == "$HUBZILLA_DOMAIN_NAME" ]]; then
echo $'Blog domain name is the same as hubzilla domain name. They must be different'
exit 35483
fi
if [ $GIT_DOMAIN_NAME ]; then
if [[ "$test_domain_name" == "$GIT_DOMAIN_NAME" ]]; then
echo $'Blog domain name is the same as Gogs domain name. They must be different'
exit 84695
fi
fi
fi
if [ ${#MICROBLOG_DOMAIN_NAME} -gt 1 ]; then
function_check test_domain_name
test_domain_name "$MICROBLOG_DOMAIN_NAME"
if [[ "$test_domain_name" == "$WIKI_DOMAIN_NAME" ]]; then
echo $'Microblog domain name is the same as wiki domain name. They must be different'
exit 73924
fi
if [[ "$test_domain_name" == "$FULLBLOG_DOMAIN_NAME" ]]; then
echo $'Microblog domain name is the same as blog domain name. They must be different'
exit 26832
fi
if [[ "$test_domain_name" == "$HUBZILLA_DOMAIN_NAME" ]]; then
echo $'Microblog domain name is the same as hubzilla domain name. They must be different'
exit 678382
fi
if [ $GIT_DOMAIN_NAME ]; then
if [[ "$test_domain_name" == "$GIT_DOMAIN_NAME" ]]; then
echo $'Microblog domain name is the same as Gogs domain name. They must be different'
exit 684325
fi
fi
fi
if [ $HUBZILLA_DOMAIN_NAME ]; then
function_check test_domain_name
test_domain_name "$HUBZILLA_DOMAIN_NAME"
if [[ "$test_domain_name" == "$WIKI_DOMAIN_NAME" ]]; then
echo $'Hubzilla domain name is the same as wiki domain name. They must be different'
exit 83682
fi
if [[ "$test_domain_name" == "$FULLBLOG_DOMAIN_NAME" ]]; then
echo $'Hubzilla domain name is the same as blog domain name. They must be different'
exit 74817
fi
if [[ "$test_domain_name" == "$MICROBLOG_DOMAIN_NAME" ]]; then
echo $'Hubzilla domain name is the same as microblog domain name. They must be different'
exit 83683
fi
if [ ${#GIT_DOMAIN_NAME} -gt 1 ]; then
if [[ "$test_domain_name" == "$GIT_DOMAIN_NAME" ]]; then
echo $'Hubzilla domain name is the same as Gogs domain name. They must be different'
exit 135523
fi
fi
fi
if [ ${#GIT_DOMAIN_NAME} -gt 1 ]; then
function_check test_domain_name
test_domain_name "$GIT_DOMAIN_NAME"
if [[ "$test_domain_name" == "$WIKI_DOMAIN_NAME" ]]; then
echo $'Hubzilla domain name is the same as wiki domain name. They must be different'
exit 83682
fi
if [[ "$test_domain_name" == "$FULLBLOG_DOMAIN_NAME" ]]; then
echo $'Hubzilla domain name is the same as blog domain name. They must be different'
exit 74817
fi
if [[ "$test_domain_name" == "$MICROBLOG_DOMAIN_NAME" ]]; then
echo $'Hubzilla domain name is the same as microblog domain name. They must be different'
exit 83683
fi
if [[ "$test_domain_name" == "$HUBZILLA_DOMAIN_NAME" ]]; then
echo $'Microblog domain name is the same as hubzilla domain name. They must be different'
exit 678382
fi
fi
} }
# NOTE: deliberately no exit 0 # NOTE: deliberately no exit 0