1 Star 0 Fork 0

mamh-mixed/tunasync-scripts

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
weave.sh 1.59 KB
一键复制 编辑 原始数据 按行查看 历史
root 提交于 2020-03-20 17:19 . unknown changes on server
#!/bin/bash -x
set -e
USE_BITMAP_INDEX=${USE_BITMAP_INDEX:-"0"}
MANIFEST_URL=$TUNASYNC_UPSTREAM_URL/weave/manifest
MANIFEST_DIR=$TUNASYNC_WORKING_DIR/.manifest
MANIFEST_XML_REPOLIST=$(dirname $0)/helpers/manifest-xml-repolist.py
IGNORED_REPO=(
# these are private repos
"weave/tests"
"weave/libuweave"
"weave/cocoapods"
)
export GIT_TERMINAL_PROMPT=0
function contains() {
for e in "${@:2}"; do [[ "$e" == "$1" ]] && return 0; done
return 1
}
function git_clone_or_pull {
URL=$1
DIRECTORY=$2
MIRROR=$3
if [[ -z $MIRROR ]]; then
if [[ -d $DIRECTORY ]]; then
git -C $DIRECTORY pull
else
git clone $URL $DIRECTORY
fi
else
if [[ -d $DIRECTORY ]]; then
git -C $DIRECTORY remote update
else
git clone --mirror $URL $DIRECTORY
fi
fi
}
function git_repack() {
echo "Start writing bitmap index"
while read repo; do
cd $repo
size=$(du -sm .|cut -f1)
if [[ "$size" -gt "100" ]]; then
echo $repo, ${size}M
git repack -a -b -d
fi
done < <(find $TUNASYNC_WORKING_DIR -not -path "$MANIFEST_DIR/.git/*" -type f -name HEAD -exec dirname '{}' ';')
}
git_clone_or_pull $MANIFEST_URL $MANIFEST_DIR
for repo in $($MANIFEST_XML_REPOLIST $MANIFEST_DIR/default.xml weave); do
contains $repo ${IGNORED_REPO[@]} && continue
echo $TUNASYNC_UPSTREAM_URL/$repo
if [[ -z ${DRY_RUN:-} ]]; then
git_clone_or_pull $TUNASYNC_UPSTREAM_URL/$repo $TUNASYNC_WORKING_DIR/$repo yes
fi
done
if [[ -z ${DRY_RUN:-} && "$USE_BITMAP_INDEX" == "1" ]]; then
git_repack
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