~launchpad-pqm/launchpad/devel

4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
1
#! /bin/bash
2
3
# This script will setup a brand new Ubuntu machine as a LP developer
4
# workstation, from scratch. The script lives in the LP codebase itself,
5
# as utilities/rocketfuel-setup
6
6673.1.3 by Barry Warsaw
Use $HOME instead of ~
7
if [ ! -e "$HOME/.rocketfuel-env.sh" ]; then
6673.1.1 by Barry Warsaw
Write rocketfuel-env.sh if it doesn't exist. Allows RocketFuelSetup
8
  echo "# Common environment variables for the rocketfuel-* scripts.
9
#
10
# The ones you can set are:
11
#
12
# LP_PROJECT_ROOT - The root directory of all your Canonical stuff.  Your
13
#                   Launchpad shared repository will live in a child directory
14
#                   of this directory.
15
# LP_SHARED_REPO  - Your Launchpad shared repository directory.  All of your
16
#                   Launchpad development branches will live under here.
17
# LP_TRUNK_NAME   - The directory name (not path!) to your rocketfuel trunk
18
#                   mirror directory.  This is relative to your shared repo.
19
# LP_SOURCEDEPS_DIR - The name of the directory (not path!) where your
20
#                   trunk sourcecode will be placed.  This is relative to your
21
#                   LP_PROJECT_ROOT and should /not/ have the 'sourcecode'
22
#                   path appended to it, since this is automatically added by
23
#                   the scripts.
24
25
LP_PROJECT_ROOT=\${LP_PROJECT_ROOT:=~/canonical}
26
LP_SHARED_REPO=\${LP_SHARED_REPO:=lp-branches}
27
LP_PROJECT_PATH=\$LP_PROJECT_ROOT/\$LP_SHARED_REPO
28
LP_TRUNK_NAME=\${LP_TRUNK_NAME:=trunk}
29
LP_TRUNK_PATH=\$LP_PROJECT_PATH/\$LP_TRUNK_NAME
30
31
LP_SOURCEDEPS_DIR=\${LP_SOURCEDEPS_DIR:=lp-sourcedeps}
32
LP_SOURCEDEPS_PATH=\$LP_PROJECT_ROOT/\$LP_SOURCEDEPS_DIR/sourcecode
33
34
# Force tilde expansion
35
LP_SOURCEDEPS_PATH=\$(eval echo \${LP_SOURCEDEPS_PATH})
6673.1.3 by Barry Warsaw
Use $HOME instead of ~
36
" > "$HOME/.rocketfuel-env.sh"
6673.1.1 by Barry Warsaw
Write rocketfuel-env.sh if it doesn't exist. Allows RocketFuelSetup
37
fi
38
6673.1.3 by Barry Warsaw
Use $HOME instead of ~
39
source "$HOME/.rocketfuel-env.sh"
6673.1.5 by Barry Warsaw
Respond to Edwin's review.
40
if [ "$?" != 0 ]; then
41
    echo "Something went wrong with rocketfuel-setup!"
42
    exit 1
43
fi
6567.1.2 by Barry Warsaw
Parameterized most paths so this script is more useful to everyone.
44
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
45
# load up Ubuntu release details so we know which repos to enable
46
source /etc/lsb-release
47
48
# Establish Canonical username
49
whoami=`whoami`
50
printf "What is your username on Canonical servers? [$whoami] "
51
read canusrname
52
if [ ! -z ${canusrname} ]; then
53
  whoami=${canusrname};
54
fi
55
56
# Test that we can access Canonical servers
57
ssh ${whoami}@chinstrap.canonical.com pwd > /dev/null
58
if [ $? -ne 0 ]; then
59
  echo "
60
ERROR: Unable to login to chinstrap, please check your Canonical account
61
details.
62
"
63
  exit 1
64
fi
65
66
# Make sure you have all the needed virtual hosts
67
68
dev_host() {
6979.1.5 by Curtis Hovey
Added id.launchpad.net to /etc/hosts. Updated the matching rules to check for the
69
  grep -q "^127.0.0.88.* ${hostname}" /etc/hosts
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
70
  if [ $? -ne 0 ]; then
71
    sudo sed -i "s/^127.0.0.88.*$/&\ ${hostname}/" /etc/hosts
72
    echo "${hostname} added to /etc/hosts"
73
  fi
74
  }
