aboutsummaryrefslogtreecommitdiff
path: root/openjdk-tools
blob: 4148a09f3c6617c8a11bc0994b93cf93f8d1f10e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
# 
# This script is used to update OpenJDK mirrors set up on the git server.
#

MIRROR_DIR="/srv/mirror"
OPENJDK_MIRROR_DIR="$MIRROR_DIR/openjdk"
GITOLITE_HOME="/home/git/bin"
HG=`which hg`
GIT=`which git`

function gitolite_push() {
    if [ "`pwd`" != $1 ]; then
        cd $1
    fi
    $GITOLITE_HOME/gitolite push --all 1>/dev/null 2>/dev/null
    $GITOLITE_HOME/gitolite push --tags 1>/dev/null 2>/dev/null
}

function hg_pull() {
    if [ "`pwd`" != $1 ]; then
        cd $1
    fi
    $HG pull 1>/dev/null
    $HG update 1>/dev/null
}

function git_pull() {
    if [ "`pwd`" != $1 ]; then
        cd $1
    fi
    $GIT pull 1>/dev/null
}

function update_git_mirror() {
    git_pull $1
    gitolite_push $1
}

for hgrepo in `find $OPENJDK_MIRROR_DIR -type d -name ".hg" -prune -exec dirname {} \;`; do
    hg_pull $hgrepo
done

for gitrepo in `find $OPENJDK_MIRROR_DIR -type d -name "*.git" -prune`; do
    update_git_mirror $gitrepo
done