diff --git a/aosp.sh b/aosp.sh index 7ec2efe..6146db7 100755 --- a/aosp.sh +++ b/aosp.sh @@ -8,6 +8,8 @@ UPSTREAM=${TUNASYNC_UPSTREAM_URL:-"https://android.googlesource.com/mirror/manif git config --global user.email "mirrors@tuna" git config --global user.name "tuna mirrors" +repo_sync_rc=0 + function repo_init() { mkdir -p $TUNASYNC_WORKING_DIR cd $TUNASYNC_WORKING_DIR @@ -16,7 +18,11 @@ function repo_init() { function repo_sync() { cd $TUNASYNC_WORKING_DIR - $REPO sync -f -j1 || echo "WARNING: repo-sync may fail, but we just ignore it." + set +e + $REPO sync -f -j1 + repo_sync_rc=$? + set -e + [[ "$repo_sync_rc" -ne 0 ]] && echo "WARNING: repo-sync may fail, but we just ignore it." } function git_repack() { @@ -44,3 +50,4 @@ if [[ "$USE_BITMAP_INDEX" == "1" ]]; then git_repack echo "Total size is" $(numfmt --to=iec $total_size) fi +exit $repo_sync_rc diff --git a/git.sh b/git.sh index 9e404e9..b3ba0e0 100755 --- a/git.sh +++ b/git.sh @@ -14,7 +14,9 @@ function update_linux_git() { echo "==== SYNC $UPSTREAM START ====" git remote set-url origin "$UPSTREAM" /usr/bin/timeout -s INT 3600 git remote -v update -p - head=$(git remote show origin | awk '/HEAD branch:/ {print $NF}') + local ret=$? + [[ $ret -ne 0 ]] && echo "git update failed with rc=$ret" + local head=$(git remote show origin | awk '/HEAD branch:/ {print $NF}') [[ -n "$head" ]] && echo "ref: refs/heads/$head" > HEAD objs=$(find objects -type f | wc -l) [[ "$objs" -gt 8 ]] && git repack -a -b -d @@ -22,6 +24,7 @@ function update_linux_git() { sz=$(($sz*1024)) echo "size-pack:" $(numfmt --to=iec $sz) echo "==== SYNC $UPSTREAM DONE ====" + return $ret } if [[ ! -f "$TUNASYNC_WORKING_DIR/HEAD" ]]; then