4 hosts
="frodo sam gollum"
8 bd
=`gitolite query-rc -n GL_BINDIR`
11 chmod -R go
+rX
/tmp
/g3
13 # setup symlinks in frodo, sam, and gollum's accounts
16 sudo
-u $h -i bash
-c "rm -rf *.pub bin .ssh projects.list repositories .gitolite .gitolite.rc"
19 [ "$1" = "clear" ] && exit
27 ssh-keygen
-N '' -q -f server-
$h -C $h
28 chmod go
+r
/tmp
/g
3/keys
/server-
$h
30 cp $bd/..
/t
/mirror-test-ssh-config ssh-config
35 sudo
-u $h -i bash
-c "mkdir -p bin; ln -sf /tmp/g3/src/gitolite bin; mkdir -p .ssh; chmod 0700 .ssh"
37 sudo
-u $h -i cp /tmp
/g
3/keys
/ssh-config .ssh
/config
38 sudo
-u $h -i cp /tmp
/g
3/keys
/server-
$h .ssh
/id_rsa
39 sudo
-u $h -i cp /tmp
/g
3/keys
/server-
$h.pub .ssh
/id_rsa.pub
40 sudo
-u $h -i chmod go-rwx .ssh
/id_rsa .ssh
/config
44 # add all pubkeys to all servers
47 sudo
-u $h -i gitolite setup
-a admin
50 sudo
-u $h -i gitolite setup
-pk /tmp
/g
3/keys
/server-
$j.pub
51 echo sudo _u
$j _i
ssh $h@localhost info
52 sudo
-u $j -i ssh -o StrictHostKeyChecking
=no
$h@localhost info
57 # now copy our admin key to the main host
59 cp admin id_rsa
; cp admin.pub id_rsa.pub
60 cp admin.pub
/tmp
/g
3/keys
; chmod go
+r
/tmp
/g
3/keys
/admin.pub
61 sudo
-u $mainhost -i gitolite setup
-pk /tmp
/g
3/keys
/admin.pub
62 ssh $mainhost@localhost info
66 option mirror.master = frodo
67 option mirror.slaves-1 = sam gollum
68 option mirror.redirectOK = sam
74 option mirror.master = sam
75 option mirror.slaves-1 = frodo
81 option mirror.master = sam
82 option mirror.slaves-1 = frodo gollum
83 option mirror.redirectOK = all
85 include \"%HOSTNAME.conf\"
93 # for each server, set the HOSTNAME to the rc, add the mirror options to the
94 # conf file, and compile
97 cat $bd/..
/t
/mirror-test-rc | perl
-pe "s/%HOSTNAME/$h/" > /tmp
/g
3/temp
98 sudo
-u $h -i cp /tmp
/g
3/temp .gitolite.rc
99 echo "$lines" | sudo
-u $h -i sh
-c 'cat >> .gitolite/conf/gitolite.conf'
100 echo "$lines2" | sudo
-u $h -i sh
-c "cat >> .gitolite/conf/$h.conf"
101 sudo
-u $h -i gitolite setup
106 # local to frodo but sam thinks frodo is a slave
110 # both think they're master
113 option mirror.master = frodo
114 option mirror.slaves = sam
116 # frodo thinks someone else is the master but sam thinks he is
119 option mirror.master = merry
120 option mirror.slaves = frodo
122 # local to frodo but sam thinks frodo is a master and redirect is OK
126 # non-native to frodo but sam thinks frodo is master
129 option mirror.master = gollum
130 option mirror.slaves = frodo
131 option mirror.redirectOK = all
133 # sam is not a valid slave to send stuff to frodo
136 option mirror.master = frodo
137 option mirror.slaves = gollum
138 option mirror.redirectOK = all
141 echo "$lines" | sudo
-u frodo
-i sh
-c "cat >> .gitolite/conf/frodo.conf"
145 # local to frodo but sam thinks frodo is a slave
148 option mirror.master = sam
149 option mirror.slaves = frodo
151 # both think they're master
154 option mirror.master = sam
155 option mirror.slaves = frodo
157 # frodo thinks someone else is the master but sam thinks he is
160 option mirror.master = sam
161 option mirror.slaves = frodo
163 # local to frodo but sam thinks frodo is a master and redirect is OK
166 option mirror.master = frodo
167 option mirror.slaves = sam
168 option mirror.redirectOK = all
170 # non-native to frodo but sam thinks frodo is master
173 option mirror.master = frodo
174 option mirror.slaves = sam
175 option mirror.redirectOK = all
177 # sam is not a valid slave to send stuff to frodo
180 option mirror.master = frodo
181 option mirror.slaves = sam
182 option mirror.redirectOK = all
185 echo "$lines" | sudo
-u sam
-i sh
-c "cat >> .gitolite/conf/sam.conf"
189 sudo
-u $h -i gitolite setup
192 # that ends the setup phase
193 echo ======================================================================