Split texlive out

This commit is contained in:
Aoran Zeng
2024-08-16 04:31:48 +08:00
parent 019b0b060b
commit 9d7a121947
4 changed files with 87 additions and 86 deletions

View File

@@ -112,70 +112,7 @@ pl_clojure_setsrc (char *option)
#include "recipe/os/BSD/OpenBSD.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/TeX-Live.c"
#include "recipe/ware/emacs.c"
#include "recipe/ware/WinGet.c"
#include "recipe/ware/Homebrew.c"