75
76
grep -q "^127.0.0.88" /etc/hosts
77
if [ $? -ne 0 ]; then
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
78
  echo "Adding development hosts on local machine"
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
79
  echo "
80
# Launchpad virtual domains. This should be on one line.
81
127.0.0.88      launchpad.dev
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
82
" | sudo tee -a /etc/hosts > /dev/null
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
83
  echo "launchpad.dev added to /etc/hosts"
84
fi
85
6673.1.5 by Barry Warsaw
Respond to Edwin's review.
86
declare -a hostnames
87
hostnames=$(cat <<EOF
88
    answers.launchpad.dev
89
    api.launchpad.dev
90
    bazaar.launchpad.dev
91
    beta.launchpad.dev
92
    blueprints.launchpad.dev
93
    bugs.launchpad.dev
94
    code.launchpad.dev
95
    feeds.launchpad.dev
6979.1.5 by Curtis Hovey
Added id.launchpad.net to /etc/hosts. Updated the matching rules to check for the
96
    id.launchpad.dev
6673.1.5 by Barry Warsaw
Respond to Edwin's review.
97
    openid.launchpad.dev
98
    shipit.edubuntu.dev
99
    shipit.kubuntu.dev
100
    shipit.ubuntu.dev
101
    translations.launchpad.dev
102
    xmlrpc-private.launchpad.dev
103
    xmlrpc.launchpad.dev
104
EOF
105
    )
106
107
for hostname in $hostnames; do
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
108
  dev_host;
109
done
110
111
# Enable relevant Ubuntu package repositories
112
grep -q "^deb http:.* ${DISTRIB_CODENAME} .*universe" /etc/apt/sources.list
113
if [ $? -ne 0 ]; then
114
    echo "Please enable the 'universe' component in /etc/apt/source.list'"
115
    exit 1
116
fi
117
grep -q "^deb http:.* ${DISTRIB_CODENAME} .*multiverse" /etc/apt/sources.list
118
if [ $? -ne 0 ]; then
119
    echo "Please enable the 'multiverse' component in /etc/apt/source.list'"
120
    exit 1
121
fi
122
123
if [ ! -e ~/.ssh/config ]; then
124
    touch ~/.ssh/config
125
fi
126
4419.4.7 by Tom Berger
check whether the user already has GSSAPIAuthentication in the .ssh/config before prompting them to configure it
127
grep -q "^GSSAPIAuthentication" ~/.ssh/config
128
if [ $? -ne 0 ]; then
129
  echo "Please add the following directive to your ~/.ssh/config:
4419.4.3 by Tom Berger
tell the user to not use GSSAPIAuthentication for speedy connection to devpad
130
------------------------------------------------------------
131
GSSAPIAuthentication no
132
------------------------------------------------------------
133
"
4419.4.7 by Tom Berger
check whether the user already has GSSAPIAuthentication in the .ssh/config before prompting them to configure it
134
  read
135
fi
4419.4.3 by Tom Berger
tell the user to not use GSSAPIAuthentication for speedy connection to devpad
136
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
137
grep -q "^Host .*chinstrap" ~/.ssh/config
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
138
if [ $? -ne 0 ]; then
4419.4.1 by Tom Berger
Instead of modifying .ssh/config, ask the user to make the modifications
139
  echo "Please add the following directives to your ~/.ssh/config:
140
------------------------------------------------------------
141
Host chinstrap chinstrap.canonical.com chinstrap.ubuntu.com
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
142
    ForwardAgent yes
143
    Hostname chinstrap.canonical.com
144
    ProxyCommand none
145
    User ${whoami}
4419.4.1 by Tom Berger
Instead of modifying .ssh/config, ask the user to make the modifications
146
------------------------------------------------------------
147
"
4419.4.2 by Tom Berger
formatting: indentation
148
  read
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
149
fi
150
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
151
grep -q "^Host.*\*\.canonical.com" ~/.ssh/config
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
152
if [ $? -ne 0 ]; then
4419.4.1 by Tom Berger
Instead of modifying .ssh/config, ask the user to make the modifications
153
  echo "Please add the following directives to your ~/.ssh/config:
154
------------------------------------------------------------
155
Host *.canonical.com *.ubuntu.com
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
156
    ForwardAgent yes
157
    ProxyCommand ssh chinstrap.canonical.com nc -q0 %h %p
158
    User ${whoami}
