Make it possible to define WordPress version by argument and automate process

This commit is contained in:
xZero707 2021-11-19 01:44:47 +01:00
parent a6b6205a3f
commit 11a2f2f45e

View File

@ -3,6 +3,7 @@
MOD_FILE="mod-update-core.php" MOD_FILE="mod-update-core.php"
TARGET_FILE="update-core.php" TARGET_FILE="update-core.php"
PATCH_FILE="wp-admin-update-core.patch" PATCH_FILE="wp-admin-update-core.patch"
WP_VERSION="${1:-}"
set -e set -e
cd ./wp-src cd ./wp-src
@ -44,8 +45,18 @@ echo "> Fixing patch header"
sed -i "s/${MOD_FILE}/${TARGET_FILE}/g" "${PATCH_FILE}" sed -i "s/${MOD_FILE}/${TARGET_FILE}/g" "${PATCH_FILE}"
echo "> Patch file created ${PATCH_FILE}" echo "> Patch file created ${PATCH_FILE}"
if [ -n "${WP_VERSION}" ]; then
echo "> WordPress version defined: ${WP_VERSION}"
echo "> Copying the patch file..."
mkdir "../../patches/${WP_VERSION}" -p
cp -v "./wp-src/${PATCH_FILE}" "../../patches/${WP_VERSION}/"
else
echo "> Please run: " echo "> Please run: "
echo " cp './wp-src/${PATCH_FILE}' '../../patches/5.x.x/'" echo " cp './wp-src/${PATCH_FILE}' '../../patches/5.x.x/'"
fi
echo "" echo ""
echo "> Don't forget to inspect the patch and THEN commit" echo "> Don't forget to inspect the patch and THEN commit"
echo "> Finished" echo "> Finished"