aboutsummaryrefslogtreecommitdiff
path: root/docker/scripts/post
diff options
context:
space:
mode:
authorChristophe Romain <christophe.romain@process-one.net>2018-01-11 10:19:56 +0100
committerChristophe Romain <christophe.romain@process-one.net>2018-01-11 10:19:56 +0100
commitd6e1bc242c11b74f1aedde1398322253a753225d (patch)
treef18b670be077d1669ab2383da1e2d2e524771b74 /docker/scripts/post
parentPrepare mix for 18.01 (diff)
Remove old docker specs
Diffstat (limited to 'docker/scripts/post')
-rwxr-xr-xdocker/scripts/post/10_ejabberd_modules_update_specs.sh24
-rwxr-xr-xdocker/scripts/post/11_ejabberd_install_modules.sh143
-rwxr-xr-xdocker/scripts/post/20_ejabberd_register_users.sh118
-rwxr-xr-xdocker/scripts/post/99_first_start_done.sh14
4 files changed, 0 insertions, 299 deletions
diff --git a/docker/scripts/post/10_ejabberd_modules_update_specs.sh b/docker/scripts/post/10_ejabberd_modules_update_specs.sh
deleted file mode 100755
index 01f20001e..000000000
--- a/docker/scripts/post/10_ejabberd_modules_update_specs.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-set -e
-
-# Updates the known modules as to be found in https://github.com/processone/ejabberd-contrib
-
-source "${EJABBERD_HOME}/scripts/lib/base_config.sh"
-source "${EJABBERD_HOME}/scripts/lib/config.sh"
-source "${EJABBERD_HOME}/scripts/lib/base_functions.sh"
-source "${EJABBERD_HOME}/scripts/lib/functions.sh"
-
-
-run_modules_update_specs() {
- echo -n 'Updating module specs... '
- ${EJABBERDCTL} modules_update_specs
-}
-
-
-is_true ${EJABBERD_SKIP_MODULES_UPDATE} \
- && exit 0
-
-run_modules_update_specs
-
-
-exit 0
diff --git a/docker/scripts/post/11_ejabberd_install_modules.sh b/docker/scripts/post/11_ejabberd_install_modules.sh
deleted file mode 100755
index 8089fe9f2..000000000
--- a/docker/scripts/post/11_ejabberd_install_modules.sh
+++ /dev/null
@@ -1,143 +0,0 @@
-#!/bin/bash
-set -e
-
-# Installs modules as defined in environment variables
-
-source "${EJABBERD_HOME}/scripts/lib/base_config.sh"
-source "${EJABBERD_HOME}/scripts/lib/config.sh"
-source "${EJABBERD_HOME}/scripts/lib/base_functions.sh"
-source "${EJABBERD_HOME}/scripts/lib/functions.sh"
-
-install_module_from_source() {
- local module_name=$1
- local module_source_path=${EJABBERD_HOME}/module_source/${module_name}
- local module_install_folder=${EJABBERD_HOME}/.ejabberd-modules/sources
-
- echo "Analyzing module ${module_name} for installation"
- # Make sure that the module exists in the source folder before attempting a copy
-
- if [ ! -d ${module_source_path} ]; then
- echo "Error: Module ${module_name} not found in ${EJABBERD_HOME}/module_source"
- echo "Please use a shared volume to populate your module in ${EJABBERD_HOME}/module_source"
- return 1;
- fi
-
- # Check to see if the module is already installed
- local install_count=$(${EJABBERDCTL} modules_installed | grep -ce "^${module_name}[[:space:]]")
- if [ $install_count -gt 0 ]; then
- echo "Error: Module already installed: ${module_name}"
- return 1;
- fi
-
- # Copy the module into the shared folder
- echo "Copying module to ejabberd folder ${module_install_folder}"
- mkdir -p ${module_install_folder}
- cp -R ${module_source_path} ${module_install_folder}
-
- # Run the ejabberdctl module_check on the module
- echo "Running module_check on ${module_name}"
- ${EJABBERDCTL} module_check ${module_name}
- if [ $? -ne 0 ]; then
- echo "Module check failed for ${module_name}"
- return 1;
- fi
- echo "Module check succeeded for ${module_name}"
-
- # Install the module
- echo "Running module_install on ${module_name}"
- ${EJABBERDCTL} module_install ${module_name}
- if [ $? -ne 0 ]; then
- echo "Module installation failed for ${module_name}"
- return 1;
- fi
- echo "Module installation succeeded for ${module_name}"
-
- return 0;
-}
-
-install_module_from_ejabberd_contrib() {
- local module_name=$1
-
- # Check to see if the module is already installed
- local install_count=$(${EJABBERDCTL} modules_installed | grep -ce "^${module_name}[[:space:]]")
- if [ $install_count -gt 0 ]; then
- echo "Error: Module already installed: ejabberd_contrib ${module_name}"
- return 1;
- fi
-
- # Install the module
- echo "Running module_install on ejabberd_contrib ${module_name}"
- ${EJABBERDCTL} module_install ${module_name}
- if [ $? -ne 0 ]; then
- echo "Module installation failed for ejabberd_contrib ${module_name}"
- return 1;
- fi
- echo "Module installation succeeded for ejabberd_contrib ${module_name}"
-
- return 0;
-}
-
-enable_custom_auth_module_override() {
- module_name=$1;
- # When using custom authentication modules, the module name must be
- # in the following pattern: ejabberd_auth_foo, where foo is the
- # value you will use for your auth_method yml configuration.
- required_prefix="ejabberd_auth_"
-
- if [[ "${module_name}" != "${required_prefix}"* ]]; then
- echo "Error: module_name must begin with ${required_prefix}"
- exit 1;
- fi
-
- echo "Checking custom auth module: ${module_name}"
- # Make sure the auth module is installed
- local install_count=$(${EJABBERDCTL} modules_installed | grep -ce "^${module_name}[[:space:]]")
- if [ $install_count -eq 0 ]; then
- echo "Error: custom auth_module not installed: ${module_name}"
- return 1;
- fi
-
- custom_auth_method=${module_name#$required_prefix}
- echo -e "\nauth_method: [${custom_auth_method}]" >> ${CONFIGFILE}
- echo "Custom auth module ${module_name} configuration complete."
-}
-
-file_exist ${FIRST_START_DONE_FILE} \
- && exit 0
-
-is_restart_needed=0;
-
-if [ -n "${EJABBERD_SOURCE_MODULES}" ]; then
- for module_name in ${EJABBERD_SOURCE_MODULES} ; do
- install_module_from_source ${module_name}
- done
- is_restart_needed=1;
-fi
-
-# Check the EJABBERD_CONTRIB_MODULES variable for any ejabberd_contrib modules
-if [ -n "${EJABBERD_CONTRIB_MODULES}" ]; then
- for module_name in ${EJABBERD_CONTRIB_MODULES} ; do
- install_module_from_ejabberd_contrib ${module_name}
- done
- is_restart_needed=1;
-fi
-
-# If a custom module was defined for handling auth, we need to override
-# the pre-defined auth methods in the config.
-if [ -n "${EJABBERD_CUSTOM_AUTH_MODULE_OVERRIDE}" ]; then
- enable_custom_auth_module_override "${EJABBERD_CUSTOM_AUTH_MODULE_OVERRIDE}"
- is_restart_needed=1;
-fi
-
-# If any modules were installed, restart the server, if the option is enabled
-if [ ${is_restart_needed} -eq 1 ]; then
- if is_true ${EJABBERD_RESTART_AFTER_MODULE_INSTALL} ; then
- echo "Restarting ejabberd after successful module installation(s)"
- ${EJABBERDCTL} restart
- child=$!
- ${EJABBERDCTL} "started"
- wait $child
- fi
-fi
-
-exit 0
diff --git a/docker/scripts/post/20_ejabberd_register_users.sh b/docker/scripts/post/20_ejabberd_register_users.sh
deleted file mode 100755
index 0a9569559..000000000
--- a/docker/scripts/post/20_ejabberd_register_users.sh
+++ /dev/null
@@ -1,118 +0,0 @@
-#!/bin/bash
-
-source "${EJABBERD_HOME}/scripts/lib/base_config.sh"
-source "${EJABBERD_HOME}/scripts/lib/config.sh"
-source "${EJABBERD_HOME}/scripts/lib/base_functions.sh"
-source "${EJABBERD_HOME}/scripts/lib/functions.sh"
-
-# Do not exit if users already registered
-set +e
-
-randpw() {
- < /dev/urandom tr -dc A-Z-a-z-0-9 | head -c ${1:-16};
- echo;
-}
-
-
-register_user() {
- local user=$1
- local domain=$2
- local password=$3
-
- ${EJABBERDCTL} register ${user} ${domain} ${password}
- return $?
-}
-
-
-register_all_users() {
- # register users from environment $EJABBERD_USERS with given
- # password or random password written to stout. Use whitespace
- # to seperate users.
- #
- # sample:
- # - add a user with an given password:
- # -e "EJABBERD_USERS=admin@example.com:adminSecret"
- # - add a user with a random password:
- # -e "EJABBERD_USERS=user@example.com"
- # - set password for admin and use random for user1:
- # -e "EJABBERD_USERS=admin@example.com:adminSecret user@example.com"
-
- for user in ${EJABBERD_USERS} ; do
- local jid=${user%%:*}
- local password=${user#*:}
-
- local username=${jid%%@*}
- local domain=${jid#*@}
-
- [[ "${password}" == "${jid}" ]] \
- && password=$(randpw)
-
- register_user ${username} ${domain} ${password}
- local retval=$?
-
- [[ ${retval} -eq 0 ]] \
- && echo "Password for user ${username}@${domain} is ${password}"
- done
-}
-
-
-file_exist ${FIRST_START_DONE_FILE} \
- && exit 0
-
-
-file_exist ${CLUSTER_NODE_FILE} \
- && exit 0
-
-
-is_set ${EJABBERD_USERS} \
- && register_all_users
-
-
-##################################
-## Keep for backward compatibility
-
-register_all_ejabberd_admins() {
- # add all admins from environment $EJABBERD_ADMINS with the passwords from
- # environment $EJABBERD_ADMIN_PASS.
-
- local passwords
- local IFS=' '
- read -a passwords <<< "${EJABBERD_ADMIN_PWD}"
-
- for admin in ${EJABBERD_ADMINS} ; do
- local user=${admin%%@*}
- local domain=${admin#*@}
- local password=${passwords[0]}
- passwords=("${passwords[@]:1}")
- register_user ${user} ${domain} ${password}
- done
-}
-
-
-register_all_ejabberd_admins_randpw() {
- # add all admins from environment $EJABBERD_ADMINS with a random
- # password and write the password to stdout.
-
- for admin in ${EJABBERD_ADMINS} ; do
- local user=${admin%%@*}
- local domain=${admin#*@}
- local password=$(randpw)
-
- register_user ${user} ${domain} ${password}
- local retval=$?
-
- [[ ${retval} -eq 0 ]] \
- && echo "Password for user ${user}@${domain} is ${password}"
- done
-}
-
-
-is_set ${EJABBERD_ADMIN_PWD} \
- && register_all_ejabberd_admins
-
-
-is_true ${EJABBERD_ADMIN_RANDPWD} \
- && register_all_ejabberd_admins_randpw
-
-
-exit 0
diff --git a/docker/scripts/post/99_first_start_done.sh b/docker/scripts/post/99_first_start_done.sh
deleted file mode 100755
index b64d94b07..000000000
--- a/docker/scripts/post/99_first_start_done.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/bash
-set -e
-
-# Write a first-start-done file
-
-source "${EJABBERD_HOME}/scripts/lib/base_config.sh"
-source "${EJABBERD_HOME}/scripts/lib/config.sh"
-source "${EJABBERD_HOME}/scripts/lib/base_functions.sh"
-source "${EJABBERD_HOME}/scripts/lib/functions.sh"
-
-
-if [ ! -e "${FIRST_START_DONE_FILE}" ]; then
- touch ${FIRST_START_DONE_FILE}
-fi