4419.4.1 by Tom Berger
Instead of modifying .ssh/config, ask the user to make the modifications
159
------------------------------------------------------------
160
"
4419.4.2 by Tom Berger
formatting: indentation
161
  read
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
162
fi
163
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
164
grep -q "^Host .*devpad" ~/.ssh/config
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
165
if [ $? -ne 0 ]; then
4419.4.1 by Tom Berger
Instead of modifying .ssh/config, ask the user to make the modifications
166
  echo "Please add the following directives to your ~/.ssh/config:
167
------------------------------------------------------------
168
Host devpad devpad.canonical.com
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
169
    ForwardAgent yes
170
    Hostname devpad.canonical.com
171
    ProxyCommand ssh chinstrap.canonical.com nc -q0 %h %p
172
    User ${whoami}
4419.4.1 by Tom Berger
Instead of modifying .ssh/config, ask the user to make the modifications
173
------------------------------------------------------------
174
"
4419.4.2 by Tom Berger
formatting: indentation
175
  read
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
176
fi
177
4317.1.5 by Mark Shuttleworth
Also setup ssh access to bazaar.launchpad.dev
178
grep -q "^Host .*bazaar.launchpad.dev" ~/.ssh/config
179
if [ $? -ne 0 ]; then
4419.4.1 by Tom Berger
Instead of modifying .ssh/config, ask the user to make the modifications
180
  echo "Please add the following directives to your ~/.ssh/config:
181
------------------------------------------------------------
182
Host bazaar.launchpad.dev
5601.1.1 by Diogo Matsubara
Update utilities/rocketfuel-setup .ssh/config setting to use launchpad.dev instead of localhost.
183
    Hostname launchpad.dev
4317.1.5 by Mark Shuttleworth
Also setup ssh access to bazaar.launchpad.dev
184
    HostKeyAlias bazaar.launchpad.dev
185
    User sabdfl
186
    Port 5022
187
    IdentityFile ~/.ssh/launchpad_id_dsa
4419.4.1 by Tom Berger
Instead of modifying .ssh/config, ask the user to make the modifications
188
------------------------------------------------------------
189
"
4419.4.2 by Tom Berger
formatting: indentation
190
  read
4317.1.5 by Mark Shuttleworth
Also setup ssh access to bazaar.launchpad.dev
191
fi
192
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
193
echo "Testing ssh to devpad..."
194
ssh devpad.canonical.com pwd > /dev/null
195
if [ $? -ne 0 ]; then
196
  echo "
197
ERROR: Unable to verify capability to ssh to devpad. Please check
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
198
~/.ssh/config and check the User configuration item.  ['${whoami}']"
199
  exit 1
200
fi
201
202
sudo apt-key list | grep -q "2048g/CA6E8A17"
203
if [ $? -ne 0 ]; then
204
  echo "Retrieving signing-key for LP package repository."
205
  scp devpad.canonical.com:/code/lp-maintainers.pub /tmp/
206
  if [ $? -ne 0 ]; then
207
    echo "Unable to fetch key for LP package repository"
208
    exit 1
209
  fi
210
  [ `sha1sum /tmp/lp-maintainers.pub | cut -d " " -f 1` = \
211
     f1714a57bd8c481f45b2a64e2eb9131176c8922e ] \
212
  && sudo apt-key add /tmp/lp-maintainers.pub
213
  if [ $? -ne 0 ]; then
214
    echo "Unable to add key for LP package repository"
215
    exit 1
216
  fi
217
fi
218
219
220
grep -q "^deb http://lpdebs.canonical.com/" /etc/apt/sources.list
221
if [ $? -ne 0 ]; then
222
  echo "Adding LP package respository to package source list."
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
223
  echo "deb http://lpdebs.canonical.com/${DISTRIB_CODENAME} ./" | sudo tee -a /etc/apt/sources.list > /dev/null
224
  sudo aptitude update
225
fi
226
227
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
228
dpkg -s launchpad-developer-dependencies | grep -q "^Status:.*installed"
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
229
if [ $? -ne 0 ]; then
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
230
  echo "Installing launchpad-developer-dependencies package..."
231
  sudo aptitude install launchpad-developer-dependencies
232
  if [ $? -ne 0 ]; then
233
    echo "Unable to install LP developer dependencies"
234
    exit 1
