Remove all the cat

This commit is contained in:
Aoran Zeng 2023-09-26 22:49:28 +08:00
parent 418bc31ea7
commit dc101733d6

60
chsrc.c
View File

@ -809,17 +809,17 @@ pl_julia_setsrc (char* option)
source_info source = pl_julia_sources[index]; source_info source = pl_julia_sources[index];
chsrc_say_selection(&source); chsrc_say_selection(&source);
const char* file = xy_strjoin (3, "ENV[\"JULIA_PKG_SERVER\"] = \"", source.url, "\""); const char* towrite = xy_strjoin (3, "ENV[\"JULIA_PKG_SERVER\"] = \"", source.url, "\"");
char* cmd = NULL; if (xy_on_windows) {
if (xy_on_windows) chsrc_run (xy_str_to_quietcmd ("md %USERPROFILE%\\.julia\\config"));
cmd = xy_strjoin(4, xy_str_to_quietcmd("md %USERPROFILE%\\.julia\\config"), chsrc_append_to_file (towrite, "%USERPROFILE%/.julia/config/startup.jl");
"& echo ", file, " >> %USERPROFILE%/.julia/config/startup.jl"); }
else else {
cmd = xy_strjoin(4, xy_str_to_quietcmd("mkdir -p ~/.julia/config"), chsrc_run (xy_str_to_quietcmd ("mkdir -p ~/.julia/config"));
";echo '", file, "' >> ~/.julia/config/startup.jl"); chsrc_append_to_file (towrite, "~/.julia/config/startup.jl");
}
chsrc_run(cmd);
chsrc_say_thanks(&source); chsrc_say_thanks(&source);
} }
@ -1522,46 +1522,44 @@ os_freebsd_setsrc (char* option)
/* https://help.mirrors.cernet.edu.cn/FreeBSD-ports/ 的换源方法 */ /* https://help.mirrors.cernet.edu.cn/FreeBSD-ports/ 的换源方法 */
/* /*
char* ports_cp="cp /etc/make.conf /etc/make.conf.bak"; char* ports_cp="cp /etc/make.conf /etc/make.conf.bak";
chsrc_runcmd(ports_cp); chsrc_run(ports_cp);
char* ports_cmd =xy_strjoin(3, "cat MASTER_SITE_OVERRIDE?=http://", char* ports = xy_strjoin(3, "MASTER_SITE_OVERRIDE?=http://", source.url, "/freebsd-ports/");
source.url, chsrc_append_to_file (ports, "/etc/make.conf");
"/freebsd-ports/ >> /etc/make.conf");
chsrc_runcmd(ports_cmd);
*/ */
/* 不再换 portsnap */ /* 不再换 portsnap */
/* /*
char* portsnap_cp="cp /etc/portsnap.conf /etc/portsnap.conf.bak"; char* portsnap_cp="cp /etc/portsnap.conf /etc/portsnap.conf.bak";
chsrc_runcmd(portsnap_cp); chsrc_runcmd(portsnap_cp);
char* portsnap_cmd =xy_strjoin(3,"s@(.*)SERVERNAME=[\\.|a-z|A-Z]*@\\1SERVERNAME=", char* portsnap =xy_strjoin(3,"s@(.*)SERVERNAME=[\\.|a-z|A-Z]*@\\1SERVERNAME=", source.url,
source.url, "@g < /etc/portsnap.conf.bak");
"@g < /etc/portsnap.conf.bak | cat > /etc/portsnap.conf");
chsrc_runcmd(portsnap_cmd);
chsrc_overwrite_file (portsnap, "/etc/portsnap.conf");
xy_info("chsrc: portsnap sources changed"); chsrc_info("portsnap sources changed");
xy_info("chsrc: 获取portsnap更新使用此命令: 'portsnap fetch extract'"); chsrc_info("获取portsnap更新使用此命令: 'portsnap fetch extract'");
*/ */
// HELP: 暂时似乎没有源提供 // HELP: 暂时没有源提供
/* /*
xy_info("chsrc: 3. 修改 freebsd-update 源"); chsrc_info("3. 修改 freebsd-update 源");
char* update_cp="cp /etc/freebsd-update.conf /etc/freebsd-update.conf.bak";
chsrc_runcmd(update_cp);
char* update_cp="cp /etc/freebsd-update.conf /etc/freebsd-update.conf.bak";
chsrc_runcmd(update_cp);
char* update_cmd =xy_strjoin(3,"s@(.*)SERVERNAME [\\.|a-z|A-Z]*@\\1SERVERNAME ", char* update =xy_strjoin(3,"s@(.*)SERVERNAME [\\.|a-z|A-Z]*@\\1SERVERNAME ",
source.url, source.url,
"@g < /etc/freebsd-update.conf.bak | cat > /etc/freebsd-update.conf"); "@g < /etc/freebsd-update.conf.bak");
chsrc_runcmd(update_cmd);
*/ chsrc_overwrite_file (update, "/etc/freebsd-update.conf");
*/
chsrc_say_thanks(&source); chsrc_say_thanks(&source);
} }