rubymetric / chsrc Goto Github PK
View Code? Open in Web Editor NEWchsrc 全平台通用换源工具. Change Source for every software on every platform from the command line.
Home Page: https://gitee.com/RubyMetric/chsrc
License: GNU General Public License v3.0
chsrc 全平台通用换源工具. Change Source for every software on every platform from the command line.
Home Page: https://gitee.com/RubyMetric/chsrc
License: GNU General Public License v3.0
写在代码里的源要想更新只能从头更新二进制程序, 如果源已经更新而程序用了旧的, 可能会让用户非常困惑.
配置文件可以放到 github 或者 gitee 的 release 里, 没有什么代价. 也最好支持在命令行指定源配置文件, 这样有一些自定义源需求也可以不需要改代码来实现.
谢谢这个仓库
👋 looks like 0.1.5 tag is not the latest, consider mark it as latest and remove the latest tag (which is kind of outdated)
relates to Homebrew/homebrew-core#173951
这条命令能够极大的方便大量环境的初始化配置,而不用一个一个打
使用场景:
只有两个原因
对于更新问题,我们最好的解决办法是让 chsrc
被添加到这些包管理系统中:
scoop
brew
AUR
之前使用这个方法换源,不过他的没有测速。
https://linuxmirrors.cn/mirrors/
$ sudo ./chsrc set arch
测速 https://developer.aliyun.com/mirror/ ... 926.60 KByte/s
测速 https://mirrors.bfsu.edu.cn/ ... 23.13 MByte/s
测速 https://mirrors.ustc.edu.cn/ ... 27.13 MByte/s
测速 https://mirrors.tuna.tsinghua.edu.cn/ ... 10.91 MByte/s
测速 https://mirrors.tencent.com/ ... 14.32 MByte/s
测速 https://mirrors.huaweicloud.com/ ... 10.45 MByte/s
测速 https://mirrors.163.com/ ... 6.00 MByte/s
测速 https://mirrors.sohu.com/ ... 6.36 KByte/s
最快镜像站: **科学技术大学开源镜像站
选中镜像站: USTC (ustc)
运行 cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak --backup='t'
chsrc: 备份文件名 /etc/pacman.d/mirrorlist.bak
sh: line 1: arch: command not found
[1] 6801 segmentation fault sudo ./chsrc set arch
是否考虑支持更换docker源?
每个组织、个人的技术栈都很不同,所以chsrc
很难涵盖所有能换源的东西。
但是尽可能换所有源,这是chsrc
想要达到的目标,所以如果有任何换源需求,请你大胆提出。
基于上述目标,我们的开发环境很难完全测试。所以当你发现有问题的时候,请直接提issue,并附上输出信息。
chsrc
为了达到全平台的支持,使用了C语言。这一点提高了贡献者的门槛。但是这并非说你无法贡献。如果发现chsrc
现有实现的换源方法有问题,或还未实现该换源:
而你非常清楚该如何换源时(甚至你已经自己编写、或找到其他人写的换源脚本):
你可以直接告知我们具体的命令,或用shell脚本的方式告诉我们如何换源,我们将转换为等效的C语言进入程序。可以使用 sed
, awk
等外部命令,但是请确保平台上一定存在。
当你自己也不清楚该如何换源时:
请尽量寻找好他人撰写的换源的细致教程,当我们实现后,请第一时间测试并反馈。
为了更好的帮助和服务 FreeBSD 中文社区,我们将在这里持续讨论 FreeBSD 的换源实现情况
上述地址可能随代码的更新而代码行变动,我尽量更新
source里面本来的语句:
deb http://cn.archive.ubuntu.com/ubuntu jammy-updates main restricted
替换正则:
sed -E 's@(^[^#]* .*)http[:|\.|\/|a-z|A-Z]*\/ubuntu\/@\1https://mirrors.bfsu.edu.cn/ubuntu/@'< /etc/apt/sources.list.bak | cat > /etc/apt/sources.list
不知道你们这个正则为啥这么复杂。我是手动跑下面的语句修改的:
sed -i 's/https?:\/\/.*\/ubuntu/https:\/\/mirrors.bfsu.edu.cn\/ubuntu/g' /etc/apt/sources.list
如下方日志,有点不太能理解,是需要用户手动操作吗?
测速 https://mirrors.tuna.tsinghua.edu.cn/ ... 10.51 MByte/s
测速 https://mirrors.bfsu.edu.cn/ ... 10.54 MByte/s
测速 https://mirrors.zju.edu.cn/ ... 3.28 MByte/s
测速 https://mirrors.sjtug.sjtu.edu.cn/ ... 10.30 MByte/s
最快镜像站: 北京外国语大学开源软件镜像站
选中镜像站: BFSU (bfsu)
√ 命令 conda 存在
~~~~~~~~~~~
运行 conda config --set show_channel_urls yes
chsrc: 请向 C:\Users\1900/.condarc 中手动添加:
channels:
- defaults
show_channel_urls: true
default_channels:
- https://mirrors.bfsu.edu.cn/anaconda/pkgs/main
- https://mirrors.bfsu.edu.cn/anaconda/pkgs/r
- https://mirrors.bfsu.edu.cn/anaconda/pkgs/msys2
custom_channels:
conda-forge: https://mirrors.bfsu.edu.cn/anaconda/cloud
msys2: https://mirrors.bfsu.edu.cn/anaconda/cloud
bioconda: https://mirrors.bfsu.edu.cn/anaconda/cloud
menpo: https://mirrors.bfsu.edu.cn/anaconda/cloud
pytorch: https://mirrors.bfsu.edu.cn/anaconda/cloud
pytorch-lts: https://mirrors.bfsu.edu.cn/anaconda/cloud
simpleitk: https://mirrors.bfsu.edu.cn/anaconda/cloud
deepmodeling: https://mirrors.bfsu.edu.cn/anaconda/cloud
chsrc: 然后运行 conda clean -i 清除索引缓存,保证用的是镜像站提供的索引
--------------------------------
换源完成,感谢镜像提供方: 北京外国语大学开源软件镜像站
改成这种形式的提示会不会好点
测速 https://mirrors.tuna.tsinghua.edu.cn/ ... 10.51 MByte/s
测速 https://mirrors.bfsu.edu.cn/ ... 10.54 MByte/s
测速 https://mirrors.zju.edu.cn/ ... 3.28 MByte/s
测速 https://mirrors.sjtug.sjtu.edu.cn/ ... 10.30 MByte/s
最快镜像站: 北京外国语大学开源软件镜像站
选中镜像站: BFSU (bfsu)
√ 命令 conda 存在
!conda无法自动更新配置文件,请根据下方提示手动操作
~~~~~~~~~~~
1. 运行 conda config --set show_channel_urls yes
2. 请用编辑器打开 C:\Users\1900/.condarc 手动添加以下内容:
channels:
- defaults
show_channel_urls: true
default_channels:
- https://mirrors.bfsu.edu.cn/anaconda/pkgs/main
- https://mirrors.bfsu.edu.cn/anaconda/pkgs/r
- https://mirrors.bfsu.edu.cn/anaconda/pkgs/msys2
custom_channels:
conda-forge: https://mirrors.bfsu.edu.cn/anaconda/cloud
msys2: https://mirrors.bfsu.edu.cn/anaconda/cloud
bioconda: https://mirrors.bfsu.edu.cn/anaconda/cloud
menpo: https://mirrors.bfsu.edu.cn/anaconda/cloud
pytorch: https://mirrors.bfsu.edu.cn/anaconda/cloud
pytorch-lts: https://mirrors.bfsu.edu.cn/anaconda/cloud
simpleitk: https://mirrors.bfsu.edu.cn/anaconda/cloud
deepmodeling: https://mirrors.bfsu.edu.cn/anaconda/cloud
3. chsrc: 然后运行 conda clean -i 清除索引缓存,保证用的是镜像站提供的索引
--------------------------------
换源完成,感谢镜像提供方: 北京外国语大学开源软件镜像站
因为这个软件本身就是为了换源,服务国内网络,所以我们也主要在Gitee上协作开发。
大多数issue都已经在Gitee上存放着了,您可先检索 https://gitee.com/RubyMetric/chsrc/issues
但若您没有Gitee账号,或因别的原因,想要在GitHub上发issue,我们也完全接受 😉
使用docker构建镜像时,debian 镜像中,默认没有 sources.list 文件,会导致换源失败,打印如下
./chsrc set debian first
使用维护团队测速第一的源
选中镜像站: BFSU (bfsu)
chsrc: 如果遇到无法拉取 HTTPS 源的情况,我们会使用 HTTP 源并需要您运行:
sudo apt install apt-transport-https ca-certificates
~~~~~~~~~~~
运行 cp /etc/apt/sources.list /etc/apt/sources.list.bak --backup='t'
cp: cannot stat '/etc/apt/sources.list': No such file or directory
chsrc: 备份文件名 /etc/apt/sources.list.bak
~~~~~~~~~~~
运行 sed -E -i 's@https?://.*/debian/?@https://mirrors.bfsu.edu.cn/debian@g' /etc/apt/sources.list
sed: can't read /etc/apt/sources.list: No such file or directory
~~~~~~~~~~~
运行 sudo apt update
sh: 1: sudo: not found
--------------------------------
换源完成,感谢镜像提供方: 北京外国语大学开源软件镜像站
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.