DragonOS/tools/change_rust_src.sh
LoGin e80796eb82
feat: la64 boot (#1132)
* la64能够进入到kernel_main
* ci: 添加为ubuntu编译qemu-loongarch64的脚本
* feat: la64能输出hello world
* la64 安装gcc && 配置github ci
* chore: 更新CI工作流和构建脚本中的Docker镜像版本至v1.10

Signed-off-by: longjin <longjin@DragonOS.org>
2025-04-20 18:51:45 +08:00

53 lines
1.7 KiB
Bash
Executable File

echo "正在为rust换源"
sparse="false"
CARGO_HOME=${CARGO_HOME:-~/.cargo}
CONFIG_FILE=$CARGO_HOME/config.toml
# 创建父目录
if [ ! -d ~/.cargo ]; then
mkdir -p ~/.cargo
fi
while true; do
if [ -z "$1" ]; then
break;
fi
case "$1" in
"--sparse")
echo "使用稀疏索引"
sparse=""
;;
esac
shift 1
done
if [ -z ${sparse} ]; then
echo -e "[source.crates-io] \n \
replace-with = 'rsproxy-sparse' \n \
[source.rsproxy] \n \
registry = \"https://rsproxy.cn/crates.io-index\" \n \
[source.rsproxy-sparse] \n \
registry = \"sparse+https://rsproxy.cn/index/\" \n \
[registries.rsproxy] \n \
index = \"https://rsproxy.cn/crates.io-index\" \n \
[net] \n \
git-fetch-with-cli = true \n \
" > $CONFIG_FILE
else
echo "TIPS: bash change_rust_src.sh --sparse以使用稀疏索引"
echo -e "[source.crates-io] \n \
replace-with = 'rsproxy' \n \
[source.rsproxy] \n \
registry = \"https://rsproxy.cn/crates.io-index\" \n \
[source.rsproxy-sparse] \n \
registry = \"sparse+https://rsproxy.cn/index/\" \n \
[registries.rsproxy] \n \
index = \"https://rsproxy.cn/crates.io-index\" \n \
[net] \n \
git-fetch-with-cli = true \n \
" > $CONFIG_FILE
fi