From 11a2f2f45ee16eca520f3437b7b95a94cda0d073 Mon Sep 17 00:00:00 2001 From: xZero707 Date: Fri, 19 Nov 2021 01:44:47 +0100 Subject: [PATCH] Make it possible to define WordPress version by argument and automate process --- build/patch-util/01-create-patch.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/build/patch-util/01-create-patch.sh b/build/patch-util/01-create-patch.sh index e5e27a0..a8e6f33 100755 --- a/build/patch-util/01-create-patch.sh +++ b/build/patch-util/01-create-patch.sh @@ -3,6 +3,7 @@ MOD_FILE="mod-update-core.php" TARGET_FILE="update-core.php" PATCH_FILE="wp-admin-update-core.patch" +WP_VERSION="${1:-}" set -e cd ./wp-src @@ -44,8 +45,18 @@ echo "> Fixing patch header" sed -i "s/${MOD_FILE}/${TARGET_FILE}/g" "${PATCH_FILE}" echo "> Patch file created ${PATCH_FILE}" -echo "> Please run: " -echo " cp './wp-src/${PATCH_FILE}' '../../patches/5.x.x/'" + +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 " cp './wp-src/${PATCH_FILE}' '../../patches/5.x.x/'" +fi + + echo "" echo "> Don't forget to inspect the patch and THEN commit" echo "> Finished" \ No newline at end of file