|
| 1 | +/** ------------------------------------------------------------ |
| 2 | + * SPDX-License-Identifier: GPL-3.0-or-later |
| 3 | + * ------------------------------------------------------------- |
| 4 | + * File Authors : Aoran Zeng <[email protected]> |
| 5 | + * Contributors : Nul None <[email protected]> |
| 6 | + * Created On : <2025-03-04> |
| 7 | + * Last Modified : <2025-03-04> |
| 8 | + * ------------------------------------------------------------*/ |
| 9 | + |
| 10 | +/** |
| 11 | + * @update 2025-03-04 |
| 12 | + */ |
| 13 | +static Source_t |
| 14 | +os_termux_sources[] = { |
| 15 | + {&UpstreamProvider, NULL}, |
| 16 | + {&Ustc, "https://mirrors.ustc.edu.cn/termux/"}, |
| 17 | + {&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/termux/"}, |
| 18 | + {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/termux/"}, |
| 19 | + {&Bfsu, "https://mirrors.bfsu.edu.cn/termux/"}, |
| 20 | + {&Pku, "https://mirrors.pku.edu.cn/termux/"}, |
| 21 | + {&Nyist, "https://mirror.nyist.edu.cn/termux/"}, |
| 22 | + {&Nju, "https://mirror.nju.edu.cn/termux/"}, |
| 23 | + {&Sustech, "https://mirrors.sustech.edu.cn/termux/"}, |
| 24 | + {&Iscas, "https://mirror.iscas.ac.cn/termux/"}, |
| 25 | + {&Zju, "https://mirrors.zju.edu.cn/termux/"}, |
| 26 | + {&Sdu, "https://mirrors.sdu.edu.cn/termux/"}, |
| 27 | + {&Cqupt, "https://mirrors.cqupt.edu.cn/termux/"} |
| 28 | + |
| 29 | +}; |
| 30 | +def_sources_n(os_termux); |
| 31 | + |
| 32 | + |
| 33 | +/** |
| 34 | + * chsrc get termux |
| 35 | + */ |
| 36 | +void |
| 37 | +os_termux_getsrc (char *option) |
| 38 | +{ |
| 39 | + chsrc_view_file (OS_Termux_SourceList); |
| 40 | +} |
| 41 | + |
| 42 | + |
| 43 | +/** |
| 44 | + * @consult https://help.mirrors.cernet.edu.cn/termux/ |
| 45 | + * |
| 46 | + * chsrc set termux |
| 47 | + */ |
| 48 | +void |
| 49 | +os_termux_setsrc (char *option) |
| 50 | +{ |
| 51 | + |
| 52 | + // chsrc_ensure_root (); Termux下禁止使用root |
| 53 | + |
| 54 | + chsrc_yield_source_and_confirm (os_termux); |
| 55 | + |
| 56 | + char *cmd = xy_strjoin (3, "sed -i 's@^\\(deb.*stable main\\)$@#\\1\\ndeb ", |
| 57 | + source.url, "apt/termux-main stable main@' " OS_Termux_SourceList); |
| 58 | + |
| 59 | + chsrc_run (cmd, RunOpt_Default); |
| 60 | + |
| 61 | + chsrc_run ("apt update", RunOpt_Default); |
| 62 | + chsrc_run ("apt upgrade", RunOpt_Default); |
| 63 | + |
| 64 | + ProgMode_ChgType = ChgType_Auto; |
| 65 | + chsrc_conclude (&source); |
| 66 | +} |
| 67 | + |
| 68 | + |
| 69 | +/** |
| 70 | + * chsrc reset termux |
| 71 | + * |
| 72 | + * 暂时缺乏原地址 |
| 73 | + */ |
| 74 | +void |
| 75 | +os_termux_resetsrc (char *option) |
| 76 | +{ |
| 77 | + os_termux_setsrc (option); |
| 78 | +} |
| 79 | + |
| 80 | + |
| 81 | +/** |
| 82 | + * chsrc ls termux |
| 83 | + */ |
| 84 | +Feature_t |
| 85 | +os_termux_feat (char *option) |
| 86 | +{ |
| 87 | + Feature_t f = {0}; |
| 88 | + |
| 89 | + f.can_get = true; |
| 90 | + f.can_reset = false; |
| 91 | + |
| 92 | + f.cap_locally = CanNot; |
| 93 | + f.cap_locally_explain = NULL; |
| 94 | + |
| 95 | + f.can_english = false; |
| 96 | + f.can_user_define = false; |
| 97 | + |
| 98 | + f.note = NULL; |
| 99 | + return f; |
| 100 | +} |
| 101 | + |
| 102 | + |
| 103 | +def_target_gsf(os_termux); |
0 commit comments