mirror of
https://github.com/10h30/ols-docker-env.git
synced 2026-05-12 15:21:24 +09:00
demoscript fix
This commit is contained in:
Regular → Executable
Regular → Executable
+17
-4
@@ -11,6 +11,7 @@ PUB_IP=$(curl http://checkip.amazonaws.com)
|
|||||||
help_message(){
|
help_message(){
|
||||||
echo 'Command [-app app_name] [-domain domain_name]'
|
echo 'Command [-app app_name] [-domain domain_name]'
|
||||||
echo 'Example: appinstallctl.sh -app wordpress -d example.com'
|
echo 'Example: appinstallctl.sh -app wordpress -d example.com'
|
||||||
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
check_input(){
|
check_input(){
|
||||||
@@ -40,9 +41,9 @@ get_owner(){
|
|||||||
|
|
||||||
get_db_pass(){
|
get_db_pass(){
|
||||||
if [ -f ${DEFAULT_VH_ROOT}/${1}/.db_pass ]; then
|
if [ -f ${DEFAULT_VH_ROOT}/${1}/.db_pass ]; then
|
||||||
SQL_DB=$(grep -i Database ${VH_DOC_ROOT}/.db_pass | awk -F ':' '{print $2}' | tr -d '"')
|
SQL_DB=$(grep -i Database ${VH_ROOT}/.db_pass | awk -F ':' '{print $2}' | tr -d '"')
|
||||||
SQL_USER=$(grep -i Username ${VH_DOC_ROOT}/.db_pass | awk -F ':' '{print $2}' | tr -d '"')
|
SQL_USER=$(grep -i Username ${VH_ROOT}/.db_pass | awk -F ':' '{print $2}' | tr -d '"')
|
||||||
SQL_PASS=$(grep -i Password ${VH_DOC_ROOT}/.db_pass | awk -F ':' '{print $2}' | tr -d '"')
|
SQL_PASS=$(grep -i Password ${VH_ROOT}/.db_pass | awk -F ':' '{print $2}' | tr -d '"')
|
||||||
else
|
else
|
||||||
echo 'DB_PASS can not locate!'
|
echo 'DB_PASS can not locate!'
|
||||||
fi
|
fi
|
||||||
@@ -50,8 +51,10 @@ get_db_pass(){
|
|||||||
|
|
||||||
set_vh_docroot(){
|
set_vh_docroot(){
|
||||||
if [ "${VHNAME}" != '' ]; then
|
if [ "${VHNAME}" != '' ]; then
|
||||||
|
VH_ROOT="${DEFAULT_VH_ROOT}/${VHNAME}"
|
||||||
VH_DOC_ROOT="${DEFAULT_VH_ROOT}/${VHNAME}/html"
|
VH_DOC_ROOT="${DEFAULT_VH_ROOT}/${VHNAME}/html"
|
||||||
elif [ -d ${DEFAULT_VH_ROOT}/${1}/html ]; then
|
elif [ -d ${DEFAULT_VH_ROOT}/${1}/html ]; then
|
||||||
|
VH_ROOT="${DEFAULT_VH_ROOT}/${1}"
|
||||||
VH_DOC_ROOT="${DEFAULT_VH_ROOT}/${1}/html"
|
VH_DOC_ROOT="${DEFAULT_VH_ROOT}/${1}/html"
|
||||||
else
|
else
|
||||||
echo "${DEFAULT_VH_ROOT}/${1}/html does not exist, please add domain first! Abort!"
|
echo "${DEFAULT_VH_ROOT}/${1}/html does not exist, please add domain first! Abort!"
|
||||||
@@ -76,7 +79,11 @@ check_sql_native(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
preinstall_wordpress(){
|
preinstall_wordpress(){
|
||||||
|
if [ "${VHNAME}" != '' ]; then
|
||||||
|
get_db_pass ${VHNAME}
|
||||||
|
else
|
||||||
get_db_pass ${DOMAIN}
|
get_db_pass ${DOMAIN}
|
||||||
|
fi
|
||||||
if [ ! -f ${VH_DOC_ROOT}/wp-config.php ] && [ -f ${VH_DOC_ROOT}/wp-config-sample.php ]; then
|
if [ ! -f ${VH_DOC_ROOT}/wp-config.php ] && [ -f ${VH_DOC_ROOT}/wp-config-sample.php ]; then
|
||||||
cp ${VH_DOC_ROOT}/wp-config-sample.php ${VH_DOC_ROOT}/wp-config.php
|
cp ${VH_DOC_ROOT}/wp-config-sample.php ${VH_DOC_ROOT}/wp-config.php
|
||||||
NEWDBPWD="define('DB_PASSWORD', '${SQL_PASS}');"
|
NEWDBPWD="define('DB_PASSWORD', '${SQL_PASS}');"
|
||||||
@@ -85,6 +92,8 @@ preinstall_wordpress(){
|
|||||||
linechange 'DB_USER' ${VH_DOC_ROOT}/wp-config.php "${NEWDBPWD}"
|
linechange 'DB_USER' ${VH_DOC_ROOT}/wp-config.php "${NEWDBPWD}"
|
||||||
NEWDBPWD="define('DB_NAME', '${SQL_DB}');"
|
NEWDBPWD="define('DB_NAME', '${SQL_DB}');"
|
||||||
linechange 'DB_NAME' ${VH_DOC_ROOT}/wp-config.php "${NEWDBPWD}"
|
linechange 'DB_NAME' ${VH_DOC_ROOT}/wp-config.php "${NEWDBPWD}"
|
||||||
|
NEWDBPWD="define('DB_HOST', '${PUB_IP}');"
|
||||||
|
linechange 'DB_HOST' ${VH_DOC_ROOT}/wp-config.php "${NEWDBPWD}"
|
||||||
elif [ -f ${VH_DOC_ROOT}/wp-config.php ]; then
|
elif [ -f ${VH_DOC_ROOT}/wp-config.php ]; then
|
||||||
echo "${VH_DOC_ROOT}/wp-config.php already exist, exit !"
|
echo "${VH_DOC_ROOT}/wp-config.php already exist, exit !"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -98,8 +107,12 @@ app_wordpress_dl(){
|
|||||||
if [ ! -f "${VH_DOC_ROOT}/wp-config.php" ] && [ ! -f "${VH_DOC_ROOT}/wp-config-sample.php" ]; then
|
if [ ! -f "${VH_DOC_ROOT}/wp-config.php" ] && [ ! -f "${VH_DOC_ROOT}/wp-config-sample.php" ]; then
|
||||||
wp core download \
|
wp core download \
|
||||||
--allow-root \
|
--allow-root \
|
||||||
--force
|
--quiet
|
||||||
|
if [ "${VHNAME}" != '' ]; then
|
||||||
|
chown -R ${WWW_UID}:${WWW_GID} ${DEFAULT_VH_ROOT}/${VHNAME}
|
||||||
|
else
|
||||||
chown -R ${WWW_UID}:${WWW_GID} ${DEFAULT_VH_ROOT}/${DOMAIN}
|
chown -R ${WWW_UID}:${WWW_GID} ${DEFAULT_VH_ROOT}/${DOMAIN}
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo 'wp-config*.php already exist, abort!'
|
echo 'wp-config*.php already exist, abort!'
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
Regular → Executable
+34
-2
@@ -1,4 +1,36 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
docker-compose exec litespeed su -s /bin/bash lsadm -c \
|
|
||||||
'echo "admin:$(/usr/local/lsws/admin/fcgi-bin/admin_php* -q $/usr/local/lsws/admin/misc/htpasswd.php '${1}')" > /usr/local/lsws/admin/conf/htpasswd';
|
|
||||||
|
|
||||||
|
help_message(){
|
||||||
|
echo 'Command [PASSWORD]'
|
||||||
|
echo 'Example: setwebadmin.sh mypassword'
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
check_input(){
|
||||||
|
if [ -z "${1}" ]; then
|
||||||
|
help_message
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
set_web_admin(){
|
||||||
|
docker-compose exec litespeed su -s /bin/bash lsadm -c \
|
||||||
|
'echo "admin:$(/usr/local/lsws/admin/fcgi-bin/admin_php* -q /usr/local/lsws/admin/misc/htpasswd.php '${1}')" > /usr/local/lsws/admin/conf/htpasswd';
|
||||||
|
}
|
||||||
|
|
||||||
|
main(){
|
||||||
|
set_web_admin
|
||||||
|
}
|
||||||
|
|
||||||
|
check_input ${1}
|
||||||
|
while [ ! -z "${1}" ]; do
|
||||||
|
case ${1} in
|
||||||
|
-[hH] | -help | --help)
|
||||||
|
help_message
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
main
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
@@ -27,6 +27,6 @@ RUN chown 999:999 /usr/local/lsws/conf -R
|
|||||||
COPY entrypoint.sh /entrypoint.sh
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
RUN chmod +x /entrypoint.sh
|
RUN chmod +x /entrypoint.sh
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
WORKDIR /var/www/html/
|
WORKDIR /var/www/vhosts/
|
||||||
CMD ["/usr/local/lsws/bin/openlitespeed","-n"]
|
CMD ["/usr/local/lsws/bin/openlitespeed","-n"]
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,6 @@ RUN chown 999:999 /usr/local/lsws/conf -R
|
|||||||
COPY entrypoint.sh /entrypoint.sh
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
RUN chmod +x /entrypoint.sh
|
RUN chmod +x /entrypoint.sh
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
WORKDIR /var/www/html/
|
WORKDIR /var/www/vhosts/
|
||||||
CMD ["/usr/local/lsws/bin/openlitespeed","-n"]
|
CMD ["/usr/local/lsws/bin/openlitespeed","-n"]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user