master
Cold-Egg 5 years ago
parent 6b9bd702d7
commit a8beeaa87e

@ -19,6 +19,11 @@ app_download(){
exit 0 exit 0
} }
main(){
app_download ${APP_NAME} ${DOMAIN}
}
check_input ${1}
while [ ! -z "${1}" ]; do while [ ! -z "${1}" ]; do
case ${1} in case ${1} in
-[hH] | -help | --help) -[hH] | -help | --help)
@ -39,4 +44,4 @@ while [ ! -z "${1}" ]; do
shift shift
done done
app_download ${APP_NAME} ${DOMAIN} main

@ -1,3 +1,48 @@
#!/usr/bin/env bash #!/usr/bin/env bash
docker-compose exec litespeed su -c "certbot certonly --agree-tos --register-unsafely-without-email --webroot -w /var/www/vhosts/${1}/html -d ${1} -d www.${1}" DOMAIN=''
echo OLS needs to be restarted to detect the certificates
help_message(){
echo 'Command [your_domain]'
echo 'Script will get database password and wordpress password from .env file and install the demo wordpress site for you'
}
check_input(){
if [ -z "${1}" ]; then
help_message
exit 1
fi
}
strip_www(){
CHECK_WWW=$(echo ${1} | cut -c1-4)
if [[ ${CHECK_WWW} == www. ]] ; then
DOMAIN=$(echo ${1} | cut -c 5-)
else
DOMAIN=${1}
fi
}
lecertapply(){
docker-compose exec litespeed su -c "certbot certonly --agree-tos --register-unsafely-without-email \
--non-interactive --webroot -w /var/www/vhosts/${1}/html -d ${1} -d www.${1}"
}
main(){
strip_www ${1}
lecertapply ${DOMAIN}
}
check_input ${1}
while [ ! -z "${1}" ]; do
case ${1} in
-[hH] | -help | --help)
help_message
;;
*)
main ${1}
;;
esac
shift
done

@ -27,9 +27,30 @@ lst_match_line(){
LAST_LINE_NUM=$((${FIRST_LINE_NUM}+${FIRST_NUM_AFTER}-1)) 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(){ add_domain(){
dot_escape ${1} dot_escape ${1}
DOMAIN=${ESCAPE} DOMAIN=${ESCAPE}
www_domain ${1}
check_duplicate "member.*${DOMAIN}" ${HTTPD_CONF} check_duplicate "member.*${DOMAIN}" ${HTTPD_CONF}
if [ "${CK_RESULT}" != '' ]; then if [ "${CK_RESULT}" != '' ]; then
echo "# It appears the domain already exist! Check the ${HTTPD_CONF} if you believe this is a mistake!" 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 else
perl -0777 -p -i -e 's/(vhTemplate centralConfigLog \{[^}]+)\}*(^.*listeners.*$)/\1$2 perl -0777 -p -i -e 's/(vhTemplate centralConfigLog \{[^}]+)\}*(^.*listeners.*$)/\1$2
member '${1}' { member '${1}' {
vhDomain '${1}' vhDomain '${1},${WWW_DOMAIN}'
}/gmi' ${HTTPD_CONF} }/gmi' ${HTTPD_CONF}
fi fi
} }
@ -56,6 +77,7 @@ del_domain(){
fi fi
} }
check_input ${1}
while [ ! -z "${1}" ]; do while [ ! -z "${1}" ]; do
case ${1} in case ${1} in
-[hH] | -help | --help) -[hH] | -help | --help)

@ -106,6 +106,14 @@ specify_setup_main(){
store_credential ${DOMAIN} store_credential ${DOMAIN}
} }
main(){
if [ "${SQL_USER}" != '' ] && [ "${SQL_PASS}" != '' ] && [ "${SQL_DB}" != '' ]; then
specify_setup_main
else
auto_setup_main
fi
}
check_input ${1} check_input ${1}
while [ ! -z "${1}" ]; do while [ ! -z "${1}" ]; do
case ${1} in case ${1} in
@ -130,9 +138,4 @@ while [ ! -z "${1}" ]; do
esac esac
shift shift
done done
main
if [ "${SQL_USER}" != '' ] && [ "${SQL_PASS}" != '' ] && [ "${SQL_DB}" != '' ]; then
specify_setup_main
else
auto_setup_main
fi

@ -29,7 +29,7 @@ while [ ! -z "${1}" ]; do
help_message help_message
;; ;;
*) *)
main main ${1}
;; ;;
esac esac
shift shift

@ -57,6 +57,7 @@ RewriteFile .htaccess
vhssl { vhssl {
keyFile /etc/letsencrypt/live/$VH_NAME/privkey.pem keyFile /etc/letsencrypt/live/$VH_NAME/privkey.pem
certFile /etc/letsencrypt/live/$VH_NAME/fullchain.pem certFile /etc/letsencrypt/live/$VH_NAME/fullchain.pem
certChain 1
} }
} }

Loading…
Cancel
Save