235
  fi
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
236
fi
237
4706.2.19 by Jonathan Lange
Make the mirrors directory in rocketfuel-setup.
238
# Create the document root to avoid Apache warnings
6206.1.1 by Tim Penhey
Update development location changes.
239
mkdir -p /var/tmp/bazaar.launchpad.dev/mirrors
4706.2.19 by Jonathan Lange
Make the mirrors directory in rocketfuel-setup.
240
4706.2.17 by Jonathan Lange
Merge RF, and create empty rewrite map file in rocketfuel-setup.
241
# Create an empty rewritemap file so that Apache will start.
6206.1.1 by Tim Penhey
Update development location changes.
242
mkdir -p /var/tmp/bazaar.launchpad.dev/config
243
touch /var/tmp/bazaar.launchpad.dev/config/launchpad-lookup.txt
4706.2.17 by Jonathan Lange
Merge RF, and create empty rewrite map file in rocketfuel-setup.
244
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
245
sudo a2enmod proxy > /dev/null
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
246
if [ $? -ne 0 ]; then
247
  echo "ERROR: Unable to enable proxy module in Apache2"
248
  exit 1
249
fi
250
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
251
sudo a2enmod proxy_http > /dev/null
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
252
if [ $? -ne 0 ]; then
253
  echo "ERROR: Unable to enable proxy_http module in Apache2"
254
  exit 1
255
fi
256
4706.2.9 by Jonathan Lange
Update the documentation and add bazaar.launchpad.dev setup to rocketfuel-setup.
257
sudo a2enmod rewrite > /dev/null
258
if [ $? -ne 0 ]; then
259
  echo "ERROR: Unable to enable rewrite module in Apache2"
260
  exit 1
261
fi
262
6991.1.1 by Guilherme Salgado
Serve *.launchpad.dev through https
263
sudo a2enmod ssl > /dev/null
264
if [ $? -ne 0 ]; then
265
  echo "ERROR: Unable to enable ssl module in Apache2"
266
  exit 1
267
fi
268
7140.7.2 by Celso Providelo
Adjust rocketfuel-setup and development apache configuration to use mod_deflate.
269
sudo a2enmod deflate > /dev/null
270
if [ $? -ne 0 ]; then
271
  echo "ERROR: Unable to enable deflate module in Apache2"
272
  exit 1
273
fi
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
274
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
275
echo "Setting up devpad repository..."
4920.2.13 by Mark Shuttleworth
Add rocketfuel-push script and make rocketfuel-setup aware of it
276
ssh devpad.canonical.com /code/rocketfuel-built/launchpad/utilities/devpad-setup
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
277
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
278
279
# Create the local branch structure we will use for managing Launchpad code
6567.1.2 by Barry Warsaw
Parameterized most paths so this script is more useful to everyone.
280
mkdir -p $LP_PROJECT_ROOT
281
cd $LP_PROJECT_ROOT
6567.2.2 by Barry Warsaw
Respond to review comments.
282
if [ ! -d $LP_SHARED_REPO ]; then
283
  bzr init-repo --trees $LP_SHARED_REPO
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
284
  if [ $? -ne 0 ]; then
285
    echo "ERROR: Unable to setup local LP repository"
286
    exit 1
287
  fi
288
fi
6567.2.2 by Barry Warsaw
Respond to review comments.
289
if [ ! -d $LP_SHARED_REPO/.bzr -a -d $LP_SHARED_REPO/.bzr/repository ]; then
6567.1.2 by Barry Warsaw
Parameterized most paths so this script is more useful to everyone.
290
  echo "ERROR: LP repository not found in $LP_PROJECT_PATH"
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
291
  exit 1
292
fi
293
6567.2.2 by Barry Warsaw
Respond to review comments.
294
cd $LP_SHARED_REPO
6567.1.4 by Barry Warsaw
Last minute patch and whitespace normalization.
295
if [ ! -d $LP_TRUNK_NAME ]; then
296
  echo "Making local branch of Launchpad trunk, this may take a while..."
6567.1.3 by Barry Warsaw
parameterize all paths so that launchpad code can live anywhere.
297
  # bzr up to 1.6b2 has a bug that causes this to oom.
298
  #bzr branch bzr+ssh://devpad.canonical.com/code/rocketfuel/launchpad/devel $LP_TRUNK_NAME
299
  bzr branch sftp://devpad.canonical.com/code/rocketfuel/launchpad/devel $LP_TRUNK_NAME
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
300
  if [ $? -ne 0 ]; then
