summaryrefslogtreecommitdiff
path: root/download
blob: 1b4d83d466848dbb0200d6607160d4649f4464e0 (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
#
# Clone the rest of the remote repositories to have the complete ooo-build
# sources

usage() {
    cat 1>&2 <<EOF

./download [--help] [--list] [--skip=val[,val2]] [--repo=git://XYZ]

  -h,--help  This text
  -l,--list  Return all the available components
  --repo     The repository location; if not specified, it is guessed
             from the current one
             Anon repo: git://anongit.freedesktop.org/git/ooo-build
  --skip     Don't download the selected components, eg. filters,l10n
EOF
    exit 1
}

COMPONENTS="artwork base bootstrap calc components extensions extras filters
help impress l10n libs-core libs-extern libs-extern-sys libs-gui ooo-build
postprocess sdk testing ure writer"

ORIGIN=`git remote show -n origin | grep 'Fetch URL:' | sed 's#^[[:space:]]*Fetch URL: ##'`

SKIP=
REPO=`echo "$ORIGIN" | sed 's#/[^/]\+/\?$##'`

# get the params
while [ -n "$1" ]
do
    case "$1" in
        --list|-l) echo $COMPONENTS ; exit 0 ;;
        --skip=*)  SKIP=${1#--skip=} ;;
        --repo=*)  REPO=${1#--repo=} ;;
        --help|-h) usage ;;
    esac
    shift
done

# check that everything's OK
if [ -z "$REPO" ]
then
    echo "Couldn't guess the repository location, please provide that with --repo" 1>&2
    echo 1>&2
    usage
fi

# skip the repo where we are
SKIP="$SKIP,`echo $ORIGIN | sed 's#.*/\([^/]\+\)/\?$#\1#'`"

# do the work
for DIR in $COMPONENTS
do
    # skip?
    ( echo "$SKIP" | grep "\<$DIR\>" > /dev/null 2>&1 ) && continue
    # already cloned?
    [ -d ../$DIR ] && { echo "* Not clonnig $DIR, already exists" ; continue ; }

    # clone!
    echo "* Cloning $DIR..."
    ( cd .. ; git clone "$REPO/$DIR" )
done