install_remotes.sh 1.95 KB
Newer Older
1
#!/bin/bash
2

3
4
set -e

groente's avatar
groente committed
5
gitolite_root=/var/lib/gitolite3
6
7
8
9
10
11
12
repository_root="${gitolite_root}/repositories"

/usr/bin/find "$repository_root" \
   -mindepth 1 -maxdepth 1 \
   -type d -print0 | while IFS= read -r -d '' repository_dir ; do

    repository=$(basename "$repository_dir")
13
    # set up remotes for the mirrors we're pushing to
intrigeri's avatar
intrigeri committed
14
    case "$repository" in
15
        puppet-*|etcher-binary.git|jenkins-jobs.git|mirror-pool-dispatcher.git|mirror-pool.git|promotion-material.git|tails.git|uui-binary.git)
intrigeri's avatar
intrigeri committed
16
            if ! grep -qs -x "${repository}" \
groente's avatar
groente committed
17
                  /var/lib/gitolite3/projects.list ; then
intrigeri's avatar
intrigeri committed
18
19
20
21
22
23
               continue
            fi
            (
               cd "$repository_dir"
               git remote | grep -qs -x immerda || \
                  git remote add immerda "tails@git.tails.boum.org:$repository"
intrigeri's avatar
intrigeri committed
24
25
               git remote | grep -qs -x salsa || \
                  git remote add salsa "git@salsa.debian.org:tails-team/$repository"
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

               case "$repository" in
                   # The puppet-* and jenkins-jobs repos should now also
                   # mirror to Tails GitLab instance.
                   puppet-*|jenkins-jobs.git)
                       if git remote | grep -qs -x gitlab; then
                           git remote set-url gitlab "git@gitlab-ssh.tails.boum.org:tails/$repository"
                       else
                              git remote add gitlab "git@gitlab-ssh.tails.boum.org:tails/$repository"
                       fi
                       ;;

                   # All the others are now mirrors of their counterpart repos
                   # in Tails GitLab instance.
                   *)
		       ;;
               esac
intrigeri's avatar
intrigeri committed
43
            )
44
            ;;
45
	weblate-gatekeeper.git)
46
            cd "$repository_dir"
47
            git remote | grep -qs -x gitlab || \
48
                git remote add gitlab "git@gitlab-as-role-weblate-gatekeeper:tails/tails.git"
49
            ;;
50
51
52
53
        *)
            ;;
    esac
done