mirror of
https://github.com/tuna/tunasync-scripts.git
synced 2025-04-19 11:42:43 +00:00
[git] set remote url before sync
This commit is contained in:
parent
1ade30e85f
commit
2dced2260d
@ -10,9 +10,11 @@ function repo_init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function update_font_git() {
|
function update_font_git() {
|
||||||
repo_dir="$1"
|
UPSTREAM="$1"
|
||||||
|
repo_dir="$2"
|
||||||
cd "$repo_dir"
|
cd "$repo_dir"
|
||||||
echo "==== SYNC $repo_dir START ===="
|
echo "==== SYNC $repo_dir START ===="
|
||||||
|
git remote set-url origin "$UPSTREAM"
|
||||||
/usr/bin/timeout -s INT 3600 git remote -v update -p
|
/usr/bin/timeout -s INT 3600 git remote -v update -p
|
||||||
git remote set-head origin --auto
|
git remote set-head origin --auto
|
||||||
objs=$(find objects -type f | wc -l)
|
objs=$(find objects -type f | wc -l)
|
||||||
@ -44,7 +46,7 @@ for repo in ${REPOS[@]}; do
|
|||||||
echo "Initializing ${repo}.git"
|
echo "Initializing ${repo}.git"
|
||||||
repo_init "${UPSTREAM_BASE}/${repo}.git" "$TUNASYNC_WORKING_DIR/${repo}.git"
|
repo_init "${UPSTREAM_BASE}/${repo}.git" "$TUNASYNC_WORKING_DIR/${repo}.git"
|
||||||
fi
|
fi
|
||||||
update_font_git "$TUNASYNC_WORKING_DIR/${repo}.git"
|
update_font_git "${UPSTREAM_BASE}/${repo}.git" "$TUNASYNC_WORKING_DIR/${repo}.git"
|
||||||
checkout_font_branch "$TUNASYNC_WORKING_DIR/${repo}.git" "$TUNASYNC_WORKING_DIR/${repo}" "release"
|
checkout_font_branch "$TUNASYNC_WORKING_DIR/${repo}.git" "$TUNASYNC_WORKING_DIR/${repo}" "release"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -8,9 +8,11 @@ function repo_init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function update_cocoapods_git() {
|
function update_cocoapods_git() {
|
||||||
repo_dir="$1"
|
UPSTREAM="$1"
|
||||||
|
repo_dir="$2"
|
||||||
cd $repo_dir
|
cd $repo_dir
|
||||||
echo "==== SYNC $repo_dir START ===="
|
echo "==== SYNC $repo_dir START ===="
|
||||||
|
git remote set-url origin "$UPSTREAM"
|
||||||
/usr/bin/timeout -s INT 3600 git remote -v update -p
|
/usr/bin/timeout -s INT 3600 git remote -v update -p
|
||||||
git remote set-head origin --auto
|
git remote set-head origin --auto
|
||||||
objs=$(find objects -type f | wc -l)
|
objs=$(find objects -type f | wc -l)
|
||||||
@ -29,7 +31,7 @@ for repo in ${REPOS[@]}; do
|
|||||||
echo "Initializing ${repo}.git"
|
echo "Initializing ${repo}.git"
|
||||||
repo_init "${UPSTREAM_BASE}/${repo}.git" "$TUNASYNC_WORKING_DIR/${repo}.git"
|
repo_init "${UPSTREAM_BASE}/${repo}.git" "$TUNASYNC_WORKING_DIR/${repo}.git"
|
||||||
fi
|
fi
|
||||||
update_cocoapods_git "$TUNASYNC_WORKING_DIR/${repo}.git"
|
update_cocoapods_git "${UPSTREAM_BASE}/${repo}.git" "$TUNASYNC_WORKING_DIR/${repo}.git"
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Total size is" $(numfmt --to=iec $total_size)
|
echo "Total size is" $(numfmt --to=iec $total_size)
|
||||||
|
@ -8,6 +8,7 @@ function repo_init() {
|
|||||||
function update_repo_git() {
|
function update_repo_git() {
|
||||||
cd $TUNASYNC_WORKING_DIR
|
cd $TUNASYNC_WORKING_DIR
|
||||||
echo "==== SYNC repo.git START ===="
|
echo "==== SYNC repo.git START ===="
|
||||||
|
git remote set-url origin "$UPSTREAM"
|
||||||
/usr/bin/timeout -s INT 3600 git remote -v update -p
|
/usr/bin/timeout -s INT 3600 git remote -v update -p
|
||||||
git remote set-head origin --auto
|
git remote set-head origin --auto
|
||||||
git repack -a -b -d
|
git repack -a -b -d
|
||||||
|
5
git.sh
5
git.sh
@ -6,12 +6,13 @@ if [[ -z "$UPSTREAM" ]];then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
function repo_init() {
|
function repo_init() {
|
||||||
git clone --mirror $UPSTREAM $TUNASYNC_WORKING_DIR
|
git clone --mirror "$UPSTREAM" "$TUNASYNC_WORKING_DIR"
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_linux_git() {
|
function update_linux_git() {
|
||||||
cd $TUNASYNC_WORKING_DIR
|
cd "$TUNASYNC_WORKING_DIR"
|
||||||
echo "==== SYNC $UPSTREAM START ===="
|
echo "==== SYNC $UPSTREAM START ===="
|
||||||
|
git remote set-url origin "$UPSTREAM"
|
||||||
/usr/bin/timeout -s INT 3600 git remote -v update -p
|
/usr/bin/timeout -s INT 3600 git remote -v update -p
|
||||||
git remote set-head origin --auto
|
git remote set-head origin --auto
|
||||||
objs=$(find objects -type f | wc -l)
|
objs=$(find objects -type f | wc -l)
|
||||||
|
@ -6,9 +6,11 @@ function repo_init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function update_homebrew_git() {
|
function update_homebrew_git() {
|
||||||
repo_dir="$1"
|
UPSTREAM="$1"
|
||||||
|
repo_dir="$2"
|
||||||
cd $repo_dir
|
cd $repo_dir
|
||||||
echo "==== SYNC $repo_dir START ===="
|
echo "==== SYNC $repo_dir START ===="
|
||||||
|
git remote set-url origin "$UPSTREAM"
|
||||||
/usr/bin/timeout -s INT 3600 git remote -v update -p
|
/usr/bin/timeout -s INT 3600 git remote -v update -p
|
||||||
git remote set-head origin --auto
|
git remote set-head origin --auto
|
||||||
objs=$(find objects/ -type f | wc -l)
|
objs=$(find objects/ -type f | wc -l)
|
||||||
@ -18,15 +20,16 @@ function update_homebrew_git() {
|
|||||||
echo "==== SYNC $repo_dir DONE ===="
|
echo "==== SYNC $repo_dir DONE ===="
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UPSTREAM_BASE=${TUNASYNC_UPSTREAM_URL:-"https://github.com/Homebrew"}
|
||||||
brews=("brew" "homebrew-core" "homebrew-cask" "homebrew-cask-fonts" "homebrew-cask-drivers" "linuxbrew-core")
|
brews=("brew" "homebrew-core" "homebrew-cask" "homebrew-cask-fonts" "homebrew-cask-drivers" "linuxbrew-core")
|
||||||
total_size=0
|
total_size=0
|
||||||
|
|
||||||
for brew in ${brews[@]}; do
|
for brew in ${brews[@]}; do
|
||||||
if [[ ! -d "$TUNASYNC_WORKING_DIR/${brew}.git" ]]; then
|
if [[ ! -d "$TUNASYNC_WORKING_DIR/${brew}.git" ]]; then
|
||||||
echo "Initializing ${brew}.git"
|
echo "Initializing ${brew}.git"
|
||||||
repo_init "https://github.com/Homebrew/${brew}.git" "$TUNASYNC_WORKING_DIR/${brew}.git"
|
repo_init "${UPSTREAM_BASE}/${brew}.git" "$TUNASYNC_WORKING_DIR/${brew}.git"
|
||||||
fi
|
fi
|
||||||
update_homebrew_git "$TUNASYNC_WORKING_DIR/${brew}.git"
|
update_homebrew_git "${UPSTREAM_BASE}/${brew}.git" "$TUNASYNC_WORKING_DIR/${brew}.git"
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Total size is" $(numfmt --to=iec $total_size)
|
echo "Total size is" $(numfmt --to=iec $total_size)
|
||||||
|
6
llvm.sh
6
llvm.sh
@ -6,9 +6,11 @@ function repo_init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function repo_update() {
|
function repo_update() {
|
||||||
repo_dir="$1"
|
UPSTREAM=$1
|
||||||
|
repo_dir="$2"
|
||||||
cd $repo_dir
|
cd $repo_dir
|
||||||
echo "==== SYNC $repo_dir START ===="
|
echo "==== SYNC $repo_dir START ===="
|
||||||
|
git remote set-url origin "$UPSTREAM"
|
||||||
/usr/bin/timeout -s INT 3600 git remote -v update -p
|
/usr/bin/timeout -s INT 3600 git remote -v update -p
|
||||||
git remote set-head origin --auto
|
git remote set-head origin --auto
|
||||||
objs=$(find objects/ -type f | wc -l)
|
objs=$(find objects/ -type f | wc -l)
|
||||||
@ -27,7 +29,7 @@ for repo in ${repos[@]}; do
|
|||||||
echo "Initializing ${repo}.git"
|
echo "Initializing ${repo}.git"
|
||||||
repo_init "${UPSTREAM_BASE}/${repo}" "$TUNASYNC_WORKING_DIR/${repo}.git"
|
repo_init "${UPSTREAM_BASE}/${repo}" "$TUNASYNC_WORKING_DIR/${repo}.git"
|
||||||
fi
|
fi
|
||||||
repo_update "$TUNASYNC_WORKING_DIR/${repo}.git"
|
repo_update "${UPSTREAM_BASE}/${repo}" "$TUNASYNC_WORKING_DIR/${repo}.git"
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Total size is" $(numfmt --to=iec $total_size)
|
echo "Total size is" $(numfmt --to=iec $total_size)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user