This commit is contained in:
Cold-Egg
2020-01-09 16:42:48 -05:00
parent 6b9bd702d7
commit a8beeaa87e
6 changed files with 89 additions and 13 deletions
+25 -3
View File
@@ -25,11 +25,32 @@ fst_match_after(){
lst_match_line(){
fst_match_after ${1} ${2} '}'
LAST_LINE_NUM=$((${FIRST_LINE_NUM}+${FIRST_NUM_AFTER}-1))
}
}
check_input(){
if [ -z "${1}" ]; then
help_message
exit 1
fi
}
check_www(){
CHECK_WWW=$(echo ${1} | cut -c1-4)
if [[ ${CHECK_WWW} == www. ]] ; then
echo 'www domain shoudnt be passed!'
exit 1
fi
}
www_domain(){
check_www ${1}
WWW_DOMAIN=$(echo www.${1})
}
add_domain(){
dot_escape ${1}
DOMAIN=${ESCAPE}
www_domain ${1}
check_duplicate "member.*${DOMAIN}" ${HTTPD_CONF}
if [ "${CK_RESULT}" != '' ]; then
echo "# It appears the domain already exist! Check the ${HTTPD_CONF} if you believe this is a mistake!"
@@ -37,7 +58,7 @@ add_domain(){
else
perl -0777 -p -i -e 's/(vhTemplate centralConfigLog \{[^}]+)\}*(^.*listeners.*$)/\1$2
member '${1}' {
vhDomain '${1}'
vhDomain '${1},${WWW_DOMAIN}'
}/gmi' ${HTTPD_CONF}
fi
}
@@ -56,6 +77,7 @@ del_domain(){
fi
}
check_input ${1}
while [ ! -z "${1}" ]; do
case ${1} in
-[hH] | -help | --help)
@@ -69,7 +91,7 @@ while [ ! -z "${1}" ]; do
;;
*)
help_message
;;
;;
esac
shift
done