equal
deleted
inserted
replaced
|
1 #!/bin/sh |
|
2 |
|
3 set -e |
|
4 |
|
5 cd |
|
6 |
|
7 cat > .ssh/config <<__END__ |
|
8 Host chroothg |
|
9 Hostname localhost |
|
10 User hg |
|
11 Port 2222 |
|
12 __END__ |
|
13 |
|
14 echo "Cloning hgadmin..." |
|
15 hg clone ssh://chroothg/hgadmin |
|
16 echo "Updating hgadmin..." |
|
17 cd hgadmin |
|
18 |
|
19 cat > access.conf <<__END__ |
|
20 read user=restricted/** file=denied/** |
|
21 write user=restricted/** |
|
22 __END__ |
|
23 mkdir -p keys/restricted |
|
24 cp /home/test2/.ssh/id_rsa.pub keys/restricted/test2 |
|
25 |
|
26 hg add keys/restricted/test2 access.conf |
|
27 hg commit -u test1 -m "Added user test2" |
|
28 echo "Push" |
|
29 hg push |
|
30 cd .. |
|
31 hg init realrepo |
|
32 cd realrepo |
|
33 mkdir denied |
|
34 echo "This is a file" > content |
|
35 echo "This is a file not everyone can write to" > denied/cantwrite |
|
36 hg init nested |
|
37 echo "This is a file in a nested repo" > nested/content |
|
38 hg add -R nested nested/content |
|
39 hg commit -u test1 -R nested -m "Add files to the subrepo" |
|
40 echo "nested = nested" > .hgsub |
|
41 hg add content denied/cantwrite .hgsub |
|
42 hg commit -u test1 -m "Add files to the repo" |
|
43 echo "Pushing changes" |
|
44 hg clone . ssh://chroothg/real/project |
|
45 hg clone nested ssh://chroothg/real/project/nested |
|
46 echo "Done for user test1" |