mirror of
https://github.com/RubyMetric/chsrc.git
synced 2025-01-23 04:36:15 +08:00
Support OpenWRT
[Gitee #IAAAKD]
This commit is contained in:
parent
cf121f1648
commit
eb41991060
21
src/chsrc.c
21
src/chsrc.c
|
@ -1693,6 +1693,10 @@ os_linuxlite_setsrc (char *option)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "./recipe/os/openwrt.c"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HELP: 未经测试
|
* HELP: 未经测试
|
||||||
*/
|
*/
|
||||||
|
@ -2428,23 +2432,28 @@ static const char
|
||||||
*os_solus [] = {"solus", NULL, t(&os_solus_target)},
|
*os_solus [] = {"solus", NULL, t(&os_solus_target)},
|
||||||
*os_trisquel [] = {"trisquel", NULL, t(&os_trisquel_target)},
|
*os_trisquel [] = {"trisquel", NULL, t(&os_trisquel_target)},
|
||||||
*os_linuxlite [] = {"lite", "linuxlite", NULL, t(&os_linuxlite_target)},
|
*os_linuxlite [] = {"lite", "linuxlite", NULL, t(&os_linuxlite_target)},
|
||||||
|
*os_ros [] = {"ros", "ros2", NULL, t(&os_ros_target)},
|
||||||
|
|
||||||
*os_raspberrypi[] = {"raspi", "raspberrypi",NULL, t(&os_raspberrypi_target)},
|
*os_raspberrypi[] = {"raspi", "raspberrypi",NULL, t(&os_raspberrypi_target)},
|
||||||
*os_armbian [] = {"armbian", NULL, t(&os_armbian_target)},
|
*os_armbian [] = {"armbian", NULL, t(&os_armbian_target)},
|
||||||
|
*os_openwrt [] = {"openwrt", "opkg", "LEDE", NULL, t(&os_openwrt_target)},
|
||||||
|
|
||||||
|
*os_openkylin [] = {"kylin", "openkylin", NULL, t(&os_openkylin_target)},
|
||||||
|
*os_openeuler [] = {"euler", "openeuler", NULL, t(&os_openeuler_target)},
|
||||||
|
*os_deepin [] = {"deepin", NULL, t(&os_deepin_target)},
|
||||||
|
*os_anolis [] = {"anolis", "openanolis", NULL, t(&os_anolis_target)},
|
||||||
|
|
||||||
*os_freebsd [] = {"freebsd", NULL, t(&os_freebsd_target)},
|
*os_freebsd [] = {"freebsd", NULL, t(&os_freebsd_target)},
|
||||||
*os_netbsd [] = {"netbsd", NULL, t(&os_netbsd_target)},
|
*os_netbsd [] = {"netbsd", NULL, t(&os_netbsd_target)},
|
||||||
*os_openbsd [] = {"openbsd", NULL, t(&os_openbsd_target)},
|
*os_openbsd [] = {"openbsd", NULL, t(&os_openbsd_target)},
|
||||||
*os_deepin [] = {"deepin", NULL, t(&os_deepin_target)},
|
|
||||||
*os_openeuler [] = {"euler", "openeuler", NULL, t(&os_openeuler_target)},
|
|
||||||
*os_anolis [] = {"anolis", "openanolis", NULL, t(&os_anolis_target)},
|
|
||||||
*os_openkylin [] = {"kylin", "openkylin", NULL, t(&os_openkylin_target)},
|
|
||||||
*os_ros [] = {"ros", "ros2", NULL, t(&os_ros_target)},
|
|
||||||
**os_systems[] =
|
**os_systems[] =
|
||||||
{
|
{
|
||||||
os_ubuntu, os_mint, os_debian, os_fedora, os_opensuse, os_kali,
|
os_ubuntu, os_mint, os_debian, os_fedora, os_opensuse, os_kali,
|
||||||
os_arch, os_archlinuxcn, os_manjaro, os_gentoo,
|
os_arch, os_archlinuxcn, os_manjaro, os_gentoo,
|
||||||
os_rocky, os_alma,
|
os_rocky, os_alma,
|
||||||
os_alpine, os_void, os_solus, os_ros,
|
os_alpine, os_void, os_solus, os_ros,
|
||||||
os_trisquel, os_linuxlite, os_raspberrypi, os_armbian,
|
os_trisquel, os_linuxlite, os_raspberrypi, os_armbian, os_openwrt,
|
||||||
os_deepin, os_openeuler, os_anolis, os_openkylin,
|
os_deepin, os_openeuler, os_anolis, os_openkylin,
|
||||||
os_msys2,
|
os_msys2,
|
||||||
os_freebsd, os_netbsd, os_openbsd,
|
os_freebsd, os_netbsd, os_openbsd,
|
||||||
|
|
57
src/recipe/os/openwrt.c
Normal file
57
src/recipe/os/openwrt.c
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
/** ------------------------------------------------------------
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
* -------------------------------------------------------------
|
||||||
|
* Contributors : Aoran Zeng <ccmywish@qq.com>
|
||||||
|
* Created on : <2024-08-08>
|
||||||
|
* Last modified : <2024-08-08>
|
||||||
|
* ------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 2024-08-08 更新
|
||||||
|
*/
|
||||||
|
static SourceInfo
|
||||||
|
os_openwrt_sources[] = {
|
||||||
|
{&Upstream, NULL},
|
||||||
|
{&MirrorZ, "https://mirrors.cernet.edu.cn/openwrt"},
|
||||||
|
{&Ali, "https://mirrors.aliyun.com/openwrt"},
|
||||||
|
{&Tencent, "https://mirrors.cloud.tencent.com/openwrt"},
|
||||||
|
{&Tuna, "https://mirror.tuna.tsinghua.edu.cn/openwrt"},
|
||||||
|
{&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/openwrt"},
|
||||||
|
{&Ustc, "https://mirrors.ustc.edu.cn/openwrt"},
|
||||||
|
{&Pku, "https://mirrors.pku.edu.cn/openwrt"},
|
||||||
|
{&Sustech, "https://mirrors.sustech.edu.cn/openwrt"},
|
||||||
|
};
|
||||||
|
|
||||||
|
def_sources_n(os_openwrt);
|
||||||
|
|
||||||
|
|
||||||
|
#define OS_OpenWRT_SourceConfig "/etc/opkg/distfeeds.conf"
|
||||||
|
|
||||||
|
void
|
||||||
|
os_openwrt_getsrc (char *option)
|
||||||
|
{
|
||||||
|
chsrc_view_file (OS_OpenWRT_SourceConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参考: https://mirror.tuna.tsinghua.edu.cn/help/openwrt/
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
os_openwrt_setsrc (char *option)
|
||||||
|
{
|
||||||
|
chsrc_ensure_root ();
|
||||||
|
|
||||||
|
SourceInfo source;
|
||||||
|
chsrc_yield_source (os_openwrt);
|
||||||
|
chsrc_confirm_source (&source);
|
||||||
|
|
||||||
|
chsrc_backup (OS_OpenWRT_SourceConfig);
|
||||||
|
|
||||||
|
char *cmd = xy_strjoin (3, "sed -E -i 's@https?://.*downloads.openwrt.org@", source.url, "@g' " OS_OpenWRT_SourceConfig);
|
||||||
|
|
||||||
|
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
||||||
|
chsrc_say_lastly (&source, ChsrcTypeAuto);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def_target(os_openwrt);
|
Loading…
Reference in New Issue
Block a user