mirror of
https://github.com/RubyMetric/chsrc.git
synced 2025-01-22 23:39:30 +08:00
Split raspberrypi out
This commit is contained in:
parent
0edab81981
commit
37886aba47
|
@ -263,20 +263,6 @@ os_linuxlite_sources[] = {
|
|||
|
||||
|
||||
|
||||
/**
|
||||
* @time 2023-09-29 更新
|
||||
*/
|
||||
os_raspberrypi_sources[] = {
|
||||
{&Upstream, NULL},
|
||||
{&MirrorZ, "https://help.mirrors.cernet.edu.cn/raspberrypi/"},
|
||||
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/raspberrypi/"},
|
||||
{&Bfsu, "https://mirrors.bfsu.edu.cn/raspberrypi/"},
|
||||
{&Ustc, "https://mirrors.ustc.edu.cn/raspberrypi/"},
|
||||
{&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/raspberrypi/"},
|
||||
{&Sustech, "https://mirrors.sustech.edu.cn/raspberrypi/"}
|
||||
},
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @time 2023-09-06 更新
|
||||
|
@ -447,7 +433,7 @@ def_sources_n(os_kali);
|
|||
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_linuxlite);
|
||||
|
||||
def_sources_n(os_ros);
|
||||
|
||||
|
|
27
src/chsrc.c
27
src/chsrc.c
|
@ -75,32 +75,7 @@ pl_clojure_setsrc (char *option)
|
|||
#include "recipe/os/apt-family/linuxmint.c"
|
||||
#include "recipe/os/apt-family/trisquel.c"
|
||||
#include "recipe/os/apt-family/armbian.c"
|
||||
|
||||
void
|
||||
os_raspberrypi_getsrc (char *option)
|
||||
{
|
||||
chsrc_view_file ("/etc/apt/sources.list.d/raspi.list");
|
||||
}
|
||||
|
||||
void
|
||||
os_raspberrypi_setsrc (char *option)
|
||||
{
|
||||
// chsrc_ensure_root(); // HELP: 不确定是否需要
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (os_raspberrypi);
|
||||
chsrc_confirm_source (&source);
|
||||
|
||||
chsrc_backup ("/etc/apt/sources.list.d/raspi.list");
|
||||
|
||||
char *cmd = xy_strjoin (3, "sed -E -i 's@https?://.*/.*/?@", source.url,
|
||||
"@g' /etc/apt/sources.list.d/raspi.list");
|
||||
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
||||
chsrc_say_lastly (&source, ChsrcTypeUntested);
|
||||
}
|
||||
|
||||
#include "recipe/os/apt-family/raspberrypi.c"
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -42,7 +42,6 @@ static const char
|
|||
def_target(os_kali);
|
||||
def_target(os_linuxlite);
|
||||
def_target(os_deepin); def_target(os_openkylin);
|
||||
def_target(os_raspberrypi);
|
||||
def_target_noget(os_fedora);
|
||||
def_target_noget(os_rocky);
|
||||
def_target_noget(os_alma);
|
||||
|
|
|
@ -7,6 +7,9 @@
|
|||
* Last Modified : <2024-08-16>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
#define OS_Apt_SourceList "/etc/apt/sources.list"
|
||||
#define OS_Apt_SourceList_D "/etc/apt/sources.list.d/"
|
||||
|
||||
/**
|
||||
* @note 从 Debian 12 开始,Debain 的软件源配置文件变更为 DEB822 格式,
|
||||
* 路径为: /etc/apt/sources.list.d/debian.sources"
|
||||
|
@ -14,21 +17,18 @@
|
|||
* @note 从 Ubuntu 24.04 开始,Ubuntu 的软件源配置文件变更为 DEB822 格式,
|
||||
* 路径为: /etc/apt/sources.list.d/ubuntu.sources
|
||||
*/
|
||||
|
||||
#define OS_Debian_SourceList_DEB822 "/etc/apt/sources.list.d/debian.sources"
|
||||
#define OS_Ubuntu_SourceList_DEB822 "/etc/apt/sources.list.d/ubuntu.sources"
|
||||
|
||||
#define OS_Apt_SourceList "/etc/apt/sources.list"
|
||||
|
||||
#define ETC_os_release "/etc/os-release"
|
||||
|
||||
#define OS_Is_Debian_Literally 1
|
||||
#define OS_Is_Ubuntu 2
|
||||
|
||||
|
||||
#define OS_Armbian_SourceList "/etc/apt/sources.list.d/armbian.list"
|
||||
|
||||
|
||||
#define OS_LinuxMint_SourceList OS_Apt_SourceList_D "official-package-repositories.list"
|
||||
#define OS_Armbian_SourceList OS_Apt_SourceList_D "armbian.list"
|
||||
#define OS_RaspberryPi_SourceList OS_Apt_SourceList_D "raspi.list"
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -24,7 +24,7 @@ def_sources_n(os_linuxmint);
|
|||
void
|
||||
os_linuxmint_getsrc (char *option)
|
||||
{
|
||||
chsrc_view_file ("/etc/apt/sources.list.d/official-package-repositories.list");
|
||||
chsrc_view_file (OS_LinuxMint_SourceList);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -39,10 +39,10 @@ os_linuxmint_setsrc (char *option)
|
|||
chsrc_yield_source (os_linuxmint);
|
||||
chsrc_confirm_source (&source);
|
||||
|
||||
chsrc_backup ("/etc/apt/sources.list.d/official-package-repositories.list");
|
||||
chsrc_backup (OS_LinuxMint_SourceList);
|
||||
|
||||
char* cmd = xy_strjoin (3, "sed -E -i 's@https?://.*/.*/?@", source.url,
|
||||
"@g' /etc/apt/sources.list.d/official-package-repositories.list");
|
||||
"@g' " OS_LinuxMint_SourceList);
|
||||
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
||||
|
|
52
src/recipe/os/apt-family/raspberrypi.c
Normal file
52
src/recipe/os/apt-family/raspberrypi.c
Normal file
|
@ -0,0 +1,52 @@
|
|||
/** ------------------------------------------------------------
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
* -------------------------------------------------------------
|
||||
* File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
* Contributors : Nil Null <nil@null.org>
|
||||
* Created On : <2023-09-29>
|
||||
* Last Modified : <2024-08-16>
|
||||
*
|
||||
* Raspberry Pi OS 树莓派操作系统,以前称为 Raspbian
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @time 2023-09-29 更新
|
||||
*/
|
||||
static SourceInfo
|
||||
os_raspberrypi_sources[] = {
|
||||
{&Upstream, NULL},
|
||||
{&MirrorZ, "https://help.mirrors.cernet.edu.cn/raspberrypi/"},
|
||||
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/raspberrypi/"},
|
||||
{&Bfsu, "https://mirrors.bfsu.edu.cn/raspberrypi/"},
|
||||
{&Ustc, "https://mirrors.ustc.edu.cn/raspberrypi/"},
|
||||
{&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/raspberrypi/"},
|
||||
{&Sustech, "https://mirrors.sustech.edu.cn/raspberrypi/"}
|
||||
};
|
||||
def_sources_n(os_raspberrypi);
|
||||
|
||||
void
|
||||
os_raspberrypi_getsrc (char *option)
|
||||
{
|
||||
chsrc_view_file (OS_RaspberryPi_SourceList);
|
||||
}
|
||||
|
||||
void
|
||||
os_raspberrypi_setsrc (char *option)
|
||||
{
|
||||
chsrc_ensure_root(); // HELP: 不确定是否需要
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (os_raspberrypi);
|
||||
chsrc_confirm_source (&source);
|
||||
|
||||
chsrc_backup (OS_RaspberryPi_SourceList);
|
||||
|
||||
char *cmd = xy_strjoin (3, "sed -E -i 's@https?://.*/.*/?@", source.url,
|
||||
"@g' " OS_RaspberryPi_SourceList);
|
||||
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
||||
chsrc_say_lastly (&source, ChsrcTypeUntested);
|
||||
}
|
||||
|
||||
def_target(os_raspberrypi);
|
Loading…
Reference in New Issue
Block a user