|
1 | 1 | #!/usr/bin/env python3 |
2 | | -"""Keep shared installer helpers synchronized while publishing standalone scripts.""" |
| 2 | +"""Synchronize shared helpers while keeping both public installers standalone.""" |
3 | 3 |
|
4 | 4 | from __future__ import annotations |
5 | 5 |
|
|
13 | 13 | LIGHT_INSTALLER = ROOT / "shell" / "install_openclash_dev.sh" |
14 | 14 | FULL_INSTALLER = ROOT / "shell" / "install_openclash_dev_update.sh" |
15 | 15 |
|
16 | | -# The full installer is canonical for helpers whose behavior is intentionally |
17 | | -# identical. The lightweight file embeds synchronized copies so its public |
18 | | -# curl | sh entrypoint remains self-contained. |
| 16 | +# The full installer is canonical for every helper used by both entrypoints. |
19 | 17 | SHARED_FUNCTIONS = { |
20 | 18 | "print_line", |
21 | 19 | "print_step", |
|
24 | 22 | "log_error", |
25 | 23 | "log_ok", |
26 | 24 | "die", |
| 25 | + "logo", |
27 | 26 | "restore_feed", |
| 27 | + "cleanup", |
| 28 | + "init_runtime", |
| 29 | + "detect_distribution", |
28 | 30 | "detect_environment", |
| 31 | + "select_feed_file", |
| 32 | + "rewrite_feed_to_mirror", |
| 33 | + "prepare_temporary_feed", |
29 | 34 | "package_update", |
30 | 35 | "package_install_dependencies", |
31 | | - "set_feed_file", |
32 | | - "enable_temporary_nju_mirror", |
33 | | - "fetch_package_metadata", |
34 | | - "parse_package_metadata", |
| 36 | + "install_dependencies", |
| 37 | + "check_required_commands", |
| 38 | + "curl_download", |
| 39 | + "fetch_package_refs_route", |
| 40 | + "fetch_package_branch_sha", |
| 41 | + "download_commit_file", |
35 | 42 | "parse_package_version", |
36 | | - "resolve_package_metadata", |
37 | | - "verify_file_size", |
38 | | - "verify_sha256_base64", |
| 43 | + "package_file_name", |
| 44 | + "apk_supports_allow_downgrade", |
39 | 45 | "verify_package_file", |
40 | | - "prepare_latest_package", |
41 | | - "install_openclash_package", |
42 | | - "extract_version_from_filename", |
| 46 | + "download_openclash_package", |
43 | 47 | "normalize_version", |
| 48 | + "get_installed_version", |
| 49 | + "install_openclash_package", |
| 50 | + "preserve_failed_package", |
| 51 | + "install_latest_openclash_package", |
44 | 52 | "has_cpu_flag", |
45 | 53 | "has_all_cpu_flags", |
46 | 54 | "detect_mips_float", |
47 | 55 | "detect_loongarch_abi", |
| 56 | + "detect_core_arch", |
48 | 57 | "get_effective_core_type", |
49 | | - "get_core_path", |
50 | | - "verify_core_version", |
51 | | - "update_core", |
52 | | - "start_openclash", |
| 58 | + "configure_base_uci", |
| 59 | + "run_core_update", |
| 60 | + "enable_and_restart_openclash", |
53 | 61 | } |
54 | 62 |
|
55 | 63 |
|
@@ -85,10 +93,10 @@ def synchronized_light_content(light: str, full: str) -> str: |
85 | 93 | raise ValueError(f"missing shared installer functions: {sorted(missing)}") |
86 | 94 |
|
87 | 95 | replacements = sorted( |
88 | | - [ |
| 96 | + ( |
89 | 97 | (light_functions[name], full_functions[name].content) |
90 | 98 | for name in SHARED_FUNCTIONS |
91 | | - ], |
| 99 | + ), |
92 | 100 | key=lambda item: item[0].start, |
93 | 101 | reverse=True, |
94 | 102 | ) |
|
0 commit comments