You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.6 KiB
64 lines
1.6 KiB
#!/bin/bash
|
|
|
|
KAZ_ROOT=$(cd $(dirname $0)/../..; pwd)
|
|
. "${KAZ_ROOT}/bin/.commonFunctions.sh"
|
|
setKazVars
|
|
. "${DOCKERS_ENV}"
|
|
. "${KAZ_KEY_DIR}/SetAllPass.sh"
|
|
|
|
cd $(dirname $0)
|
|
PWD=$(pwd)
|
|
ORGA_DIR=$(basename ${PWD})
|
|
VOL_DIR=/var/lib/docker/volumes
|
|
|
|
if [[ "${ORGA_DIR}" != *"-orga" ]]
|
|
then
|
|
printKazError "it's not an orga dir"
|
|
exit
|
|
fi
|
|
ORGA=${ORGA_DIR%-orga}
|
|
if [[ -z "${ORGA}" ]]
|
|
then
|
|
printKazError "it's not an orga dir"
|
|
exit
|
|
fi
|
|
|
|
printKazMsg "init wordpress ${ORGA}"
|
|
|
|
CONF_DIR="${VOL_DIR}/orga_${ORGA}-wordpress/_data"
|
|
WP_URL="${httpProto}://${ORGA}-${wordpressHost}.${domain}"
|
|
DockerServName="${ORGA}-${wordpressServName}"
|
|
|
|
if ! [[ "$(docker ps -f name=${DockerServName} | grep -w ${DockerServName})" ]]; then
|
|
printKazError "Wordpress not running... abort"
|
|
exit
|
|
fi
|
|
|
|
echo "
|
|
CREATE DATABASE IF NOT EXISTS ${wp_MYSQL_DATABASE};
|
|
|
|
DROP USER IF EXISTS '${wp_MYSQL_USER}';
|
|
CREATE USER '${wp_MYSQL_USER}'@'%';
|
|
|
|
GRANT ALL ON ${wp_MYSQL_DATABASE}.* TO '${wp_MYSQL_USER}'@'%' IDENTIFIED BY '${wp_MYSQL_PASSWORD}';
|
|
|
|
FLUSH PRIVILEGES;" | \
|
|
docker exec -i ${ORGA}-DB bash -c "mysql --user=root --password=${wp_MYSQL_ROOT_PASSWORD}"
|
|
|
|
# XXX trouver un test du genre if ! grep -q "'installed' => true," "${PHP_CONF}" 2> /dev/null; then
|
|
printKazMsg "\n *** Premier lancement de WP"
|
|
|
|
waitUrl "${WP_URL}"
|
|
|
|
printKazMsg "reset wp ${ORGA}"
|
|
|
|
curl -X POST \
|
|
-d "user_name=${wp_WORDPRESS_ADMIN_USER}" \
|
|
-d "admin_password=${wp_WORDPRESS_ADMIN_PASSWORD}" \
|
|
-d "admin_password2=${wp_WORDPRESS_ADMIN_PASSWORD}" \
|
|
-d "pw_weak=true" \
|
|
-d "admin_email=admin@kaz.bzh" \
|
|
-d "blog_public=0" \
|
|
-d "language=fr_FR" \
|
|
"${WP_URL}/wp-admin/install.php?step=2"
|
|
echo
|
|
|