301
    echo "ERROR: Unable to create local copy of Rocketfuel trunk"
302
    exit 1
303
  fi
304
fi
305
6567.1.4 by Barry Warsaw
Last minute patch and whitespace normalization.
306
cd $LP_TRUNK_NAME
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
307
if [ ! `bzr info | grep -i "parent branch" | cut -d: -f3` = \
308
  "//devpad.canonical.com/code/rocketfuel/launchpad/devel/" ]; then
6567.1.2 by Barry Warsaw
Parameterized most paths so this script is more useful to everyone.
309
  echo "ERROR: Your trunk branch in $LP_TRUNK_PATH has an
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
310
       incorrect pull location, correcting now..."
311
  bzr pull --remember bzr+ssh://devpad.canonical.com/code/rocketfuel/launchpad/devel
312
  if [ $? -ne 0 ]; then
313
    echo "ERROR: Unable to set trunk pull location to
314
       bzr+ssh://devpad.canonical.com/code/rocketfuel/launchpad/devel"
315
    exit 1
316
  fi
317
fi
318
5543.3.2 by Tim Penhey
Alterations to the way codebrowse is started, and updating rocketfuel-setup
319
sudo make install > /dev/null
320
if [ $? -ne 0 ]; then
321
  echo "ERROR: Unable to install apache config appropriately"
322
  exit 1
323
fi
324
325
326
4317.1.3 by Mark Shuttleworth
Also fixup ~/.bazaar/locations.conf
327
# Setup Bazaar locations configuration
4958.2.3 by Mark Shuttleworth
Make rf-setup create ~/.bazaar if needed
328
if [ ! -d ~/.bazaar ]; then
329
  mkdir ~/.bazaar
330
  if [ $? -ne 0 ]; then
331
    echo "Unable to create ~/.bazaar/ directory"
332
    exit 1
333
  fi
334
fi
4317.1.3 by Mark Shuttleworth
Also fixup ~/.bazaar/locations.conf
335
if [ ! -e ~/.bazaar/locations.conf ]; then
336
  touch ~/.bazaar/locations.conf
337
fi
6666.1.2 by Brad Crittenden
Simplified the setting for locations.conf
338
grep -q "\[${LP_PROJECT_PATH}\]" ~/.bazaar/locations.conf
4317.1.3 by Mark Shuttleworth
Also fixup ~/.bazaar/locations.conf
339
if [ $? -ne 0 ]; then
4317.1.6 by Mark Shuttleworth
Make sure new stanza in ~/.bazaar/locations.conf starts on its own line
340
  echo "
6666.1.2 by Brad Crittenden
Simplified the setting for locations.conf
341
[$LP_PROJECT_PATH]
4920.2.15 by Mark Shuttleworth
Update to new PQM email address for LP
342
pqm_email = Launchpad PQM <launchpad@pqm.canonical.com>
6666.1.1 by Brad Crittenden
Changes to locations.conf to match RocketFuelSetupDetails
343
submit_branch = ${LP_TRUNK_PATH}
4317.1.3 by Mark Shuttleworth
Also fixup ~/.bazaar/locations.conf
344
public_branch = bzr+ssh://devpad.canonical.com/code/${whoami}/launchpad
345
public_branch:policy = appendpath
346
smtp_server = localhost
347
push_location = bzr+ssh://devpad.canonical.com/code/${whoami}/launchpad
4317.1.6 by Mark Shuttleworth
Make sure new stanza in ~/.bazaar/locations.conf starts on its own line
348
push_location:policy = appendpath
6666.1.1 by Brad Crittenden
Changes to locations.conf to match RocketFuelSetupDetails
349
review_list = Launchpad Reviews <launchpad-reviews@lists.canonical.com>
6666.1.2 by Brad Crittenden
Simplified the setting for locations.conf
350
merge_target = ${LP_TRUNK_PATH}" | tee -a ~/.bazaar/locations.conf > /dev/null
4317.1.3 by Mark Shuttleworth
Also fixup ~/.bazaar/locations.conf
351
  echo "Bazaar branch configuration updated. You may need to set smtp_server
352
in ~/.bazaar/locations.conf to something other than localhost"
353
fi
354
6666.1.1 by Brad Crittenden
Changes to locations.conf to match RocketFuelSetupDetails
355
grep -q "\[$LP_TRUNK_PATH\]" ~/.bazaar/locations.conf
356
if [ $? -ne 0 ]; then
357
  echo "
