From 2aaf7abedd154f646765d42d622585c9253b03cd Mon Sep 17 00:00:00 2001 From: xZero707 Date: Tue, 9 Feb 2021 21:27:12 +0100 Subject: [PATCH] Add automated plugins installer --- rootfs/etc/cont-init.d/20-install-plugins | 25 +++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 rootfs/etc/cont-init.d/20-install-plugins diff --git a/rootfs/etc/cont-init.d/20-install-plugins b/rootfs/etc/cont-init.d/20-install-plugins new file mode 100755 index 0000000..7d7806f --- /dev/null +++ b/rootfs/etc/cont-init.d/20-install-plugins @@ -0,0 +1,25 @@ +#!/usr/bin/with-contenv bash +set -e + +PLUGIN_LIST="${WP_PLUGIN_LIST:-}" + +echo "> Automated WordPress Plugin Installer" + +if [ -z "${PLUGIN_LIST}" ]; then + echo "> No plugins defined. Skipping installation." + exit 0 +fi + +echo "> About to install defined plugins" +for PLUGIN_NAME in ${PLUGIN_LIST}; do + IFS=':' read -ra PLUGIN <<<"${PLUGIN_NAME}" + + WP_PLUGIN_INSTALL_ARGS="${PLUGIN[0]}" + + if [ -n "${PLUGIN[1]}" ]; then + WP_PLUGIN_INSTALL_ARGS="${WP_PLUGIN_INSTALL_ARGS} --version=${PLUGIN[1]}" + fi + + echo "> Installing plugin '${PLUGIN[0]}' version '${PLUGIN[1]}'" + wp plugin install ${WP_PLUGIN_INSTALL_ARGS} +done \ No newline at end of file