add new getcmd

This commit is contained in:
Heng Guo
2023-09-05 20:48:38 +08:00
committed by Aoran Zeng
parent 46ee35a40f
commit 898c7cf24c
2 changed files with 61 additions and 5 deletions

42
chsrc.c
View File

@ -1162,6 +1162,48 @@ os_gentoo_setsrc(char* option)
}
/**
* 未经测试
*/
void
os_netbsd_setsrc(char* option)
{
int index = 0;
if (NULL!=option) {
index = lets_find_mirror(os_netbsd, option);
} else {
index = lets_test_speed(os_netbsd);
}
source_info source = os_netbsd_sources[index];
chsrc_say_selection(&source);
char* backup = "cp -rf /usr/pkg/etc/pkgin/repositories.conf /usr/pkg/etc/pkgin/repositories.conf.bak";
chsrc_logcmd(backup);
system(backup);
xy_info ("chsrc: 备份文件名: /usr/pkg/etc/pkgin/repositories.conf.bak");
char* cmd = xy_strjoin(6,"echo ",
source.url,
arch,
"/",
version,
"/All > /usr/pkg/etc/pkgin/repositories.conf");
chsrc_logcmd(cmd);
system(cmd);
// char* rm = "rm -rf /etc/portage/repos.conf/gentoo.conf.bak";
// system(rm);
chsrc_say_thanks(&source);
}
/************************************** Begin Target Matrix ****************************************/
def_target_info(pl_ruby);
def_target_info(pl_python);