Support Termux
Some checks failed
Publish AUR Package (chsrc-git) / publish (push) Waiting to run
macOS Build / build-and-upload-on-M1 (push) Has been cancelled
macOS Build / build-and-upload-on-x64 (push) Has been cancelled
Windows Build / build-and-upload (push) Has been cancelled
Linux ARMv7 Build / armv7-linu-build-and-upload (push) Has been cancelled
Linux x64 Build / x64-linux-build-and-upload (push) Has been cancelled
Linux AArch64 Build / aarch64-linux-build-and-upload (push) Has been cancelled
Linux riscv64 Build / riscv64-linux-build-and-upload (push) Has been cancelled

[GitHub #173]
This commit is contained in:
Aoran Zeng 2025-03-04 05:16:41 +08:00
parent 915adab934
commit e2fd640045
No known key found for this signature in database
GPG Key ID: 8F8BA8488E10ED98
5 changed files with 112 additions and 2 deletions

View File

@ -89,6 +89,7 @@
#include "recipe/os/APT/Armbian.c"
// Independent
#include "recipe/os/APT/ROS.c"
#include "recipe/os/APT/Termux.c"
#include "recipe/os/APT/openKylin.c"
#include "recipe/os/APT/deepin.c"

View File

@ -90,6 +90,7 @@ static const char
*os_raspberrypi[] = {"raspi", "raspberrypi",NULL, t(&os_raspberrypi_target)},
*os_armbian [] = {"armbian", NULL, t(&os_armbian_target)},
*os_openwrt [] = {"openwrt", "opkg", "LEDE", NULL, t(&os_openwrt_target)},
*os_termux [] = {"termux", NULL, t(&os_termux_target)},
*os_openkylin [] = {"openkylin", NULL, t(&os_openkylin_target)},
*os_openeuler [] = {"openeuler", NULL, t(&os_openeuler_target)},
@ -103,7 +104,7 @@ static const char
**os_systems[] =
{
os_debian, os_ubuntu, os_linuxmint, os_kali,
os_trisquel, os_linuxlite, os_raspberrypi, os_armbian, os_openwrt,
os_trisquel, os_linuxlite, os_raspberrypi, os_armbian, os_openwrt, os_termux,
os_deepin, os_openkylin, os_ros,
os_fedora, os_rockylinux, os_almalinux, os_openeuler, os_anolis,

103
src/recipe/os/APT/Termux.c Normal file
View File

@ -0,0 +1,103 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Nul None <nul@none.org>
* Created On : <2025-03-04>
* Last Modified : <2025-03-04>
* ------------------------------------------------------------*/
/**
* @update 2025-03-04
*/
static Source_t
os_termux_sources[] = {
{&UpstreamProvider, NULL},
{&Ustc, "https://mirrors.ustc.edu.cn/termux/"},
{&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/termux/"},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/termux/"},
{&Bfsu, "https://mirrors.bfsu.edu.cn/termux/"},
{&Pku, "https://mirrors.pku.edu.cn/termux/"},
{&Nyist, "https://mirror.nyist.edu.cn/termux/"},
{&Nju, "https://mirror.nju.edu.cn/termux/"},
{&Sustech, "https://mirrors.sustech.edu.cn/termux/"},
{&Iscas, "https://mirror.iscas.ac.cn/termux/"},
{&Zju, "https://mirrors.zju.edu.cn/termux/"},
{&Sdu, "https://mirrors.sdu.edu.cn/termux/"},
{&Cqupt, "https://mirrors.cqupt.edu.cn/termux/"}
};
def_sources_n(os_termux);
/**
* chsrc get termux
*/
void
os_termux_getsrc (char *option)
{
chsrc_view_file (OS_Termux_SourceList);
}
/**
* @consult https://help.mirrors.cernet.edu.cn/termux/
*
* chsrc set termux
*/
void
os_termux_setsrc (char *option)
{
// chsrc_ensure_root (); Termux下禁止使用root
chsrc_yield_source_and_confirm (os_termux);
char *cmd = xy_strjoin (3, "sed -i 's@^\\(deb.*stable main\\)$@#\\1\\ndeb ",
source.url, "apt/termux-main stable main@' " OS_Termux_SourceList);
chsrc_run (cmd, RunOpt_Default);
chsrc_run ("apt update", RunOpt_Default);
chsrc_run ("apt upgrade", RunOpt_Default);
ProgMode_ChgType = ChgType_Auto;
chsrc_conclude (&source);
}
/**
* chsrc reset termux
*
*
*/
void
os_termux_resetsrc (char *option)
{
os_termux_setsrc (option);
}
/**
* chsrc ls termux
*/
Feature_t
os_termux_feat (char *option)
{
Feature_t f = {0};
f.can_get = true;
f.can_reset = false;
f.cap_locally = CanNot;
f.cap_locally_explain = NULL;
f.can_english = false;
f.can_user_define = false;
f.note = NULL;
return f;
}
def_target_gsf(os_termux);

View File

@ -30,8 +30,9 @@ os_trisquel_getsrc (char *option)
chsrc_view_file (OS_Apt_SourceList);
}
/**
* : https://help.mirrors.cernet.edu.cn/trisquel/
* @consult: https://help.mirrors.cernet.edu.cn/trisquel/
*/
void
os_trisquel_setsrc (char *option)
@ -51,4 +52,5 @@ os_trisquel_setsrc (char *option)
chsrc_conclude (&source);
}
def_target(os_trisquel);

View File

@ -30,6 +30,9 @@
// independent
#define OS_ROS_SourceList OS_Apt_SourceList_D "ros-latest.list"
#define OS_Termux_SourceList "/data/data/com.termux/files/usr" OS_Apt_SourceList
// Ubuntu based
#define OS_LinuxMint_SourceList OS_Apt_SourceList_D "official-package-repositories.list"