57 lines
1.5 KiB
Bash
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
set -euo pipefail
# Configuration
SRC_BASE="/mnt/place-config/etc/php"
DEST_BASE="/etc/php"
# Use both environment variables if they exist
VERSIONS_TO_PROCESS="$(echo "${PHP_VERSIONS:-} ${BUILDTIME_PHP_VER_INST:-}" | xargs -n1 | sort -u | xargs)"
if [ -z "$VERSIONS_TO_PROCESS" ]; then
echo " No PHP versions specified in environment variables"
exit 0
fi
echo "🔍 Processing PHP versions: $VERSIONS_TO_PROCESS"
for version in $VERSIONS_TO_PROCESS; do
src_dir="${SRC_BASE}/${version}/fpm/pool.d"
dest_dir="${DEST_BASE}/${version}/fpm/pool.d"
echo -e "\n📦 Checking PHP ${version}..."
# Verify source directory exists
if [ ! -d "$src_dir" ]; then
echo " ⚠️ Source directory not found: $src_dir"
continue
fi
# Count .conf files
conf_files=("$src_dir"/*.conf)
if [ ${#conf_files[@]} -eq 0 ]; then
echo " ✅ No .conf files to copy (directory empty)"
continue
fi
# Process each .conf file
copied=0
for conf_file in "${conf_files[@]}"; do
if [ ! -f "$conf_file" ]; then
continue
fi
filename=$(basename "$conf_file")
echo " ➤ Copying: $filename"
cp -f "$conf_file" "$dest_dir/" && \
chmod 644 "${dest_dir}/${filename}" && \
chown root:root "${dest_dir}/${filename}" && \
copied=$((copied + 1))
done
echo " ✔ Copied $copied files for PHP $version"
done
echo -e "\n✅ Configuration copy completed"