Add support for Trisquel

Gitee close #I84XQQ
This commit is contained in:
Aoran Zeng 2023-09-29 19:12:57 +08:00
parent 92c55ed6dc
commit f674bd118c

37
chsrc.c
View File

@ -3,7 +3,7 @@
* License : GPLv3
* Authors : Aoran Zeng <ccmywish@qq.com>
* Created on : <2023-08-28>
* Last modified : <2023-09-27>
* Last modified : <2023-09-29>
*
* chsrc:
*
@ -12,7 +12,7 @@
* GPLv3 LICENSE.txt
* ------------------------------------------------------------*/
#define Chsrc_Version "v0.1.2-20230927"
#define Chsrc_Version "v0.1.2-20230929"
#include "chsrc.h"
@ -1211,6 +1211,36 @@ os_manjaro_setsrc(char* option)
void
os_trisquel_getsrc (char* option)
{
chsrc_check_file ("/etc/apt/sources.list");
}
/**
* : https://help.mirrors.cernet.edu.cn/trisquel/
*/
void
os_trisquel_setsrc (char* option)
{
ensure_root();
int index = use_specific_mirror_or_auto_select (option, os_trisquel);
source_info source = os_trisquel_sources[index];
chsrc_say_selection(&source);
chsrc_backup ("/etc/apt/sources.list");
char* cmd = xy_strjoin(3, "sed -E -i 's@https?://.*/trisquel/?@", source.url, "@g' /etc/apt/sources.list");
puts(cmd);
chsrc_run("sudo apt update");
chsrc_say_thanks(&source);
}
/**
* HELP:
*/
@ -1759,6 +1789,7 @@ def_target_info(os_ubuntu);
def_target_info(os_debian);
def_target_info(os_deepin);
def_target_info(os_void);
def_target_info(os_trisquel);
def_target_info(os_netbsd);
def_target_info(os_openbsd);
@ -1790,6 +1821,7 @@ static const char
*os_rocky [] = {"rocky", "rockylinux", NULL, targetinfo(&os_rocky_target)},
*os_alpine [] = {"alpine", NULL, targetinfo(&os_alpine_target)},
*os_void [] = {"void", "voidlinux", NULL, targetinfo(&os_void_target)},
*os_trisquel [] = {"trisquel", NULL, targetinfo(&os_trisquel_target)},
*os_freebsd [] = {"freebsd", NULL, targetinfo(&os_freebsd_target)},
*os_netbsd [] = {"netbsd", NULL, targetinfo(&os_netbsd_target)},
*os_openbsd [] = {"openbsd", NULL, targetinfo(&os_openbsd_target)},
@ -1802,6 +1834,7 @@ static const char
os_arch, os_manjaro, os_gentoo,
os_rocky,
os_alpine,
os_trisquel,
os_freebsd, os_netbsd, os_openbsd,
os_msys2,
os_deepin, os_openeuler, os_openkylin,