358
[$LP_TRUNK_PATH]
6556.3.34 by Brad Crittenden
Fixed public_branch to use sftp URL
359
public_branch = sftp://devpad.canonical.com/code/rocketfuel/launchpad/devel\
6666.1.1 by Brad Crittenden
Changes to locations.conf to match RocketFuelSetupDetails
360
" | tee -a ~/.bazaar/locations.conf > /dev/null
361
fi
362
4317.1.5 by Mark Shuttleworth
Also setup ssh access to bazaar.launchpad.dev
363
# Setup access to the local supermirror
364
if [ ! -e ~/.ssh/launchpad_id_dsa ]; then
6567.1.2 by Barry Warsaw
Parameterized most paths so this script is more useful to everyone.
365
  cp $LP_TRUNK_PATH/lib/canonical/codehosting/tests/id_dsa ~/.ssh/launchpad_id_dsa
4317.1.5 by Mark Shuttleworth
Also setup ssh access to bazaar.launchpad.dev
366
  chmod 600 ~/.ssh/launchpad_id_dsa
367
  echo "Setup ssh key for local supermirror ssh access."
368
fi
369
6673.1.2 by Barry Warsaw
Put rocketfuel-env.sh into ~/.rocketfuel-env.sh to avoid write permission
370
# Setup environment variables in a ~ dot file
6673.1.3 by Barry Warsaw
Use $HOME instead of ~
371
cd $HOME
372
if [ ! -e $HOME/.rocketfuel-env.sh ]; then
6673.1.2 by Barry Warsaw
Put rocketfuel-env.sh into ~/.rocketfuel-env.sh to avoid write permission
373
  ln -s $LP_TRUNK_PATH/utilities/rocketfuel-env.sh .rocketfuel-env.sh
374
fi
375
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
376
# Setup scripts in /usr/local/bin
377
cd /usr/local/bin
378
if [ ! -e rocketfuel-get ]; then
6567.1.2 by Barry Warsaw
Parameterized most paths so this script is more useful to everyone.
379
  sudo ln -s $LP_TRUNK_PATH/utilities/rocketfuel-get
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
380
fi
6567.1.2 by Barry Warsaw
Parameterized most paths so this script is more useful to everyone.
381
ls -l rocketfuel-get | cut -d">" -f2 | grep -q "$LP_TRUNK_NAME\/utilities\/rocketfuel"
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
382
if [ $? -ne 0 ]; then
383
  echo "WARNING: /usr/local/bin/rocketfuel-get should be deleted so I can
384
         recreate it."
385
fi
5323.2.1 by Mark Shuttleworth
Manage featured projects in the db
386
if [ ! -e rocketfuel-flakes ]; then
6567.1.2 by Barry Warsaw
Parameterized most paths so this script is more useful to everyone.
387
  sudo ln -s $LP_TRUNK_PATH/utilities/rocketfuel-flakes
5323.2.1 by Mark Shuttleworth
Manage featured projects in the db
388
fi
6567.1.2 by Barry Warsaw
Parameterized most paths so this script is more useful to everyone.
389
ls -l rocketfuel-flakes | cut -d">" -f2 | grep -q "$LP_TRUNK_NAME\/utilities\/rocketfuel"
5323.2.1 by Mark Shuttleworth
Manage featured projects in the db
390
if [ $? -ne 0 ]; then
391
  echo "WARNING: /usr/local/bin/rocketfuel-flakes should be deleted so I can
392
         recreate it."
393
fi
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
394
if [ ! -e rocketfuel-branch ]; then
6567.1.2 by Barry Warsaw
Parameterized most paths so this script is more useful to everyone.
395
  sudo ln -s $LP_TRUNK_PATH/utilities/rocketfuel-branch
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
396
fi
6567.1.2 by Barry Warsaw
Parameterized most paths so this script is more useful to everyone.
397
ls -l rocketfuel-branch | cut -d">" -f2 | grep -q "$LP_TRUNK_NAME\/utilities\/rocketfuel"
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
398
if [ $? -ne 0 ]; then
399
  echo "WARNING: /usr/local/bin/rocketfuel-branch should be deleted so I can
400
         recreate it."
