Giter Site home page Giter Site logo

rubymetric / chsrc Goto Github PK

View Code? Open in Web Editor NEW
1.3K 10.0 53.0 580 KB

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

Makefile 0.62% C 97.12% PowerShell 0.65% Perl 1.61%
c99 gem linux pip ubuntu windows macos debian archlinux fedora

chsrc's People

Contributors

ccmywish avatar chenrui333 avatar gchuchu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

chsrc's Issues

功能需求: 从配置文件中读取源信息而不是写死到.h文件里

写在代码里的源要想更新只能从头更新二进制程序, 如果源已经更新而程序用了旧的, 可能会让用户非常困惑.

配置文件可以放到 github 或者 gitee 的 release 里, 没有什么代价. 也最好支持在命令行指定源配置文件, 这样有一些自定义源需求也可以不需要改代码来实现.

谢谢这个仓库

添加 set `all [optional]<os|lang|ware>` 命令

这条命令能够极大的方便大量环境的初始化配置,而不用一个一个打

使用场景:

  • pacstrap 一整个环境后运行
  • 非持久化临时移动开发环境快速配置
  • etc...

fork数不足

只有两个原因

  1. 用c写的,多数人不玩c。
  2. 作者自己写的太完善了,啥都包括了,谁蛋疼的去fork。
  3. lol。这不是issue。

EndeavourOS 换源缺少 `arch` 命令

$ 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

如果换源方法有问题,或者还未支持该软件换源,我该如何贡献?

多提 issue

每个组织、个人的技术栈都很不同,所以chsrc很难涵盖所有能换源的东西。

但是尽可能换所有源,这是chsrc想要达到的目标,所以如果有任何换源需求,请你大胆提出。

  1. issues on Gitee
  2. issues on GitHub

多测试,多反馈

基于上述目标,我们的开发环境很难完全测试。所以当你发现有问题的时候,请直接提issue,并附上输出信息。


不需要C语言也可贡献

chsrc为了达到全平台的支持,使用了C语言。这一点提高了贡献者的门槛。但是这并非说你无法贡献。如果发现chsrc现有实现的换源方法有问题,或还未实现该换源:

  1. 而你非常清楚该如何换源时(甚至你已经自己编写、或找到其他人写的换源脚本):

    你可以直接告知我们具体的命令,或用shell脚本的方式告诉我们如何换源,我们将转换为等效的C语言进入程序。可以使用 sed, awk 等外部命令,但是请确保平台上一定存在。

  2. 当你自己也不清楚该如何换源时:

    请尽量寻找好他人撰写的换源的细致教程,当我们实现后,请第一时间测试并反馈。

ubuntu换源sed命令无效

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

`conda` 换源过程中提示信息有些含糊不清

如下方日志,有点不太能理解,是需要用户手动操作吗?

测速 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 清除索引缓存,保证用的是镜像站提供的索引
--------------------------------
换源完成,感谢镜像提供方: 北京外国语大学开源软件镜像站

`docker`镜像中`sudo`不存在 + 配置文件可能不存在

使用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
--------------------------------
换源完成,感谢镜像提供方: 北京外国语大学开源软件镜像站

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.