Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
chenmozhijin committed Sep 22, 2024
1 parent 1a5713f commit 8cb2cc6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 20 deletions.
3 changes: 3 additions & 0 deletions .github/action/prepare/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ runs:
using: "composite"
steps:
# 建立环境
- name: 复制文件
run: mkdir -p /opt/OpenWrt-K && cp -RT $GITHUB_WORKSPACE /opt/OpenWrt-K
shell: bash
- name: Setup Python
uses: actions/setup-python@v5
with:
Expand Down
18 changes: 6 additions & 12 deletions .github/workflows/build-openwrt-py.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ jobs:
steps:

- uses: actions/checkout@v4
- run: mkdir -p /opt/OpenWrt-K && cp -RT $GITHUB_WORKSPACE /opt/OpenWrt-K
- name: 建立环境
uses: ./../../../../../opt/OpenWrt-K/.github/action/prepare
uses: ./.github/action/prepare

- name: 准备
id: run
Expand All @@ -55,9 +54,8 @@ jobs:
steps:

- uses: actions/checkout@v4
- run: mkdir -p /opt/OpenWrt-K && cp -RT $GITHUB_WORKSPACE /opt/OpenWrt-K
- name: 建立环境
uses: ./../../../../../opt/OpenWrt-K/.github/action/prepare
uses: ./.github/action/prepare

- name: 准备编译
id: prepare
Expand Down Expand Up @@ -101,9 +99,8 @@ jobs:
steps:

- uses: actions/checkout@v4
- run: mkdir -p /opt/OpenWrt-K && cp -RT $GITHUB_WORKSPACE /opt/OpenWrt-K
- name: 建立环境
uses: ./../../../../../opt/OpenWrt-K/.github/action/prepare
uses: ./.github/action/prepare

- name: 准备编译
id: prepare
Expand Down Expand Up @@ -135,9 +132,8 @@ jobs:
steps:

- uses: actions/checkout@v4
- run: mkdir -p /opt/OpenWrt-K && cp -RT $GITHUB_WORKSPACE /opt/OpenWrt-K
- name: 建立环境
uses: ./../../../../../opt/OpenWrt-K/.github/action/prepare
uses: ./.github/action/prepare

- name: 准备编译
id: prepare
Expand Down Expand Up @@ -169,9 +165,8 @@ jobs:
steps:

- uses: actions/checkout@v4
- run: mkdir -p /opt/OpenWrt-K && cp -RT $GITHUB_WORKSPACE /opt/OpenWrt-K
- name: 建立环境
uses: ./../../../../../opt/OpenWrt-K/.github/action/prepare
uses: ./.github/action/prepare

