mirror of
https://github.com/tuna/tunasync-scripts.git
synced 2025-06-30 23:12:45 +00:00
calculate the size of pybombs repo
This commit is contained in:
parent
161fd2a5be
commit
00c168ce17
11
pybombs.sh
11
pybombs.sh
@ -14,8 +14,19 @@ function pybombs_mirror() {
|
||||
cp ${PYBOMBS_MIRROR_SCRIPT_PATH}/ignore.urls ${TUNASYNC_WORKING_DIR}/
|
||||
${PYBOMBS_MIRROR_SCRIPT_PATH}/pybombs-mirror.sh
|
||||
}
|
||||
function calculate_size() {
|
||||
total_size=0
|
||||
for repo in "${TUNASYNC_WORKING_DIR}"/git/*; do
|
||||
sz=$(git -C "$repo" count-objects -v|grep -Po '(?<=size-pack: )\d+')
|
||||
total_size=$(($total_size+1024*$sz))
|
||||
done
|
||||
sz=$(du -sb "${TUNASYNC_WORKING_DIR}/wget"|cut -f1)
|
||||
total_size=$(($total_size+$sz))
|
||||
echo "Total size is" $(numfmt --to=iec $total_size)
|
||||
}
|
||||
|
||||
PYBOMBS_MIRROR_SCRIPT_PATH="${PYBOMBS_MIRROR_SCRIPT_PATH:-"/opt/pybombs-mirror"}"
|
||||
MIRROR_BASE_URL="${MIRROR_BASE_URL:-"https://pybombs.tuna.tsinghua.edu.cn"}"
|
||||
|
||||
pybombs_mirror
|
||||
calculate_size
|
||||
|
Loading…
x
Reference in New Issue
Block a user