Split armbian out

This commit is contained in:
Aoran Zeng 2024-08-16 02:07:38 +08:00
parent d12e626f69
commit ed5b0981bd
No known key found for this signature in database
GPG Key ID: 8F8BA8488E10ED98
5 changed files with 68 additions and 53 deletions

View File

@ -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
@ -477,7 +462,6 @@ def_sources_n(os_msys2);
def_sources_n(os_rocky); def_sources_n(os_alma);
def_sources_n(os_linuxlite); def_sources_n(os_raspberrypi);
def_sources_n(os_armbian);
def_sources_n(os_ros);

View File

@ -104,6 +104,7 @@ os_mint_setsrc (char *option)
#include "recipe/os/apt-family/debian.c"
#include "recipe/os/apt-family/ubuntu.c"
#include "recipe/os/apt-family/trisquel.c"
#include "recipe/os/apt-family/armbian.c"
void
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

View File

@ -43,7 +43,6 @@ def_target(os_mint); def_target(os_kali);
def_target(os_linuxlite);
def_target(os_deepin); def_target(os_openkylin);
def_target(os_raspberrypi);
def_target(os_armbian);
def_target_noget(os_fedora);
def_target_noget(os_rocky);
def_target_noget(os_alma);

View 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);

View File

@ -25,6 +25,12 @@
#define OS_Is_Debian_Literally 1
#define OS_Is_Ubuntu 2
#define OS_Armbian_SourceList "/etc/apt/sources.list.d/armbian.list"
/**
* Ubuntu Debian
* Debian 使 OS_Apt_SourceList `VERSION_CODENAME`