33 * -------------------------------------------------------------
44 * File Authors : Aoran Zeng <ccmywish@qq.com>
55 * Contributors : Yangmoooo <yangmoooo@outlook.com>
6+ * |
67 * Created On : <2024-08-08>
7- * Last Modified : <2024-08-08 >
8+ * Last Modified : <2024-12-14 >
89 * ------------------------------------------------------------*/
910
1011/**
11- * @update 2024-08-08
12+ * @update 2024-12-14
1213 */
1314static Source_t os_openwrt_sources [] =
1415{
15- {& UpstreamProvider , "http ://downloads.openwrt.org" },
16+ {& UpstreamProvider , "https ://downloads.openwrt.org" },
1617 {& MirrorZ , "https://mirrors.cernet.edu.cn/openwrt" },
1718 {& Ali , "https://mirrors.aliyun.com/openwrt" },
1819 {& Tencent , "https://mirrors.cloud.tencent.com/openwrt" },
@@ -36,7 +37,9 @@ os_openwrt_getsrc (char *option)
3637}
3738
3839/**
39- * 参考: https://mirror.tuna.tsinghua.edu.cn/help/openwrt/
40+ * @consult
41+ * 1. https://mirror.tuna.tsinghua.edu.cn/help/openwrt/
42+ * 2. https://github.com/RubyMetric/chsrc/issues/153#issuecomment-2543077933
4043 */
4144void
4245os_openwrt_setsrc (char * option )
@@ -47,13 +50,38 @@ os_openwrt_setsrc (char *option)
4750
4851 chsrc_backup (OS_OpenWRT_SourceConfig );
4952
50- char * cmd = xy_strjoin (3 , "sed -E -i 's@https?://.*downloads.openwrt.org @" , source .url , "@g' " OS_OpenWRT_SourceConfig );
53+ char * cmd = xy_strjoin (3 , "sed -E -i 's@https?://.*/releases @" , source .url , "@g' " OS_OpenWRT_SourceConfig );
5154
52- chsrc_run ("apt update" , RunOpt_No_Last_New_Line );
55+ chsrc_run ("opkg update" , RunOpt_No_Last_New_Line );
5356
54- ProgMode_ChgType = ChgType_Auto ;
57+ ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto ;
5558 chsrc_conclude (& source );
5659}
5760
5861
59- def_target (os_openwrt );
62+ void
63+ os_openwrt_resetsrc (char * option )
64+ {
65+ os_openwrt_setsrc (option );
66+ }
67+
68+
69+ Feature_t
70+ os_openwrt_feat (char * option )
71+ {
72+ Feature_t f = {0 };
73+
74+ f .can_get = true;
75+ f .can_reset = true;
76+
77+ f .cap_locally = CanNot ;
78+ f .cap_locally_explain = NULL ;
79+ f .can_english = true;
80+ f .can_user_define = true;
81+
82+ f .note = NULL ;
83+ return f ;
84+ }
85+
86+
87+ def_target_gsf (os_openwrt );
0 commit comments