wordpress/rootfs/etc/s6-overlay/s6-rc.d/init-wpcontent/run
2024-10-29 20:37:29 +01:00

25 lines
809 B
Plaintext
Executable File

#!/command/with-contenv bash
# shellcheck shell=bash
# init-wpcontent main
main() {
# This will prepend service name to all output from here
exec > >(while read -r line; do echo "[init-wpcontent] ${line}"; done) 2>&1
local wpContentDir="/var/www/html/wp-content"
local wpThemesDir="${wpContentDir}/themes"
# If themes directory is empty
if [ ! -d "${wpThemesDir}" ] || [ -z "$(ls -A "${wpThemesDir}")" ]; then
if [ "${WORDPRESS_INIT_NO_SYNC_THEMES:-false}" = "true" ]; then
echo "Warning: Themes directory is empty, but sync is disabled"
return
fi
echo "Themes directory is empty, copying default themes"
rsync -a --ignore-existing --stats /usr/src/wordpress/wp-content/themes "${wpContentDir}/"
return
fi
}
main