update linux.git and homebrew scripts

This commit is contained in:
bigeagle 2016-05-05 22:15:51 +08:00
parent b504b7d218
commit 8357f38d26
No known key found for this signature in database
GPG Key ID: 9171A4571C27920A
2 changed files with 28 additions and 11 deletions

View File

@ -1,17 +1,25 @@
#!/bin/bash
if [ ! -d "$TUNASYNC_WORKING_DIR" ]; then
echo "Directory not exists, fail"
exit 1
fi
function repo_init() {
UPSTREAM=$1
WORKING_DIR=$2
git clone --mirror $UPSTREAM $WORKING_DIR
}
function update_homebrew_git() {
repo_dir="$1"
cd $repo_dir
echo "==== SYNC $repo_dir START ===="
/usr/bin/timeout -s INT 3600 git remote -v update
git repack -a -b -d
echo "==== SYNC $repo_dir DONE ===="
}
update_homebrew_git "$TUNASYNC_WORKING_DIR/homebrew.git"
update_homebrew_git "$TUNASYNC_WORKING_DIR/homebrew-python.git"
update_homebrew_git "$TUNASYNC_WORKING_DIR/homebrew-science.git"
brews=("brew" "homebrew-core" "homebrew-python" "homebrew-science")
for brew in ${brews[@]}; do
if [[ ! -d "$TUNASYNC_WORKING_DIR/${brew}.git" ]]; then
echo "Initializing ${brew}.git"
repo_init "https://github.com/Homebrew/${brew}.git" "$TUNASYNC_WORKING_DIR/${brew}.git"
fi
update_homebrew_git "$TUNASYNC_WORKING_DIR/${brew}.git"
done

View File

@ -1,12 +1,21 @@
#!/bin/bash
if [ ! -d "$TUNASYNC_WORKING_DIR" ]; then
echo "Directory not exists, fail"
exit 1
fi
UPSTREAM=${TUNASYNC_UPSTREAM_URL:-"git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git"}
function repo_init() {
git clone --mirror $UPSTREAM $TUNASYNC_WORKING_DIR
}
function update_linux_git() {
cd $TUNASYNC_WORKING_DIR
echo "==== SYNC linux.git START ===="
/usr/bin/timeout -s INT 3600 git remote -v update
git repack -a -b -d
echo "==== SYNC linux.git DONE ===="
}
if [[ ! -d "$TUNASYNC_WORKING_DIR" ]]; then
echo "Initializing Linux.git mirror"
repo_init
fi
update_linux_git