From 31ee06590ba8682542d857d8222e1ab18acb1ca2 Mon Sep 17 00:00:00 2001 From: z4yx Date: Sat, 21 Mar 2020 10:16:20 +0800 Subject: [PATCH] unify the size format --- git-repo.sh | 3 ++- git.sh | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/git-repo.sh b/git-repo.sh index 8f7e7f9..6e5cab0 100755 --- a/git-repo.sh +++ b/git-repo.sh @@ -10,7 +10,8 @@ function update_repo_git() { echo "==== SYNC repo.git START ====" /usr/bin/timeout -s INT 3600 git remote -v update git repack -a -b -d - git count-objects -v -H + sz=$(git count-objects -v|grep -Po '(?<=size-pack: )\d+') + echo "size-pack:" $(numfmt --to=iec $sz) echo "==== SYNC repo.git DONE ====" } diff --git a/git.sh b/git.sh index fcf8aca..341fd8b 100755 --- a/git.sh +++ b/git.sh @@ -1,5 +1,9 @@ #!/bin/bash -UPSTREAM=${TUNASYNC_UPSTREAM_URL:-"git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git"} +UPSTREAM=${TUNASYNC_UPSTREAM_URL} +if [[ -z "$UPSTREAM" ]];then + echo "Please set the TUNASYNC_UPSTREAM_URL" + exit 1 +fi function repo_init() { git clone --mirror $UPSTREAM $TUNASYNC_WORKING_DIR