401
fi
402
if [ ! -e rocketfuel-setup ]; then
6567.1.2 by Barry Warsaw
Parameterized most paths so this script is more useful to everyone.
403
  sudo ln -s $LP_TRUNK_PATH/utilities/rocketfuel-setup
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
404
fi
6567.1.2 by Barry Warsaw
Parameterized most paths so this script is more useful to everyone.
405
ls -l rocketfuel-setup | cut -d">" -f2 | grep -q "$LP_TRUNK_NAME\/utilities\/rocketfuel"
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
406
if [ $? -ne 0 ]; then
407
  echo "WARNING: /usr/local/bin/rocketfuel-setup should be deleted so I can
408
         recreate it."
409
fi
4343.1.3 by Mark Shuttleworth
Add symlink for rocketfuel-status
410
if [ ! -e rocketfuel-status ]; then
6567.1.2 by Barry Warsaw
Parameterized most paths so this script is more useful to everyone.
411
  sudo ln -s $LP_TRUNK_PATH/utilities/rocketfuel-status
4343.1.3 by Mark Shuttleworth
Add symlink for rocketfuel-status
412
fi
6567.1.2 by Barry Warsaw
Parameterized most paths so this script is more useful to everyone.
413
ls -l rocketfuel-status | cut -d">" -f2 | grep -q "$LP_TRUNK_NAME\/utilities\/rocketfuel"
4343.1.3 by Mark Shuttleworth
Add symlink for rocketfuel-status
414
if [ $? -ne 0 ]; then
415
  echo "WARNING: /usr/local/bin/rocketfuel-status should be deleted so I can
416
         recreate it."
417
fi
4920.2.13 by Mark Shuttleworth
Add rocketfuel-push script and make rocketfuel-setup aware of it
418
if [ ! -e rocketfuel-push ]; then
6567.1.2 by Barry Warsaw
Parameterized most paths so this script is more useful to everyone.
419
  sudo ln -s $LP_TRUNK_PATH/utilities/rocketfuel-push
4920.2.13 by Mark Shuttleworth
Add rocketfuel-push script and make rocketfuel-setup aware of it
420
fi
6567.1.2 by Barry Warsaw
Parameterized most paths so this script is more useful to everyone.
421
ls -l rocketfuel-push | cut -d">" -f2 | grep -q "$LP_TRUNK_NAME\/utilities\/rocketfuel"
4920.2.13 by Mark Shuttleworth
Add rocketfuel-push script and make rocketfuel-setup aware of it
422
if [ $? -ne 0 ]; then
423
  echo "WARNING: /usr/local/bin/rocketfuel-push should be deleted so I can
424
         recreate it."
425
fi
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
426
427
428
# Make sure we have all the right code in place for source dependencies
429
/usr/local/bin/rocketfuel-get
430
4317.1.5 by Mark Shuttleworth
Also setup ssh access to bazaar.launchpad.dev
431
echo "
432
Thank you for using this script. You can improve it for everyone by
433
committing changes to LP in utilities/rocketfuel-setup.
434
4920.2.13 by Mark Shuttleworth
Add rocketfuel-push script and make rocketfuel-setup aware of it
435
You should use the following commands to manage your Rocketfuel:
436
437
 rocketfuel-get
438
    Update your copy of trunk and the necessary source dependencies, and
439
    make sure all source dependencies are properly linked in to all the
440
    branches you are working on.
6567.1.3 by Barry Warsaw
parameterize all paths so that launchpad code can live anywhere.
441
442
 rocketfuel-branch foo
443
    Create a new branch of LP called "foo" in $LP_PROJECT_PATH/foo,
444
    with all the source dependencies properly linked in.
4920.2.13 by Mark Shuttleworth
Add rocketfuel-push script and make rocketfuel-setup aware of it
445
446
 rocketfuel-status
6567.1.3 by Barry Warsaw
parameterize all paths so that launchpad code can live anywhere.
447
    Check each of the branches in $LP_PROJECT_PATH and show which of them have
448
    uncommitted changes, also check which ones have revisions that have not
449
    yet landed on trunk.
4920.2.13 by Mark Shuttleworth
Add rocketfuel-push script and make rocketfuel-setup aware of it
450
451
 rocketfuel-push
452
    Push all of your branches to devpad, so that you have a server-side
453
    backup of everything.
4317.1.5 by Mark Shuttleworth
Also setup ssh access to bazaar.launchpad.dev
454
455
Happy hacking!
456
"