mirror of
https://github.com/RubyMetric/chsrc
synced 2025-12-24 11:32:01 +08:00
Split armbian out
This commit is contained in:
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/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
|
||||
|
||||
Reference in New Issue
Block a user