Split raspberrypi out

This commit is contained in:
Aoran Zeng 2024-08-16 02:25:45 +08:00
parent 0edab81981
commit 37886aba47
No known key found for this signature in database
GPG Key ID: 8F8BA8488E10ED98
6 changed files with 63 additions and 51 deletions

View File

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

View File

@ -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"

View File

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

View File

@ -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"
/**

View File

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

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