- name: 准备构建
id: prepare
Expand All @@ -193,9 +188,8 @@ jobs:
matrix: ${{ fromJSON(needs.prepare.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
- run: mkdir -p /opt/OpenWrt-K && cp -RT $GITHUB_WORKSPACE /opt/OpenWrt-K
- name: 建立环境
uses: ./../../../../../opt/OpenWrt-K/.github/action/prepare
uses: ./.github/action/prepare

- name: 发布
run: PYTHONPATH=/opt/OpenWrt-K python3 -m build_helper --task releases --config ${{ matrix.config }}
16 changes: 8 additions & 8 deletions build_helper/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def prepare(configs: dict[str, dict[str, Any]]) -> None:

# 下载AdGuardHome规则与配置
logger.info("下载AdGuardHome规则与配置...")
global_files_path = os.path.join(paths.root, "files")
global_files_path = os.path.join(paths.workdir, "files")
shutil.copytree(os.path.join(paths.openwrt_k, "files"), global_files_path, symlinks=True)
adg_filters_path = os.path.join(global_files_path, "usr", "bin", "AdGuardHome", "data", "filters")
os.makedirs(adg_filters_path, exist_ok=True)
Expand Down Expand Up @@ -220,7 +220,7 @@ def prepare_cfg(config: dict[str, Any],
path = os.path.join(openwrt.path, "package", "cmzj_packages", pkg_name)
pkg_path = os.path.join(cloned_repos[(pkg["REPOSITORIE"], pkg["BRANCH"])], pkg["PATH"])
if not os.path.exists(pkg_path):
msg = f"找不到拓展软件包: {pkg_name} ,这可能是由于仓库 {pkg["REPOSITORIE"]} 目录结构变更导致的,请检查您的拓展软件包配置"
msg = f"找不到{cfg_name}配置中的拓展软件包: {pkg_name} ,这可能是由于仓库 {pkg["REPOSITORIE"]} 目录结构变更导致的,请检查您的拓展软件包配置"
raise FileNotFoundError(msg)
logger.debug("复制拓展软件包 %s 到 %s", pkg_name, path)
shutil.copytree(os.path.join(cloned_repos[(pkg["REPOSITORIE"], pkg["BRANCH"])], pkg["PATH"]), path, symlinks=True)
Expand Down Expand Up @@ -249,27 +249,27 @@ def prepare_cfg(config: dict[str, Any],
openwrt.get_package_config("kmod-fast-classifier") in ("y", "m"))
enable_fullcone = openwrt.get_package_config("kmod-nft-fullcone") in ("y", "m")
if enable_fullcone or enable_sfe:
logger.info("添加952补丁")
logger.info("%s添加952补丁", cfg_name)
patch925 = f"952{"-add" if kernel_version != "5.10" else ""}-net-conntrack-events-support-multiple-registrant.patch"
shutil.copy2(os.path.join(turboacc_dir, f"hack-{kernel_version}", patch925),
os.path.join(openwrt.path, "target", "linux", "generic", f"hack-{kernel_version}", patch925))
logger.info("附加内核配置CONFIG_NF_CONNTRACK_CHAIN_EVENTS")
logger.info("%s附加内核配置CONFIG_NF_CONNTRACK_CHAIN_EVENTS", cfg_name)
with open(os.path.join(openwrt.path, "target", "linux", "generic", f"config-{kernel_version}"), "a") as f:
f.write("\n# CONFIG_NF_CONNTRACK_CHAIN_EVENTS is not set")
if enable_sfe:
logger.info("添加953补丁")
logger.info("%s添加953补丁", cfg_name)
patch953 = "953-net-patch-linux-kernel-to-support-shortcut-fe.patch"
shutil.copy2(os.path.join(turboacc_dir, f"hack-{kernel_version}", patch953),
os.path.join(openwrt.path, "target", "linux", "generic", f"hack-{kernel_version}", patch953))
logger.info("添加613补丁")
logger.info("%s添加613补丁", cfg_name)
patch613 = "613-netfilter_optional_tcp_window_check.patch"
shutil.copy2(os.path.join(turboacc_dir, f"pending-{kernel_version}", patch613),
os.path.join(openwrt.path, "target", "linux", "generic", f"pending-{kernel_version}", patch613))
logger.info("附加内核配置CONFIG_SHORTCUT_FE")
logger.info("%s附加内核配置CONFIG_SHORTCUT_FE", cfg_name)
with open(os.path.join(openwrt.path, "target", "linux", "generic", f"config-{kernel_version}"), "a") as f:
f.write("\nCONFIG_SHORTCUT_FE=y")
if enable_fullcone:
logger.info("添加libnftnl、firewall4、nftables补丁")
logger.info("%s添加libnftnl、firewall4、nftables补丁", cfg_name)
shutil.rmtree(os.path.join(openwrt.path, "package", "libs", "libnftnl"))
shutil.copytree(os.path.join(turboacc_dir, f"libnftnl-{versions['LIBNFTNL_VERSION']}"), os.path.join(openwrt.path, "package", "libs", "libnftnl"))
shutil.rmtree(os.path.join(openwrt.path, "package", "network", "config", "firewall4"))
Expand Down

0 comments on commit 8cb2cc6

Please sign in to comment.