From 53ed359b0e3029ca9028b5decb7320f74070d62b Mon Sep 17 00:00:00 2001 From: pexcn Date: Sat, 2 Mar 2024 23:59:45 +0800 Subject: [PATCH] add global patch function --- .gitmodules | 4 ++++ build.sh | 16 +++++++++++++++- patches | 1 + 3 files changed, 20 insertions(+), 1 deletion(-) create mode 160000 patches diff --git a/.gitmodules b/.gitmodules index 846e829..5aecedd 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,3 +2,7 @@ path = configs url = https://github.com/openwrt-ipq60xx/configs.git branch = main +[submodule "patches"] + path = patches + url = https://github.com/openwrt-ipq60xx/patches.git + branch = main diff --git a/build.sh b/build.sh index 0140828..63ce7d4 100755 --- a/build.sh +++ b/build.sh @@ -1,5 +1,5 @@ #!/bin/sh -# shellcheck disable=SC3043,SC2086,SC2164,SC2103,SC2046 +# shellcheck disable=SC2086,SC3043,SC2164,SC2103,SC2046,SC3011,SC2155 get_sources() { git clone $BUILD_REPO --single-branch -b $GITHUB_REF_NAME openwrt @@ -13,6 +13,19 @@ echo_version() { cd configs && git log -1 && cd - } +apply_patches() { + [ -d patches ] || return 0 + + dirname $(find patches -type f -name "*.patch") | sort -u | while read -r dir; do + local patch_dir="$(realpath $dir)" + cd "$(sed 's|^patches/|openwrt/|' <<<$dir)" + find $patch_dir -type f -name "*.patch" | while read -r patch; do + git am $patch + done + cd - + done +} + build_firmware() { cd openwrt @@ -42,6 +55,7 @@ package_dl_src() { get_sources echo_version +apply_patches build_firmware package_binaries package_dl_src diff --git a/patches b/patches new file mode 160000 index 0000000..2732366 --- /dev/null +++ b/patches @@ -0,0 +1 @@ +Subproject commit 27323663ab48a45cce9b05289c565c672ed3b52c