1 Star 0 Fork 0

mamh-mixed/tunasync-scripts

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
freighter.sh 1.22 KB
一键复制 编辑 原始数据 按行查看 历史
Aron Xu 提交于 2024-03-05 15:23 . freighter: initial crates.io sync script
#!/bin/bash
set -e
FREIGHTER=${FREIGHTER:-"/usr/local/cargo/bin/freighter-registry"}
CRATES_UPSTREAM="https://static.crates.io/crates"
INDEX_UPSTREAM="https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git"
TUNASYNC_UPSTREAM=${TUNASYNC_UPSTREAM_URL:-$CRATES_UPSTREAM}
TUNASYNC_UPSTREAM=${TUNASYNC_UPSTREAM%/}
CONF="$TUNASYNC_WORKING_DIR/config.toml"
INIT=${INIT:-"0"}
if [ ! -d "$TUNASYNC_WORKING_DIR" ]; then
mkdir -p $TUNASYNC_WORKING_DIR
INIT="1"
elif [ -d "$TUNASYNC_WORKING_DIR/crates" ]; then
INIT="1"
fi
echo "Syncing to $TUNASYNC_WORKING_DIR"
cat > $CONF << EOF
[log]
# see https://docs.rs/log4rs/1.2.0/log4rs/append/file/struct.FileAppenderDeserializer.html#configuration
encoder = "{d}:{l} - {m}{n}"
# unit is MB
limit = 100
level = "info"
[crates]
index_domain = "$INDEX_UPSTREAM"
domain = "$CRATES_UPSTREAM"
download_threads = 16
serve_domains = [
"localhost",
]
[proxy]
enable = false
# git_index_proxy = "127.0.0.1:6780"
# download_proxy = "127.0.0.1:6780"
EOF
if [[ $INIT == "0" ]]; then
$FREIGHTER -c $TUNASYNC_WORKING_DIR crates pull
exec $FREIGHTER -c $TUNASYNC_WORKING_DIR crates download
else
$FREIGHTER -c $TUNASYNC_WORKING_DIR crates pull
exec $FREIGHTER -c $TUNASYNC_WORKING_DIR crates download --init
fi
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mamh-mixed/tunasync-scripts.git
git@gitee.com:mamh-mixed/tunasync-scripts.git
mamh-mixed
tunasync-scripts
tunasync-scripts
master

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385