| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 fi | 135 fi |
| 136 done | 136 done |
| 137 | 137 |
| 138 if [ ! -e "$gerrit_exe" ]; then | 138 if [ ! -e "$gerrit_exe" ]; then |
| 139 echo "ERROR: No $gerrit_exe file or link present, and unable " 1>&2 | 139 echo "ERROR: No $gerrit_exe file or link present, and unable " 1>&2 |
| 140 echo " to download the latest version." 1>&2 | 140 echo " to download the latest version." 1>&2 |
| 141 exit 1 | 141 exit 1 |
| 142 fi | 142 fi |
| 143 | 143 |
| 144 # By default, gerrit only accepts https connections, which is a good thing. But | 144 # By default, gerrit only accepts https connections, which is a good thing. But |
| 145 # for testing, it's convenient to enable plain http. | 145 # for testing, it's convenient to enable plain http. Also, turn off all email |
| 146 # notifications. |
| 146 mkdir -p "${rundir}/etc" | 147 mkdir -p "${rundir}/etc" |
| 147 cat <<EOF > "${rundir}/etc/gerrit.config" | 148 cat <<EOF > "${rundir}/etc/gerrit.config" |
| 148 [auth] | 149 [auth] |
| 149 type = http | 150 type = http |
| 150 gitBasicAuth = true | 151 gitBasicAuth = true |
| 151 [gerrit] | 152 [gerrit] |
| 152 canonicalWebUrl = http://$(hostname):${http_port}/ | 153 canonicalWebUrl = http://$(hostname):${http_port}/ |
| 153 [httpd] | 154 [httpd] |
| 154 listenUrl = http://*:${http_port}/ | 155 listenUrl = http://*:${http_port}/ |
| 155 [sshd] | 156 [sshd] |
| 156 listenAddress = *:${ssh_port} | 157 listenAddress = *:${ssh_port} |
| 158 [sendemail] |
| 159 enable = false |
| 157 EOF | 160 EOF |
| 158 | 161 |
| 159 # Initialize the gerrit instance. | 162 # Initialize the gerrit instance. |
| 160 java -jar "$gerrit_exe" init --no-auto-start --batch -d "${rundir}" | 163 java -jar "$gerrit_exe" init --no-auto-start --batch -d "${rundir}" |
| 161 | 164 |
| 162 # Create SSH key pair for the first user. | 165 # Create SSH key pair for the first user. |
| 163 mkdir -p "${rundir}/tmp" | 166 mkdir -p "${rundir}/tmp" |
| 164 ssh-keygen -t rsa -q -f "${rundir}/tmp/id_rsa" -N "" | 167 ssh-keygen -t rsa -q -f "${rundir}/tmp/id_rsa" -N "" |
| 165 ssh_public_key="$(cat ${rundir}/tmp/id_rsa.pub)" | 168 ssh_public_key="$(cat ${rundir}/tmp/id_rsa.pub)" |
| 166 | 169 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 195 To use SSH API: | 198 To use SSH API: |
| 196 ssh ${username}@localhost -p ${ssh_port} -i ${rundir}/tmp/id_rsa gerrit | 199 ssh ${username}@localhost -p ${ssh_port} -i ${rundir}/tmp/id_rsa gerrit |
| 197 | 200 |
| 198 To enable 'git push' without a password prompt: | 201 To enable 'git push' without a password prompt: |
| 199 git config credential.helper 'store --file=${rundir}/tmp/.git-credentials' | 202 git config credential.helper 'store --file=${rundir}/tmp/.git-credentials' |
| 200 | 203 |
| 201 To stop the server: | 204 To stop the server: |
| 202 ${rundir}/bin/gerrit.sh stop | 205 ${rundir}/bin/gerrit.sh stop |
| 203 | 206 |
| 204 EOF | 207 EOF |
| OLD | NEW |