mirror of
https://github.com/RubyMetric/chsrc
synced 2025-06-14 23:37:01 +08:00
Split texlive out
This commit is contained in:
parent
019b0b060b
commit
9d7a121947
@ -151,29 +151,8 @@ pl_dotnet_sources[] = {
|
|||||||
{&Huawei, "https://mirrors.huaweicloud.com/repository/nuget/v3"}
|
{&Huawei, "https://mirrors.huaweicloud.com/repository/nuget/v3"}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @time 2023-09-10 更新
|
|
||||||
*/
|
|
||||||
static SourceInfo
|
|
||||||
wr_tex_sources[] = {
|
|
||||||
{&Upstream, NULL},
|
|
||||||
{&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/ctan/systems/texlive/tlnet"},
|
|
||||||
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/tlnet"},
|
|
||||||
{&Bfsu, "https://mirrors.bfsu.edu.cn/CTAN/systems/texlive/tlnet"},
|
|
||||||
{&Lzuoss, "https://mirror.lzu.edu.cn/CTAN/systems/texlive/tlnet"},
|
|
||||||
{&Jlu, "https://mirrors.jlu.edu.cn/CTAN/systems/texlive/tlnet"},
|
|
||||||
{&Sustech, "https://mirrors.sustech.edu.cn/CTAN/systems/texlive/tlnet"}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define def_sources_n(t) const size_t t##_sources_n = xy_arylen(t##_sources)
|
#define def_sources_n(t) const size_t t##_sources_n = xy_arylen(t##_sources)
|
||||||
|
|
||||||
|
|
||||||
def_sources_n(pl_clojure);
|
def_sources_n(pl_clojure);
|
||||||
def_sources_n(pl_dotnet);
|
def_sources_n(pl_dotnet);
|
||||||
|
|
||||||
def_sources_n(wr_tex);
|
|
||||||
|
|
||||||
|
65
src/chsrc.c
65
src/chsrc.c
@ -112,70 +112,7 @@ pl_clojure_setsrc (char *option)
|
|||||||
#include "recipe/os/BSD/OpenBSD.c"
|
#include "recipe/os/BSD/OpenBSD.c"
|
||||||
|
|
||||||
|
|
||||||
|
#include "recipe/ware/TeX-Live.c"
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
wr_tex_check_cmd (bool *tlmgr_exist, bool *mpm_exist)
|
|
||||||
{
|
|
||||||
*tlmgr_exist = chsrc_check_program ("tlmgr");
|
|
||||||
*mpm_exist = chsrc_check_program ("mpm");
|
|
||||||
|
|
||||||
if (!*tlmgr_exist && !*mpm_exist)
|
|
||||||
{
|
|
||||||
chsrc_error ("未找到 tlmgr 或 mpm 命令,请检查是否存在(其一)");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
wr_tex_getsrc (char *option)
|
|
||||||
{
|
|
||||||
bool tlmgr_exist, mpm_exist;
|
|
||||||
wr_tex_check_cmd (&tlmgr_exist, &mpm_exist);
|
|
||||||
|
|
||||||
if (tlmgr_exist)
|
|
||||||
{
|
|
||||||
chsrc_run("tlmgr option repository", RunOpt_Default);
|
|
||||||
}
|
|
||||||
if (mpm_exist)
|
|
||||||
{
|
|
||||||
chsrc_run("mpm --get-repository", RunOpt_Default);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 参考 https://help.mirrors.cernet.edu.cn/CTAN/
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
wr_tex_setsrc (char *option)
|
|
||||||
{
|
|
||||||
bool tlmgr_exist, mpm_exist;
|
|
||||||
wr_tex_check_cmd (&tlmgr_exist, &mpm_exist);
|
|
||||||
|
|
||||||
SourceInfo source;
|
|
||||||
chsrc_yield_source (wr_tex);
|
|
||||||
chsrc_confirm_source (&source);
|
|
||||||
|
|
||||||
char *cmd = NULL;
|
|
||||||
|
|
||||||
if (tlmgr_exist)
|
|
||||||
{
|
|
||||||
cmd = xy_2strjoin ("tlmgr option repository ", source.url);
|
|
||||||
chsrc_run (cmd, RunOpt_Default);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mpm_exist)
|
|
||||||
{
|
|
||||||
char *miktex_url = xy_2strjoin (xy_str_delete_suffix (source.url, "texlive/tlnet"), "win32/miktex/tm/packages/");
|
|
||||||
cmd = xy_2strjoin ("mpm --set-repository=", miktex_url);
|
|
||||||
chsrc_run (cmd, RunOpt_Default);
|
|
||||||
}
|
|
||||||
|
|
||||||
chsrc_say_lastly (&source, ChsrcTypeUntested);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#include "recipe/ware/emacs.c"
|
#include "recipe/ware/emacs.c"
|
||||||
#include "recipe/ware/WinGet.c"
|
#include "recipe/ware/WinGet.c"
|
||||||
#include "recipe/ware/Homebrew.c"
|
#include "recipe/ware/Homebrew.c"
|
||||||
|
@ -91,7 +91,6 @@ static const char
|
|||||||
os_freebsd, os_netbsd, os_openbsd,
|
os_freebsd, os_netbsd, os_openbsd,
|
||||||
};
|
};
|
||||||
|
|
||||||
def_target(wr_tex);
|
|
||||||
|
|
||||||
static const char
|
static const char
|
||||||
*wr_winget [] = {"winget", NULL, t(&wr_winget_target)},
|
*wr_winget [] = {"winget", NULL, t(&wr_winget_target)},
|
||||||
|
86
src/recipe/ware/TeX-Live.c
Normal file
86
src/recipe/ware/TeX-Live.c
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
/** ------------------------------------------------------------
|
||||||
|
* 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-10>
|
||||||
|
* Last Modified : <2024-08-15>
|
||||||
|
* ------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @time 2023-09-10 更新
|
||||||
|
*/
|
||||||
|
static SourceInfo
|
||||||
|
wr_tex_sources[] = {
|
||||||
|
{&Upstream, NULL},
|
||||||
|
{&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/ctan/systems/texlive/tlnet"},
|
||||||
|
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/tlnet"},
|
||||||
|
{&Bfsu, "https://mirrors.bfsu.edu.cn/CTAN/systems/texlive/tlnet"},
|
||||||
|
{&Lzuoss, "https://mirror.lzu.edu.cn/CTAN/systems/texlive/tlnet"},
|
||||||
|
{&Jlu, "https://mirrors.jlu.edu.cn/CTAN/systems/texlive/tlnet"},
|
||||||
|
{&Sustech, "https://mirrors.sustech.edu.cn/CTAN/systems/texlive/tlnet"}
|
||||||
|
};
|
||||||
|
def_sources_n(wr_tex);
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
wr_tex_check_cmd (bool *tlmgr_exist, bool *mpm_exist)
|
||||||
|
{
|
||||||
|
*tlmgr_exist = chsrc_check_program ("tlmgr");
|
||||||
|
*mpm_exist = chsrc_check_program ("mpm");
|
||||||
|
|
||||||
|
if (!*tlmgr_exist && !*mpm_exist)
|
||||||
|
{
|
||||||
|
chsrc_error ("未找到 tlmgr 或 mpm 命令,请检查是否存在(其一)");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
wr_tex_getsrc (char *option)
|
||||||
|
{
|
||||||
|
bool tlmgr_exist, mpm_exist;
|
||||||
|
wr_tex_check_cmd (&tlmgr_exist, &mpm_exist);
|
||||||
|
|
||||||
|
if (tlmgr_exist)
|
||||||
|
{
|
||||||
|
chsrc_run("tlmgr option repository", RunOpt_Default);
|
||||||
|
}
|
||||||
|
if (mpm_exist)
|
||||||
|
{
|
||||||
|
chsrc_run("mpm --get-repository", RunOpt_Default);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参考 https://help.mirrors.cernet.edu.cn/CTAN/
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
wr_tex_setsrc (char *option)
|
||||||
|
{
|
||||||
|
bool tlmgr_exist, mpm_exist;
|
||||||
|
wr_tex_check_cmd (&tlmgr_exist, &mpm_exist);
|
||||||
|
|
||||||
|
SourceInfo source;
|
||||||
|
chsrc_yield_source (wr_tex);
|
||||||
|
chsrc_confirm_source (&source);
|
||||||
|
|
||||||
|
char *cmd = NULL;
|
||||||
|
|
||||||
|
if (tlmgr_exist)
|
||||||
|
{
|
||||||
|
cmd = xy_2strjoin ("tlmgr option repository ", source.url);
|
||||||
|
chsrc_run (cmd, RunOpt_Default);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mpm_exist)
|
||||||
|
{
|
||||||
|
char *miktex_url = xy_2strjoin (xy_str_delete_suffix (source.url, "texlive/tlnet"), "win32/miktex/tm/packages/");
|
||||||
|
cmd = xy_2strjoin ("mpm --set-repository=", miktex_url);
|
||||||
|
chsrc_run (cmd, RunOpt_Default);
|
||||||
|
}
|
||||||
|
|
||||||
|
chsrc_say_lastly (&source, ChsrcTypeUntested);
|
||||||
|
}
|
||||||
|
|
||||||
|
def_target(wr_tex);
|
Loading…
x
Reference in New Issue
Block a user