mirror of
https://github.com/RubyMetric/chsrc
synced 2025-12-25 11:59:54 +08:00
Split texlive out
This commit is contained in:
65
src/chsrc.c
65
src/chsrc.c
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user