4 hosts
="frodo sam gollum"
8 bd
=`gitolite query-rc -n GL_BINDIR`
12 chmod -R go
+rX
/tmp
/g3
14 # setup symlinks in frodo, sam, and gollum's accounts
17 sudo
-u $h -i bash
-c "rm -rf *.pub bin .ssh projects.list repositories .gitolite .gitolite.rc"
20 [ "$1" = "clear" ] && exit
28 ssh-keygen
-N '' -q -f server-
$h -C $h
29 chmod go
+r
/tmp
/g
3/keys
/server-
$h
31 cp $bd/..
/t
/mirror-test-ssh-config ssh-config
33 chmod -R go
+rX
/tmp
/g3
37 sudo
-u $h -i bash
-c "mkdir -p bin; ln -sf /tmp/g3/src/gitolite bin; mkdir -p .ssh; chmod 0700 .ssh"
39 sudo
-u $h -i cp /tmp
/g
3/keys
/ssh-config .ssh
/config
40 sudo
-u $h -i cp /tmp
/g
3/keys
/server-
$h .ssh
/id_rsa
41 sudo
-u $h -i cp /tmp
/g
3/keys
/server-
$h.pub .ssh
/id_rsa.pub
42 sudo
-u $h -i chmod go-rwx .ssh
/id_rsa .ssh
/config
46 # add all pubkeys to all servers
49 sudo
-u $h -i gitolite setup
-a admin
52 sudo
-u $h -i gitolite setup
-pk /tmp
/g
3/keys
/server-
$j.pub
53 echo sudo _u
$j _i
ssh $h@localhost info
54 sudo
-u $j -i ssh -o StrictHostKeyChecking
=no
$h@localhost info
59 # now copy our admin key to the main host
61 cp admin id_rsa
; cp admin.pub id_rsa.pub
62 cp admin.pub
/tmp
/g
3/keys
; chmod go
+r
/tmp
/g
3/keys
/admin.pub
63 sudo
-u $mainhost -i gitolite setup
-pk /tmp
/g
3/keys
/admin.pub
64 ssh $mainhost@localhost info
68 option mirror.master = frodo
69 option mirror.slaves-1 = sam gollum
70 option mirror.redirectOK = sam
76 option mirror.master = sam
77 option mirror.slaves-1 = frodo
83 option mirror.master = sam
84 option mirror.slaves-1 = frodo gollum
85 option mirror.redirectOK = all
87 include \"%HOSTNAME.conf\"
95 # for each server, set the HOSTNAME to the rc, add the mirror options to the
96 # conf file, and compile
99 cat $bd/..
/t
/mirror-test-rc | perl
-pe "s/%HOSTNAME/$h/" > /tmp
/g
3/temp
100 chmod go
+rX
/tmp
/g
3/temp
101 sudo
-u $h -i cp /tmp
/g
3/temp .gitolite.rc
102 echo "$lines" | sudo
-u $h -i sh
-c 'cat >> .gitolite/conf/gitolite.conf'
103 echo "$lines2" | sudo
-u $h -i sh
-c "cat >> .gitolite/conf/$h.conf"
104 sudo
-u $h -i gitolite setup
109 # local to frodo but sam thinks frodo is a slave
113 # both think they're master
116 option mirror.master = frodo
117 option mirror.slaves = sam
119 # frodo thinks someone else is the master but sam thinks he is
122 option mirror.master = merry
123 option mirror.slaves = frodo
125 # local to frodo but sam thinks frodo is a master and redirect is OK
129 # non-native to frodo but sam thinks frodo is master
132 option mirror.master = gollum
133 option mirror.slaves = frodo
134 option mirror.redirectOK = all
136 # sam is not a valid slave to send stuff to frodo
139 option mirror.master = frodo
140 option mirror.slaves = gollum
141 option mirror.redirectOK = all
144 echo "$lines" | sudo
-u frodo
-i sh
-c "cat >> .gitolite/conf/frodo.conf"
148 # local to frodo but sam thinks frodo is a slave
151 option mirror.master = sam
152 option mirror.slaves = frodo
154 # both think they're master
157 option mirror.master = sam
158 option mirror.slaves = frodo
160 # frodo thinks someone else is the master but sam thinks he is
163 option mirror.master = sam
164 option mirror.slaves = frodo
166 # local to frodo but sam thinks frodo is a master and redirect is OK
169 option mirror.master = frodo
170 option mirror.slaves = sam
171 option mirror.redirectOK = all
173 # non-native to frodo but sam thinks frodo is master
176 option mirror.master = frodo
177 option mirror.slaves = sam
178 option mirror.redirectOK = all
180 # sam is not a valid slave to send stuff to frodo
183 option mirror.master = frodo
184 option mirror.slaves = sam
185 option mirror.redirectOK = all
188 echo "$lines" | sudo
-u sam
-i sh
-c "cat >> .gitolite/conf/sam.conf"
192 sudo
-u $h -i gitolite setup
195 # that ends the setup phase
196 echo ======================================================================