6 . /usr/local/lib/arvbox/common.sh
8 mkdir -p /var/lib/arvados/git
10 export ARVADOS_API_HOST=$localip:${services[api]}
11 export ARVADOS_API_HOST_INSECURE=1
12 export ARVADOS_API_TOKEN=$(cat /var/lib/arvados/superuser_token)
17 export HOME=/var/lib/arvados/git
21 mkdir -p ~arvbox/.ssh ~git/.ssh
22 chmod 0700 ~arvbox/.ssh ~git/.ssh
24 if ! test -s ~arvbox/.ssh/id_rsa ; then
25 ssh-keygen -t rsa -P '' -f .ssh/id_rsa
26 cp ~arvbox/.ssh/id_rsa ~arvbox/.ssh/id_rsa.pub ~git/.ssh
29 if test -s ~arvbox/.ssh/known_hosts ; then
30 ssh-keygen -f ".ssh/known_hosts" -R localhost
33 if ! test -f /var/lib/arvados/gitolite-setup ; then
36 # Do a no-op login to populate known_hosts
37 # with the hostkey, so it won't try to ask
39 cp .ssh/id_rsa.pub .ssh/authorized_keys
40 ssh -o stricthostkeychecking=no git@localhost true
41 rm .ssh/authorized_keys
43 cp /usr/local/lib/arvbox/gitolite.rc .gitolite.rc
45 gitolite setup -pk .ssh/id_rsa.pub
47 if ! test -d gitolite-admin ; then
48 git clone git@localhost:gitolite-admin
52 git config user.email arvados
53 git config user.name arvados
54 git config push.default simple
57 touch /var/lib/arvados/gitolite-setup
59 # Do a no-op login to populate known_hosts
60 # with the hostkey, so it won't try to ask
61 # about it later. Don't run anything,
62 # get the default gitolite behavior.
63 ssh -o stricthostkeychecking=no git@localhost
66 prefix=$(arv --format=uuid user current | cut -d- -f1)
68 if ! test -s /var/lib/arvados/arvados-git-uuid ; then
69 repo_uuid=$(arv --format=uuid repository create --repository "{\"owner_uuid\":\"$prefix-tpzed-000000000000000\", \"name\":\"arvados\"}")
70 echo $repo_uuid > /var/lib/arvados/arvados-git-uuid
73 repo_uuid=$(cat /var/lib/arvados/arvados-git-uuid)
75 if ! test -s /var/lib/arvados/arvados-git-link-uuid ; then
76 all_users_group_uuid="$prefix-j7d0g-fffffffffffffff"
79 read -rd $'\000' newlink <<EOF
81 "tail_uuid":"$all_users_group_uuid",
82 "head_uuid":"$repo_uuid",
83 "link_class":"permission",
88 link_uuid=$(arv --format=uuid link create --link "$newlink")
89 echo $link_uuid > /var/lib/arvados/arvados-git-link-uuid
92 if ! test -d /var/lib/arvados/git/repositories/$repo_uuid.git ; then
93 git clone --bare /usr/src/arvados /var/lib/arvados/git/repositories/$repo_uuid.git
95 git --git-dir=/var/lib/arvados/git/repositories/$repo_uuid.git fetch -f /usr/src/arvados master:master
98 cd /usr/src/arvados/services/api
99 export RAILS_ENV=development
101 git_user_key=$(cat ~git/.ssh/id_rsa.pub)
103 cat > config/arvados-clients.yml <<EOF
105 gitolite_url: /var/lib/arvados/git/repositories/gitolite-admin.git
106 gitolite_tmp: /var/lib/arvados/git
107 arvados_api_host: $localip:${services[api]}
108 arvados_api_token: "$ARVADOS_API_TOKEN"
109 arvados_api_host_insecure: true
110 gitolite_arvados_git_user_key: "$git_user_key"
114 bundle exec script/arvados-git-sync.rb development