Skip to content

Commit

Permalink
更新 gen_image.py
Browse files Browse the repository at this point in the history
  • Loading branch information
czy21 authored Dec 23, 2024
1 parent 2095ace commit cd0bf52
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions .github/workflows/scripts/gen_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,11 @@ def flat(a) -> list: return sum(map(flat, a), []) if isinstance(a, list) else [a
profiles_obj = json.load(open(target_profiles_file, 'r'))
profiles = profiles_obj['profiles']

config_file = pathlib.Path(args.openwrt_dir).joinpath(".config")
config_bak_file = pathlib.Path(args.openwrt_dir).joinpath(".config.bak")
config_bak_file.write_text(config_file.read_text())

for pk, pv in profiles.items():
config_file.write_text(config_bak_file.read_text())
cmd_arr = [
f"cd {args.openwrt_dir};",
"make image",
f"PROFILE=\"{pk}\""
f"PROFILE={pk}"
]
image_builder_config = pv.get("image_builder_config", [])

Expand All @@ -47,7 +42,7 @@ def flat(a) -> list: return sum(map(flat, a), []) if isinstance(a, list) else [a
packages_str = " ".join(packages)

if packages:
cmd_arr.append(f"PACKAGES=\"{packages_str}\"")
cmd_arr.append(f"PACKAGES={packages_str}")

if image_builder_config:
cmd_arr.append(" ".join(image_builder_config))
Expand Down

0 comments on commit cd0bf52

Please sign in to comment.