| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 set -e | 6 set -e |
| 7 | 7 |
| 8 http_port=8080 | 8 http_port=8080 |
| 9 ssh_port=29418 | 9 ssh_port=29418 |
| 10 | 10 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 password='test-password' | 46 password='test-password' |
| 47 preferred_email="test-username@test.org" | 47 preferred_email="test-username@test.org" |
| 48 registered_on=$(date '+%Y-%m-%d %H:%M:%S.000%:::z') | 48 registered_on=$(date '+%Y-%m-%d %H:%M:%S.000%:::z') |
| 49 username='test-username' | 49 username='test-username' |
| 50 | 50 |
| 51 # The python code below for picking the "latest" gerrit release is cribbed and | 51 # The python code below for picking the "latest" gerrit release is cribbed and |
| 52 # ported from the javascript at: | 52 # ported from the javascript at: |
| 53 # | 53 # |
| 54 # http://gerrit-releases.storage.googleapis.com/index.html | 54 # http://gerrit-releases.storage.googleapis.com/index.html |
| 55 url='https://www.googleapis.com/storage/v1beta2/b/gerrit-releases/o?projection=n
oAcl' | 55 url='https://www.googleapis.com/storage/v1beta2/b/gerrit-releases/o?projection=n
oAcl' |
| 56 curl --ssl-reqd -s $url | python <(cat <<EOF | 56 curl --retry 30 --ssl-reqd -s $url | python <(cat <<EOF |
| 57 # Receives Gerrit version via command line and reads json-encoded | 57 # Receives Gerrit version via command line and reads json-encoded |
| 58 # text from stdin in the format: | 58 # text from stdin in the format: |
| 59 # | 59 # |
| 60 # { | 60 # { |
| 61 # "items": [ | 61 # "items": [ |
| 62 # { | 62 # { |
| 63 # "name": "gerrit-<version>.war", | 63 # "name": "gerrit-<version>.war", |
| 64 # "md5Hash": "<base64 encoded md5sum>", | 64 # "md5Hash": "<base64 encoded md5sum>", |
| 65 # }, | 65 # }, |
| 66 # { | 66 # { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 sed 's/ //g') | 115 sed 's/ //g') |
| 116 if [ -f "$target" ]; then | 116 if [ -f "$target" ]; then |
| 117 file_sum=$(md5sum "$target" | awk '{print $1}' | xargs) | 117 file_sum=$(md5sum "$target" | awk '{print $1}' | xargs) |
| 118 if [ "$file_sum" = "$net_sum" ]; then | 118 if [ "$file_sum" = "$net_sum" ]; then |
| 119 ln -sf "$name" "$gerrit_exe" | 119 ln -sf "$name" "$gerrit_exe" |
| 120 break | 120 break |
| 121 else | 121 else |
| 122 rm -rf "$target" | 122 rm -rf "$target" |
| 123 fi | 123 fi |
| 124 fi | 124 fi |
| 125 curl --ssl-reqd -s -o "$target" \ | 125 curl --retry 30 --ssl-reqd -s -o "$target" \ |
| 126 "https://gerrit-releases.storage.googleapis.com/$name" | 126 "https://gerrit-releases.storage.googleapis.com/$name" |
| 127 file_sum=$(md5sum "$target" | awk '{print $1}' | xargs) | 127 file_sum=$(md5sum "$target" | awk '{print $1}' | xargs) |
| 128 if [ "$file_sum" != "$net_sum" ]; then | 128 if [ "$file_sum" != "$net_sum" ]; then |
| 129 echo "ERROR: md5sum mismatch when downloading $name" 1>&2 | 129 echo "ERROR: md5sum mismatch when downloading $name" 1>&2 |
| 130 rm -rf "$target" | 130 rm -rf "$target" |
| 131 exit 1 | 131 exit 1 |
| 132 else | 132 else |
| 133 ln -sf "$name" "$gerrit_exe" | 133 ln -sf "$name" "$gerrit_exe" |
| 134 fi | 134 fi |
| 135 done | 135 done |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 To use SSH API: | 199 To use SSH API: |
| 200 ssh ${username}@localhost -p ${ssh_port} -i ${rundir}/tmp/id_rsa gerrit | 200 ssh ${username}@localhost -p ${ssh_port} -i ${rundir}/tmp/id_rsa gerrit |
| 201 | 201 |
| 202 To enable 'git push' without a password prompt: | 202 To enable 'git push' without a password prompt: |
| 203 git config credential.helper 'store --file=${rundir}/tmp/.git-credentials' | 203 git config credential.helper 'store --file=${rundir}/tmp/.git-credentials' |
| 204 | 204 |
| 205 To stop the server: | 205 To stop the server: |
| 206 ${rundir}/bin/gerrit.sh stop | 206 ${rundir}/bin/gerrit.sh stop |
| 207 | 207 |
| 208 EOF | 208 EOF |
| OLD | NEW |