mirror of
https://github.com/RubyMetric/chsrc.git
synced 2025-02-02 17:15:14 +08:00
Split armbian out
This commit is contained in:
parent
d12e626f69
commit
ed5b0981bd
|
@ -290,21 +290,6 @@ os_raspberrypi_sources[] = {
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @time 2024-06-20 更新
|
|
||||||
*/
|
|
||||||
os_armbian_sources[] = {
|
|
||||||
{&Upstream, NULL},
|
|
||||||
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/armbian"},
|
|
||||||
{&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/armbian"},
|
|
||||||
{&Bfsu, "https://mirrors.bfsu.edu.cn/armbian"},
|
|
||||||
{&Sustech, "https://mirrors.sustech.edu.cn/armbian"},
|
|
||||||
{&Ustc, "https://mirrors.ustc.edu.cn/armbian"},
|
|
||||||
{&Nju, "https://mirrors.nju.edu.cn/armbian"},
|
|
||||||
{&Ali, "https://mirrors.aliyun.com/armbian"},
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @time 2023-09-06 更新
|
* @time 2023-09-06 更新
|
||||||
|
@ -477,7 +462,6 @@ def_sources_n(os_msys2);
|
||||||
def_sources_n(os_rocky); def_sources_n(os_alma);
|
def_sources_n(os_rocky); def_sources_n(os_alma);
|
||||||
|
|
||||||
def_sources_n(os_linuxlite); def_sources_n(os_raspberrypi);
|
def_sources_n(os_linuxlite); def_sources_n(os_raspberrypi);
|
||||||
def_sources_n(os_armbian);
|
|
||||||
|
|
||||||
def_sources_n(os_ros);
|
def_sources_n(os_ros);
|
||||||
|
|
||||||
|
|
37
src/chsrc.c
37
src/chsrc.c
|
@ -104,6 +104,7 @@ os_mint_setsrc (char *option)
|
||||||
#include "recipe/os/apt-family/debian.c"
|
#include "recipe/os/apt-family/debian.c"
|
||||||
#include "recipe/os/apt-family/ubuntu.c"
|
#include "recipe/os/apt-family/ubuntu.c"
|
||||||
#include "recipe/os/apt-family/trisquel.c"
|
#include "recipe/os/apt-family/trisquel.c"
|
||||||
|
#include "recipe/os/apt-family/armbian.c"
|
||||||
|
|
||||||
void
|
void
|
||||||
os_raspberrypi_getsrc (char *option)
|
os_raspberrypi_getsrc (char *option)
|
||||||
|
@ -131,42 +132,6 @@ os_raspberrypi_setsrc (char *option)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define OS_Armbian_SOURCELIST "/etc/apt/sources.list.d/armbian.list"
|
|
||||||
void
|
|
||||||
os_armbian_getsrc (char *option)
|
|
||||||
{
|
|
||||||
if (chsrc_check_file (OS_Armbian_SOURCELIST))
|
|
||||||
{
|
|
||||||
chsrc_view_file (OS_Armbian_SOURCELIST);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
chsrc_error2 ("缺少源配置文件!路径:" OS_Armbian_SOURCELIST);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 参考: https://mirrors.tuna.tsinghua.edu.cn/help/armbian
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
os_armbian_setsrc (char *option)
|
|
||||||
{
|
|
||||||
chsrc_ensure_root ();
|
|
||||||
|
|
||||||
SourceInfo source;
|
|
||||||
chsrc_yield_source (os_armbian);
|
|
||||||
chsrc_confirm_source (&source);
|
|
||||||
|
|
||||||
chsrc_backup (OS_Armbian_SOURCELIST);
|
|
||||||
|
|
||||||
char *cmd = xy_strjoin (3, "sed -E -i 's@https?[^ ]*armbian/?[^ ]*@", source.url,
|
|
||||||
"@g' " OS_Armbian_SOURCELIST);
|
|
||||||
|
|
||||||
chsrc_run (cmd, RunOpt_Default);
|
|
||||||
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
|
||||||
chsrc_say_lastly (&source, ChsrcTypeAuto);
|
|
||||||
}
|
|
||||||
#undef OS_Armbian_SOURCELIST
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -43,7 +43,6 @@ def_target(os_mint); def_target(os_kali);
|
||||||
def_target(os_linuxlite);
|
def_target(os_linuxlite);
|
||||||
def_target(os_deepin); def_target(os_openkylin);
|
def_target(os_deepin); def_target(os_openkylin);
|
||||||
def_target(os_raspberrypi);
|
def_target(os_raspberrypi);
|
||||||
def_target(os_armbian);
|
|
||||||
def_target_noget(os_fedora);
|
def_target_noget(os_fedora);
|
||||||
def_target_noget(os_rocky);
|
def_target_noget(os_rocky);
|
||||||
def_target_noget(os_alma);
|
def_target_noget(os_alma);
|
||||||
|
|
61
src/recipe/os/apt-family/armbian.c
Normal file
61
src/recipe/os/apt-family/armbian.c
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
/** ------------------------------------------------------------
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
* -------------------------------------------------------------
|
||||||
|
* File Authors : Shengwei Chen <414685209@qq.com>
|
||||||
|
* Contributors : Aoran Zeng <ccmywish@qq.com>
|
||||||
|
* Created On : <2024-06-14>
|
||||||
|
* Last Modified : <2024-08-16>
|
||||||
|
* ------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @time 2024-06-20 更新
|
||||||
|
*/
|
||||||
|
static SourceInfo
|
||||||
|
os_armbian_sources[] = {
|
||||||
|
{&Upstream, NULL},
|
||||||
|
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/armbian"},
|
||||||
|
{&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/armbian"},
|
||||||
|
{&Bfsu, "https://mirrors.bfsu.edu.cn/armbian"},
|
||||||
|
{&Sustech, "https://mirrors.sustech.edu.cn/armbian"},
|
||||||
|
{&Ustc, "https://mirrors.ustc.edu.cn/armbian"},
|
||||||
|
{&Nju, "https://mirrors.nju.edu.cn/armbian"},
|
||||||
|
{&Ali, "https://mirrors.aliyun.com/armbian"},
|
||||||
|
};
|
||||||
|
def_sources_n(os_armbian);
|
||||||
|
|
||||||
|
void
|
||||||
|
os_armbian_getsrc (char *option)
|
||||||
|
{
|
||||||
|
if (chsrc_check_file (OS_Armbian_SourceList))
|
||||||
|
{
|
||||||
|
chsrc_view_file (OS_Armbian_SourceList);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
chsrc_error2 ("缺少源配置文件!路径:" OS_Armbian_SourceList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参考: https://mirrors.tuna.tsinghua.edu.cn/help/armbian
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
os_armbian_setsrc (char *option)
|
||||||
|
{
|
||||||
|
chsrc_ensure_root ();
|
||||||
|
|
||||||
|
SourceInfo source;
|
||||||
|
chsrc_yield_source (os_armbian);
|
||||||
|
chsrc_confirm_source (&source);
|
||||||
|
|
||||||
|
chsrc_backup (OS_Armbian_SourceList);
|
||||||
|
|
||||||
|
char *cmd = xy_strjoin (3, "sed -E -i 's@https?[^ ]*armbian/?[^ ]*@", source.url,
|
||||||
|
"@g' " OS_Armbian_SourceList);
|
||||||
|
|
||||||
|
chsrc_run (cmd, RunOpt_Default);
|
||||||
|
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
||||||
|
chsrc_say_lastly (&source, ChsrcTypeAuto);
|
||||||
|
}
|
||||||
|
#undef OS_Armbian_SourceList
|
||||||
|
|
||||||
|
def_target(os_armbian);
|
|
@ -25,6 +25,12 @@
|
||||||
#define OS_Is_Debian_Literally 1
|
#define OS_Is_Debian_Literally 1
|
||||||
#define OS_Is_Ubuntu 2
|
#define OS_Is_Ubuntu 2
|
||||||
|
|
||||||
|
|
||||||
|
#define OS_Armbian_SourceList "/etc/apt/sources.list.d/armbian.list"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 当不存在该文件时,我们只能拼凑一个假的出来,但该函数目前只适用于 Ubuntu 和 Debian
|
* 当不存在该文件时,我们只能拼凑一个假的出来,但该函数目前只适用于 Ubuntu 和 Debian
|
||||||
* 因为其它的 Debian 变体可能不使用 OS_Apt_SourceList,也可能并不适用 `VERSION_CODENAME`
|
* 因为其它的 Debian 变体可能不使用 OS_Apt_SourceList,也可能并不适用 `VERSION_CODENAME`
|
||||||
|
|
Loading…
Reference in New Issue
Block a user