mirror of
https://github.com/RubyMetric/chsrc.git
synced 2025-01-23 00:43:58 +08:00
Confirm the source
This commit is contained in:
parent
2693174f2f
commit
9d76ef1f90
96
src/chsrc.c
96
src/chsrc.c
|
@ -3,7 +3,7 @@
|
||||||
* License : GPLv3
|
* License : GPLv3
|
||||||
* Authors : Aoran Zeng <ccmywish@qq.com>
|
* Authors : Aoran Zeng <ccmywish@qq.com>
|
||||||
* Created on : <2023-08-28>
|
* Created on : <2023-08-28>
|
||||||
* Last modified : <2024-06-07>
|
* Last modified : <2024-06-08>
|
||||||
*
|
*
|
||||||
* chsrc:
|
* chsrc:
|
||||||
*
|
*
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
* 该软件为自由软件,采用 GPLv3 许可证,请查阅 LICENSE.txt 文件
|
* 该软件为自由软件,采用 GPLv3 许可证,请查阅 LICENSE.txt 文件
|
||||||
* ------------------------------------------------------------*/
|
* ------------------------------------------------------------*/
|
||||||
|
|
||||||
#define Chsrc_Version "v0.1.5-2024/06/05"
|
#define Chsrc_Version "v0.1.6-pre-2024/06/08"
|
||||||
|
|
||||||
#include "chsrc.h"
|
#include "chsrc.h"
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ pl_ruby_setsrc (char *option)
|
||||||
index = use_specific_mirror_or_auto_select (option, pl_ruby);
|
index = use_specific_mirror_or_auto_select (option, pl_ruby);
|
||||||
|
|
||||||
SourceInfo source = pl_ruby_sources[index];
|
SourceInfo source = pl_ruby_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
char *cmd = NULL;
|
char *cmd = NULL;
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ pl_python_setsrc (char *option)
|
||||||
index = use_specific_mirror_or_auto_select (option, pl_python);
|
index = use_specific_mirror_or_auto_select (option, pl_python);
|
||||||
|
|
||||||
SourceInfo source = pl_python_sources[index];
|
SourceInfo source = pl_python_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
char *cmd = xy_2strjoin (prog, xy_2strjoin (" -m pip config set global.index-url ", source.url));
|
char *cmd = xy_2strjoin (prog, xy_2strjoin (" -m pip config set global.index-url ", source.url));
|
||||||
chsrc_run (cmd);
|
chsrc_run (cmd);
|
||||||
|
@ -245,7 +245,7 @@ pl_nodejs_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, pl_nodejs);
|
int index = use_specific_mirror_or_auto_select (option, pl_nodejs);
|
||||||
|
|
||||||
SourceInfo source = pl_nodejs_sources[index];
|
SourceInfo source = pl_nodejs_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
char *cmd = NULL;
|
char *cmd = NULL;
|
||||||
|
|
||||||
|
@ -305,7 +305,7 @@ pl_perl_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, pl_perl);
|
int index = use_specific_mirror_or_auto_select (option, pl_perl);
|
||||||
|
|
||||||
SourceInfo source = pl_perl_sources[index];
|
SourceInfo source = pl_perl_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
char *cmd = xy_strjoin (3,
|
char *cmd = xy_strjoin (3,
|
||||||
"perl -MCPAN -e \"CPAN::HandleConfig->load(); CPAN::HandleConfig->edit('urllist', 'unshift', '", source.url, "'); CPAN::HandleConfig->commit()\"");
|
"perl -MCPAN -e \"CPAN::HandleConfig->load(); CPAN::HandleConfig->edit('urllist', 'unshift', '", source.url, "'); CPAN::HandleConfig->commit()\"");
|
||||||
|
@ -352,7 +352,7 @@ pl_php_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, pl_php);
|
int index = use_specific_mirror_or_auto_select (option, pl_php);
|
||||||
|
|
||||||
SourceInfo source = pl_php_sources[index];
|
SourceInfo source = pl_php_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
char* cmd = xy_2strjoin ("composer config -g repo.packagist composer ", source.url);
|
char* cmd = xy_2strjoin ("composer config -g repo.packagist composer ", source.url);
|
||||||
chsrc_run (cmd);
|
chsrc_run (cmd);
|
||||||
|
@ -377,7 +377,7 @@ pl_lua_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, pl_lua);
|
int index = use_specific_mirror_or_auto_select (option, pl_lua);
|
||||||
|
|
||||||
SourceInfo source = pl_lua_sources[index];
|
SourceInfo source = pl_lua_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
char *config = xy_strjoin (3, "rocks_servers = {\n"
|
char *config = xy_strjoin (3, "rocks_servers = {\n"
|
||||||
" \"", source.url, "\"\n"
|
" \"", source.url, "\"\n"
|
||||||
|
@ -428,7 +428,7 @@ pl_go_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, pl_go);
|
int index = use_specific_mirror_or_auto_select (option, pl_go);
|
||||||
|
|
||||||
SourceInfo source = pl_go_sources[index];
|
SourceInfo source = pl_go_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
char *cmd = "go env -w GO111MODULE=on";
|
char *cmd = "go env -w GO111MODULE=on";
|
||||||
chsrc_run (cmd);
|
chsrc_run (cmd);
|
||||||
|
@ -455,7 +455,7 @@ pl_rust_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, pl_rust);
|
int index = use_specific_mirror_or_auto_select (option, pl_rust);
|
||||||
|
|
||||||
SourceInfo source = pl_rust_sources[index];
|
SourceInfo source = pl_rust_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
const char* file = xy_strjoin (3,
|
const char* file = xy_strjoin (3,
|
||||||
"[source.crates-io]\n"
|
"[source.crates-io]\n"
|
||||||
|
@ -539,7 +539,7 @@ pl_java_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, pl_java);
|
int index = use_specific_mirror_or_auto_select (option, pl_java);
|
||||||
|
|
||||||
SourceInfo source = pl_java_sources[index];
|
SourceInfo source = pl_java_sources[index];
|
||||||
chsrc_say_selection(&source);
|
chsrc_confirm_selection(&source);
|
||||||
|
|
||||||
if (maven_exist)
|
if (maven_exist)
|
||||||
{
|
{
|
||||||
|
@ -583,7 +583,7 @@ pl_clojure_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, pl_clojure);
|
int index = use_specific_mirror_or_auto_select (option, pl_clojure);
|
||||||
|
|
||||||
SourceInfo source = pl_clojure_sources[index];
|
SourceInfo source = pl_clojure_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
chsrc_warn ("抱歉,Clojure换源较复杂,您可手动查阅并换源:");
|
chsrc_warn ("抱歉,Clojure换源较复杂,您可手动查阅并换源:");
|
||||||
puts (source.url);
|
puts (source.url);
|
||||||
|
@ -617,7 +617,7 @@ pl_dart_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, pl_dart);
|
int index = use_specific_mirror_or_auto_select (option, pl_dart);
|
||||||
|
|
||||||
SourceInfo source = pl_dart_sources[index];
|
SourceInfo source = pl_dart_sources[index];
|
||||||
chsrc_say_selection(&source);
|
chsrc_confirm_selection(&source);
|
||||||
|
|
||||||
char *towrite = NULL;
|
char *towrite = NULL;
|
||||||
|
|
||||||
|
@ -663,7 +663,7 @@ pl_haskell_setsrc(char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, pl_haskell);
|
int index = use_specific_mirror_or_auto_select (option, pl_haskell);
|
||||||
|
|
||||||
SourceInfo source = pl_haskell_sources[index];
|
SourceInfo source = pl_haskell_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
char* file = xy_strjoin (3, "repository mirror\n"
|
char* file = xy_strjoin (3, "repository mirror\n"
|
||||||
" url: ", source.url,
|
" url: ", source.url,
|
||||||
|
@ -733,7 +733,7 @@ pl_ocaml_setsrc(char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, pl_ocaml);
|
int index = use_specific_mirror_or_auto_select (option, pl_ocaml);
|
||||||
|
|
||||||
SourceInfo source = pl_ocaml_sources[index];
|
SourceInfo source = pl_ocaml_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
char *cmd = xy_strjoin (3, "opam repo set-url default ",
|
char *cmd = xy_strjoin (3, "opam repo set-url default ",
|
||||||
source.url,
|
source.url,
|
||||||
|
@ -776,7 +776,7 @@ pl_r_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, pl_r);
|
int index = use_specific_mirror_or_auto_select (option, pl_r);
|
||||||
|
|
||||||
SourceInfo source = pl_r_sources[index];
|
SourceInfo source = pl_r_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
char *bioconductor_url = xy_str_delete_suffix (xy_str_delete_suffix (source.url, "cran/"), "CRAN/");
|
char *bioconductor_url = xy_str_delete_suffix (xy_str_delete_suffix (source.url, "cran/"), "CRAN/");
|
||||||
bioconductor_url = xy_2strjoin(bioconductor_url, "bioconductor");
|
bioconductor_url = xy_2strjoin(bioconductor_url, "bioconductor");
|
||||||
|
@ -824,7 +824,7 @@ pl_julia_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, pl_julia);
|
int index = use_specific_mirror_or_auto_select (option, pl_julia);
|
||||||
|
|
||||||
SourceInfo source = pl_julia_sources[index];
|
SourceInfo source = pl_julia_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
const char *towrite = xy_strjoin (3, "ENV[\"JULIA_PKG_SERVER\"] = \"", source.url, "\"");
|
const char *towrite = xy_strjoin (3, "ENV[\"JULIA_PKG_SERVER\"] = \"", source.url, "\"");
|
||||||
|
|
||||||
|
@ -858,7 +858,7 @@ os_ubuntu_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, os_ubuntu);
|
int index = use_specific_mirror_or_auto_select (option, os_ubuntu);
|
||||||
|
|
||||||
SourceInfo source = os_ubuntu_sources[index];
|
SourceInfo source = os_ubuntu_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
chsrc_backup (ETC_APT_SOURCELIST);
|
chsrc_backup (ETC_APT_SOURCELIST);
|
||||||
|
|
||||||
|
@ -898,7 +898,7 @@ os_mint_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, os_mint);
|
int index = use_specific_mirror_or_auto_select (option, os_mint);
|
||||||
|
|
||||||
SourceInfo source = os_mint_sources[index];
|
SourceInfo source = os_mint_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
chsrc_backup ("/etc/apt/sources.list.d/official-package-repositories.list");
|
chsrc_backup ("/etc/apt/sources.list.d/official-package-repositories.list");
|
||||||
|
|
||||||
|
@ -931,7 +931,7 @@ os_debian_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, os_debian);
|
int index = use_specific_mirror_or_auto_select (option, os_debian);
|
||||||
|
|
||||||
SourceInfo source = os_debian_sources[index];
|
SourceInfo source = os_debian_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
chsrc_info ("如果遇到无法拉取 HTTPS 源的情况,我们会使用 HTTP 源并需要您运行:");
|
chsrc_info ("如果遇到无法拉取 HTTPS 源的情况,我们会使用 HTTP 源并需要您运行:");
|
||||||
puts ("apt install apt-transport-https ca-certificates");
|
puts ("apt install apt-transport-https ca-certificates");
|
||||||
|
@ -964,7 +964,7 @@ os_raspberrypi_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, os_raspberrypi);
|
int index = use_specific_mirror_or_auto_select (option, os_raspberrypi);
|
||||||
|
|
||||||
SourceInfo source = os_raspberrypi_sources[index];
|
SourceInfo source = os_raspberrypi_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
chsrc_backup ("/etc/apt/sources.list.d/raspi.list");
|
chsrc_backup ("/etc/apt/sources.list.d/raspi.list");
|
||||||
|
|
||||||
|
@ -995,7 +995,7 @@ os_deepin_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, os_deepin);
|
int index = use_specific_mirror_or_auto_select (option, os_deepin);
|
||||||
|
|
||||||
SourceInfo source = os_deepin_sources[index];
|
SourceInfo source = os_deepin_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
chsrc_backup (ETC_APT_SOURCELIST);
|
chsrc_backup (ETC_APT_SOURCELIST);
|
||||||
|
|
||||||
|
@ -1022,7 +1022,7 @@ os_fedora_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, os_fedora);
|
int index = use_specific_mirror_or_auto_select (option, os_fedora);
|
||||||
|
|
||||||
SourceInfo source = os_fedora_sources[index];
|
SourceInfo source = os_fedora_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
chsrc_warn ("fedora 29 及以下版本暂不支持");
|
chsrc_warn ("fedora 29 及以下版本暂不支持");
|
||||||
|
|
||||||
|
@ -1063,7 +1063,7 @@ os_opensuse_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, os_opensuse);
|
int index = use_specific_mirror_or_auto_select (option, os_opensuse);
|
||||||
|
|
||||||
SourceInfo source = os_opensuse_sources[index];
|
SourceInfo source = os_opensuse_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
char *source_nselect = "zypper mr -da";
|
char *source_nselect = "zypper mr -da";
|
||||||
chsrc_run (source_nselect);
|
chsrc_run (source_nselect);
|
||||||
|
@ -1126,7 +1126,7 @@ os_kali_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, os_kali);
|
int index = use_specific_mirror_or_auto_select (option, os_kali);
|
||||||
|
|
||||||
SourceInfo source = os_kali_sources[index];
|
SourceInfo source = os_kali_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
chsrc_backup (ETC_APT_SOURCELIST);
|
chsrc_backup (ETC_APT_SOURCELIST);
|
||||||
|
|
||||||
|
@ -1151,7 +1151,7 @@ os_msys2_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, os_msys2);
|
int index = use_specific_mirror_or_auto_select (option, os_msys2);
|
||||||
|
|
||||||
SourceInfo source = os_msys2_sources[index];
|
SourceInfo source = os_msys2_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
chsrc_backup ("/etc/pacman.d/mirrorlist.mingw32");
|
chsrc_backup ("/etc/pacman.d/mirrorlist.mingw32");
|
||||||
chsrc_backup ("/etc/pacman.d/mirrorlist.mingw64");
|
chsrc_backup ("/etc/pacman.d/mirrorlist.mingw64");
|
||||||
|
@ -1183,7 +1183,7 @@ os_arch_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, os_arch);
|
int index = use_specific_mirror_or_auto_select (option, os_arch);
|
||||||
|
|
||||||
SourceInfo source = os_arch_sources[index];
|
SourceInfo source = os_arch_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
chsrc_backup ("/etc/pacman.d/mirrorlist");
|
chsrc_backup ("/etc/pacman.d/mirrorlist");
|
||||||
|
|
||||||
|
@ -1236,7 +1236,7 @@ os_gentoo_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, os_gentoo);
|
int index = use_specific_mirror_or_auto_select (option, os_gentoo);
|
||||||
|
|
||||||
SourceInfo source = os_arch_sources[index];
|
SourceInfo source = os_arch_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
chsrc_backup ("/etc/portage/repos.conf/gentoo.conf");
|
chsrc_backup ("/etc/portage/repos.conf/gentoo.conf");
|
||||||
|
|
||||||
|
@ -1264,7 +1264,7 @@ os_rocky_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, os_rocky);
|
int index = use_specific_mirror_or_auto_select (option, os_rocky);
|
||||||
|
|
||||||
SourceInfo source = os_rocky_sources[index];
|
SourceInfo source = os_rocky_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
char *cmd = xy_strjoin (3,
|
char *cmd = xy_strjoin (3,
|
||||||
"sed -e 's|^mirrorlist=|#mirrorlist=|g' "
|
"sed -e 's|^mirrorlist=|#mirrorlist=|g' "
|
||||||
|
@ -1295,7 +1295,7 @@ os_alpine_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, os_alpine);
|
int index = use_specific_mirror_or_auto_select (option, os_alpine);
|
||||||
|
|
||||||
SourceInfo source = os_alpine_sources[index];
|
SourceInfo source = os_alpine_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
char* cmd = xy_strjoin (3,
|
char* cmd = xy_strjoin (3,
|
||||||
"sed -i 's#https\\?://dl-cdn.alpinelinux.org/alpine#", source.url, "#g' /etc/apk/repositories"
|
"sed -i 's#https\\?://dl-cdn.alpinelinux.org/alpine#", source.url, "#g' /etc/apk/repositories"
|
||||||
|
@ -1326,7 +1326,7 @@ os_void_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, os_void);
|
int index = use_specific_mirror_or_auto_select (option, os_void);
|
||||||
|
|
||||||
SourceInfo source = os_void_sources[index];
|
SourceInfo source = os_void_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
chsrc_ensure_dir ("/etc/xbps.d");
|
chsrc_ensure_dir ("/etc/xbps.d");
|
||||||
char *cmd = "cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/";
|
char *cmd = "cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/";
|
||||||
|
@ -1359,7 +1359,7 @@ os_solus_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, os_solus);
|
int index = use_specific_mirror_or_auto_select (option, os_solus);
|
||||||
|
|
||||||
SourceInfo source = os_solus_sources[index];
|
SourceInfo source = os_solus_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
char *cmd = xy_2strjoin ("eopkg add-repo Solus ", source.url);
|
char *cmd = xy_2strjoin ("eopkg add-repo Solus ", source.url);
|
||||||
chsrc_run (cmd);
|
chsrc_run (cmd);
|
||||||
|
@ -1400,7 +1400,7 @@ os_trisquel_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, os_trisquel);
|
int index = use_specific_mirror_or_auto_select (option, os_trisquel);
|
||||||
|
|
||||||
SourceInfo source = os_trisquel_sources[index];
|
SourceInfo source = os_trisquel_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
chsrc_backup (ETC_APT_SOURCELIST);
|
chsrc_backup (ETC_APT_SOURCELIST);
|
||||||
|
|
||||||
|
@ -1430,7 +1430,7 @@ os_linuxlite_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, os_linuxlite);
|
int index = use_specific_mirror_or_auto_select (option, os_linuxlite);
|
||||||
|
|
||||||
SourceInfo source = os_linuxlite_sources[index];
|
SourceInfo source = os_linuxlite_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
chsrc_backup (ETC_APT_SOURCELIST);
|
chsrc_backup (ETC_APT_SOURCELIST);
|
||||||
|
|
||||||
|
@ -1453,7 +1453,7 @@ os_openeuler_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, os_openeuler);
|
int index = use_specific_mirror_or_auto_select (option, os_openeuler);
|
||||||
|
|
||||||
SourceInfo source = os_openeuler_sources[index];
|
SourceInfo source = os_openeuler_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
chsrc_backup ("/etc/yum.repos.d/openEuler.repo");
|
chsrc_backup ("/etc/yum.repos.d/openEuler.repo");
|
||||||
|
|
||||||
|
@ -1483,7 +1483,7 @@ os_openkylin_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, os_openkylin);
|
int index = use_specific_mirror_or_auto_select (option, os_openkylin);
|
||||||
|
|
||||||
SourceInfo source = os_openkylin_sources[index];
|
SourceInfo source = os_openkylin_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
chsrc_backup (ETC_APT_SOURCELIST);
|
chsrc_backup (ETC_APT_SOURCELIST);
|
||||||
|
|
||||||
|
@ -1512,7 +1512,7 @@ os_freebsd_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, os_freebsd);
|
int index = use_specific_mirror_or_auto_select (option, os_freebsd);
|
||||||
|
|
||||||
SourceInfo source = os_freebsd_sources[index];
|
SourceInfo source = os_freebsd_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
chsrc_info ("1. 添加 freebsd-pkg 源 (二进制安装包)");
|
chsrc_info ("1. 添加 freebsd-pkg 源 (二进制安装包)");
|
||||||
chsrc_ensure_dir ("/usr/local/etc/pkg/repos");
|
chsrc_ensure_dir ("/usr/local/etc/pkg/repos");
|
||||||
|
@ -1627,7 +1627,7 @@ os_netbsd_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, os_netbsd);
|
int index = use_specific_mirror_or_auto_select (option, os_netbsd);
|
||||||
|
|
||||||
SourceInfo source = os_netbsd_sources[index];
|
SourceInfo source = os_netbsd_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
chsrc_backup ("/usr/pkg/etc/pkgin/repositories.conf");
|
chsrc_backup ("/usr/pkg/etc/pkgin/repositories.conf");
|
||||||
|
|
||||||
|
@ -1662,7 +1662,7 @@ os_openbsd_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, os_openbsd);
|
int index = use_specific_mirror_or_auto_select (option, os_openbsd);
|
||||||
|
|
||||||
SourceInfo source = os_openbsd_sources[index];
|
SourceInfo source = os_openbsd_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
chsrc_backup ("/etc/installurl");
|
chsrc_backup ("/etc/installurl");
|
||||||
chsrc_overwrite_file (source.url, "/etc/installurl");
|
chsrc_overwrite_file (source.url, "/etc/installurl");
|
||||||
|
@ -1682,7 +1682,7 @@ os_ros_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, os_ros);
|
int index = use_specific_mirror_or_auto_select (option, os_ros);
|
||||||
|
|
||||||
SourceInfo source = os_ros_sources[index];
|
SourceInfo source = os_ros_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
chsrc_backup ("/etc/apt/sources.list.d/ros-latest.list");
|
chsrc_backup ("/etc/apt/sources.list.d/ros-latest.list");
|
||||||
|
|
||||||
|
@ -1746,7 +1746,7 @@ wr_tex_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, wr_tex);
|
int index = use_specific_mirror_or_auto_select (option, wr_tex);
|
||||||
|
|
||||||
SourceInfo source = wr_tex_sources[index];
|
SourceInfo source = wr_tex_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
char *cmd = NULL;
|
char *cmd = NULL;
|
||||||
|
|
||||||
|
@ -1775,7 +1775,7 @@ wr_emacs_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, wr_emacs);
|
int index = use_specific_mirror_or_auto_select (option, wr_emacs);
|
||||||
|
|
||||||
SourceInfo source = wr_emacs_sources[index];
|
SourceInfo source = wr_emacs_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
chsrc_warn ("抱歉,Emacs换源涉及Elisp,您可手动查阅并换源:");
|
chsrc_warn ("抱歉,Emacs换源涉及Elisp,您可手动查阅并换源:");
|
||||||
puts (source.url);
|
puts (source.url);
|
||||||
|
@ -1797,7 +1797,7 @@ wr_winget_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, wr_winget);
|
int index = use_specific_mirror_or_auto_select (option, wr_winget);
|
||||||
|
|
||||||
SourceInfo source = wr_winget_sources[index];
|
SourceInfo source = wr_winget_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
chsrc_run ("winget source remove winget");
|
chsrc_run ("winget source remove winget");
|
||||||
chsrc_run (xy_2strjoin ("winget source add winget ", source.url));
|
chsrc_run (xy_2strjoin ("winget source add winget ", source.url));
|
||||||
|
@ -1835,7 +1835,7 @@ wr_brew_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, wr_brew);
|
int index = use_specific_mirror_or_auto_select (option, wr_brew);
|
||||||
|
|
||||||
SourceInfo source = wr_brew_sources[index];
|
SourceInfo source = wr_brew_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
char *api_domain = xy_strjoin (3, "export HOMEBREW_API_DOMAIN=\"", xy_2strjoin (source.url, "homebrew-bottles/api"), "\"");
|
char *api_domain = xy_strjoin (3, "export HOMEBREW_API_DOMAIN=\"", xy_2strjoin (source.url, "homebrew-bottles/api"), "\"");
|
||||||
char *bottle_domain = xy_strjoin (3, "export HOMEBREW_BOTTLE_DOMAIN=\"", xy_2strjoin (source.url, "homebrew-bottles"), "\"");
|
char *bottle_domain = xy_strjoin (3, "export HOMEBREW_BOTTLE_DOMAIN=\"", xy_2strjoin (source.url, "homebrew-bottles"), "\"");
|
||||||
|
@ -1862,7 +1862,7 @@ wr_guix_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, wr_guix);
|
int index = use_specific_mirror_or_auto_select (option, wr_guix);
|
||||||
|
|
||||||
SourceInfo source = wr_guix_sources[index];
|
SourceInfo source = wr_guix_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
char *file = xy_strjoin (3, "(list (channel\n"
|
char *file = xy_strjoin (3, "(list (channel\n"
|
||||||
" (inherit (car %default-channels))\n"
|
" (inherit (car %default-channels))\n"
|
||||||
|
@ -1901,7 +1901,7 @@ wr_nix_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, wr_nix);
|
int index = use_specific_mirror_or_auto_select (option, wr_nix);
|
||||||
|
|
||||||
SourceInfo source = wr_nix_sources[index];
|
SourceInfo source = wr_nix_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
char *cmd = xy_strjoin (3, "nix-channel --add ", source.url, "nixpkgs-unstable nixpkgs");
|
char *cmd = xy_strjoin (3, "nix-channel --add ", source.url, "nixpkgs-unstable nixpkgs");
|
||||||
chsrc_run (cmd);
|
chsrc_run (cmd);
|
||||||
|
@ -1933,7 +1933,7 @@ wr_flathub_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, wr_flathub);
|
int index = use_specific_mirror_or_auto_select (option, wr_flathub);
|
||||||
|
|
||||||
SourceInfo source = wr_flathub_sources[index];
|
SourceInfo source = wr_flathub_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
chsrc_warn ("若出现问题,可先调用以下命令:");
|
chsrc_warn ("若出现问题,可先调用以下命令:");
|
||||||
char *note = xy_strjoin (3,
|
char *note = xy_strjoin (3,
|
||||||
|
@ -1956,7 +1956,7 @@ wr_anaconda_setsrc (char *option)
|
||||||
int index = use_specific_mirror_or_auto_select (option, wr_anaconda);
|
int index = use_specific_mirror_or_auto_select (option, wr_anaconda);
|
||||||
|
|
||||||
SourceInfo source = wr_anaconda_sources[index];
|
SourceInfo source = wr_anaconda_sources[index];
|
||||||
chsrc_say_selection (&source);
|
chsrc_confirm_selection (&source);
|
||||||
|
|
||||||
char *main = xy_2strjoin (source.url, "pkgs/main");
|
char *main = xy_2strjoin (source.url, "pkgs/main");
|
||||||
char *r = xy_2strjoin (source.url, "pkgs/r");
|
char *r = xy_2strjoin (source.url, "pkgs/r");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user