4317.1.1
by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP |
1 |
#! /bin/bash
|
8452.3.3
by Karl Fogel
* utilities/: Add copyright header block to source files that were |
2 |
#
|
8687.15.2
by Karl Fogel
In files modified by r8688, change "<YEARS>" to "2009", as per |
3 |
# Copyright 2009 Canonical Ltd. This software is licensed under the
|
8687.15.3
by Karl Fogel
Shorten the copyright header block to two lines. |
4 |
# GNU Affero General Public License version 3 (see the file LICENSE).
|
8452.3.3
by Karl Fogel
* utilities/: Add copyright header block to source files that were |
5 |
#
|
8931.1.4
by Karl Fogel
* utilities/rocketfuel-setup: Tell the user to hit Return after |
6 |
# This script will set up a brand new Ubuntu machine as a LP developer
|
4317.1.1
by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP |
7 |
# workstation, from scratch. The script lives in the LP codebase itself,
|
8 |
# as utilities/rocketfuel-setup
|
|
9 |
||
8687.14.2
by Karl Fogel
In rocketfuel-setup, bail early if not running with Bazaar 1.16.1 or higher. |
10 |
# We require Bazaar 1.16.1 or higher.
|
11 |
# So first, grab the output of 'bzr --version' and transform the
|
|
12 |
# version line, like "Bazaar (bzr) 1.16.1", into "1 16 1":
|
|
13 |
VER_NUMS=`bzr --version | head -1 | sed -e 's/[^.0-9]//g' | sed -e 's/[.]/ /g'` |
|
14 |
# Now stuff each component into its own variable, so we can check sanely.
|
|
15 |
MAJOR=0 |
|
16 |
MINOR=0 |
|
17 |
MICRO=0 |
|
18 |
ITER=0 |
|
19 |
for VER_COMPONENT in ${VER_NUMS}; do |
|
20 |
if [ ${ITER} -eq 0 ]; then |
|
21 |
MAJOR=${VER_COMPONENT} |
|
22 |
elif [ ${ITER} -eq 1 ]; then |
|
23 |
MINOR=${VER_COMPONENT} |
|
24 |
elif [ ${ITER} -eq 2 ]; then |
|
25 |
MICRO=${VER_COMPONENT} |
|
26 |
# Ignore anything beyond micro -- nanoversions are irrelevant here.
|
|
27 |
fi
|
|
28 |
ITER=`expr ${ITER} + 1` |
|
29 |
done
|
|
30 |
# Check that the version is high enough.
|
|
31 |
BAZAAR_BAIL=0 |
|
32 |
if [ ${MAJOR} -lt 1 ]; then |
|
33 |
BAZAAR_BAIL=1 |
|
34 |
elif [ ${MINOR} -lt 16 ]; then |
|
35 |
BAZAAR_BAIL=1 |
|
36 |
elif [ ${MINOR} -eq 16 -a ${MICRO} -lt 1 ]; then |
|
37 |
BAZAAR_BAIL=1 |
|
38 |
fi
|
|
39 |
if [ ${BAZAAR_BAIL} -ne 0 ]; then |
|
40 |
echo "ERROR: You don't have a high enough version of Bazaar:" |
|
41 |
echo " rocketfuel-setup requires bzr 1.16.1 or higher, but you have bzr ${MAJOR}.${MINOR}.${MICRO}." |
|
42 |
echo " Please see http://bazaar-vcs.org/Download to get a newer version." |
|
43 |
exit 1 |
|
44 |
fi
|
|
45 |
||
6673.1.3
by Barry Warsaw
Use $HOME instead of ~ |
46 |
if [ ! -e "$HOME/.rocketfuel-env.sh" ]; then |
6673.1.1
by Barry Warsaw
Write rocketfuel-env.sh if it doesn't exist. Allows RocketFuelSetup |
47 |
echo "# Common environment variables for the rocketfuel-* scripts. |
48 |
#
|
|
49 |
# The ones you can set are:
|
|
50 |
#
|
|
8931.1.1
by Karl Fogel
Use more appropriate defaults for LP_PROJECT_ROOT and LP_TRUNK_NAME. |
51 |
# LP_PROJECT_ROOT - The root directory of all your Launchpad stuff. Your
|
6673.1.1
by Barry Warsaw
Write rocketfuel-env.sh if it doesn't exist. Allows RocketFuelSetup |
52 |
# Launchpad shared repository will live in a child directory
|
53 |
# of this directory.
|
|
54 |
# LP_SHARED_REPO - Your Launchpad shared repository directory. All of your
|
|
55 |
# Launchpad development branches will live under here.
|
|
56 |
# LP_TRUNK_NAME - The directory name (not path!) to your rocketfuel trunk
|
|
57 |
# mirror directory. This is relative to your shared repo.
|
|
58 |
# LP_SOURCEDEPS_DIR - The name of the directory (not path!) where your
|
|
59 |
# trunk sourcecode will be placed. This is relative to your
|
|
60 |
# LP_PROJECT_ROOT and should /not/ have the 'sourcecode'
|
|
61 |
# path appended to it, since this is automatically added by
|
|
62 |
# the scripts.
|
|
63 |
||
8931.1.1
by Karl Fogel
Use more appropriate defaults for LP_PROJECT_ROOT and LP_TRUNK_NAME. |
64 |
LP_PROJECT_ROOT=\${LP_PROJECT_ROOT:=~/launchpad}
|
6673.1.1
by Barry Warsaw
Write rocketfuel-env.sh if it doesn't exist. Allows RocketFuelSetup |
65 |
LP_SHARED_REPO=\${LP_SHARED_REPO:=lp-branches}
|
66 |
LP_PROJECT_PATH=\$LP_PROJECT_ROOT/\$LP_SHARED_REPO
|
|
8931.1.1
by Karl Fogel
Use more appropriate defaults for LP_PROJECT_ROOT and LP_TRUNK_NAME. |
67 |
LP_TRUNK_NAME=\${LP_TRUNK_NAME:=devel}
|
6673.1.1
by Barry Warsaw
Write rocketfuel-env.sh if it doesn't exist. Allows RocketFuelSetup |
68 |
LP_TRUNK_PATH=\$LP_PROJECT_PATH/\$LP_TRUNK_NAME
|
69 |
||
70 |
LP_SOURCEDEPS_DIR=\${LP_SOURCEDEPS_DIR:=lp-sourcedeps}
|
|
71 |
LP_SOURCEDEPS_PATH=\$LP_PROJECT_ROOT/\$LP_SOURCEDEPS_DIR/sourcecode
|
|
72 |
||
73 |
# Force tilde expansion
|
|
74 |
LP_SOURCEDEPS_PATH=\$(eval echo \${LP_SOURCEDEPS_PATH})
|
|
6673.1.3
by Barry Warsaw
Use $HOME instead of ~ |
75 |
" > "$HOME/.rocketfuel-env.sh" |
6673.1.1
by Barry Warsaw
Write rocketfuel-env.sh if it doesn't exist. Allows RocketFuelSetup |
76 |
fi
|
77 |
||
6673.1.3
by Barry Warsaw
Use $HOME instead of ~ |
78 |
source "$HOME/.rocketfuel-env.sh" |
6673.1.5
by Barry Warsaw
Respond to Edwin's review. |
79 |
if [ "$?" != 0 ]; then |
80 |
echo "Something went wrong with rocketfuel-setup!" |
|
81 |
exit 1 |
|
82 |
fi
|
|
6567.1.2
by Barry Warsaw
Parameterized most paths so this script is more useful to everyone. |
83 |
|
4317.1.1
by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP |
84 |
# load up Ubuntu release details so we know which repos to enable
|
85 |
source /etc/lsb-release
|
|
86 |
||
8486.13.2
by Curtis Hovey
Merge from launchpad devel. Reconciled devpad removals. |
87 |
# Establish LP username
|
4317.1.1
by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP |
88 |
whoami=`whoami` |
7426.1.1
by Julian Edwards
Tweak rocketfuel-setup so that: |
89 |
printf "What is your Launchpad username? [$whoami] " |
90 |
read lpusername
|
|
91 |
if [ -z ${lpusername} ]; then |
|
92 |
lpusername=${whoami} |
|
93 |
fi
|
|
94 |
||
4317.1.1
by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP |
95 |
# Make sure you have all the needed virtual hosts
|
96 |
||
97 |
dev_host() { |
|
6979.1.5
by Curtis Hovey
Added id.launchpad.net to /etc/hosts. Updated the matching rules to check for the |
98 |
grep -q "^127.0.0.88.* ${hostname}" /etc/hosts |
4317.1.1
by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP |
99 |
if [ $? -ne 0 ]; then |
100 |
sudo sed -i "s/^127.0.0.88.*$/&\ ${hostname}/" /etc/hosts |
|
101 |
echo "${hostname} added to /etc/hosts" |
|
102 |
fi
|
|
103 |
}
|
|
104 |
||
105 |
grep -q "^127.0.0.88" /etc/hosts
|
|
106 |
if [ $? -ne 0 ]; then |
|
4317.1.2
by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too |
107 |
echo "Adding development hosts on local machine" |
4317.1.1
by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP |
108 |
echo " |
109 |
# Launchpad virtual domains. This should be on one line.
|
|
110 |
127.0.0.88 launchpad.dev
|
|
4317.1.2
by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too |
111 |
" | sudo tee -a /etc/hosts > /dev/null |
4317.1.1
by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP |
112 |
echo "launchpad.dev added to /etc/hosts" |
113 |
fi
|
|
114 |
||
6673.1.5
by Barry Warsaw
Respond to Edwin's review. |
115 |
declare -a hostnames
|
116 |
hostnames=$(cat <<EOF |
|
117 |
answers.launchpad.dev
|
|
118 |
api.launchpad.dev
|
|
7459.5.21
by Michael Hudson
make security considerations much more obvious |
119 |
bazaar-internal.launchpad.dev
|
6673.1.5
by Barry Warsaw
Respond to Edwin's review. |
120 |
beta.launchpad.dev
|
121 |
blueprints.launchpad.dev
|
|
122 |
bugs.launchpad.dev
|
|
123 |
code.launchpad.dev
|
|
124 |
feeds.launchpad.dev
|
|
6979.1.5
by Curtis Hovey
Added id.launchpad.net to /etc/hosts. Updated the matching rules to check for the |
125 |
id.launchpad.dev
|
8687.11.1
by Karl Fogel
* utilities/rocketfuel-setup |
126 |
lists.launchpad.dev
|
6673.1.5
by Barry Warsaw
Respond to Edwin's review. |
127 |
openid.launchpad.dev
|
128 |
shipit.edubuntu.dev
|
|
129 |
shipit.kubuntu.dev
|
|
130 |
shipit.ubuntu.dev
|
|
131 |
translations.launchpad.dev
|
|
132 |
xmlrpc-private.launchpad.dev
|
|
133 |
xmlrpc.launchpad.dev
|
|
134 |
EOF
|
|
135 |
)
|
|
136 |
||
137 |
for hostname in $hostnames; do |
|
4317.1.1
by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP |
138 |
dev_host;
|
139 |
done
|
|
140 |
||
7551.3.11
by Michael Hudson
reasonably foul (but working!) apache config |
141 |
grep -q "^127.0.0.99" /etc/hosts
|
142 |
if [ $? -ne 0 ]; then |
|
143 |
echo " |
|
144 |
127.0.0.99 bazaar.launchpad.dev
|
|
145 |
" | sudo tee -a /etc/hosts > /dev/null |
|
146 |
echo "bazaar.launchpad.dev added to /etc/hosts" |
|
147 |
fi
|
|
148 |
||
4317.1.1
by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP |
149 |
# Enable relevant Ubuntu package repositories
|
150 |
grep -q "^deb http:.* ${DISTRIB_CODENAME} .*universe" /etc/apt/sources.list |
|
151 |
if [ $? -ne 0 ]; then |
|
152 |
echo "Please enable the 'universe' component in /etc/apt/source.list'" |
|
153 |
exit 1 |
|
154 |
fi
|
|
155 |
grep -q "^deb http:.* ${DISTRIB_CODENAME} .*multiverse" /etc/apt/sources.list |
|
156 |
if [ $? -ne 0 ]; then |
|
157 |
echo "Please enable the 'multiverse' component in /etc/apt/source.list'" |
|
158 |
exit 1 |
|
159 |
fi
|
|
160 |
||
161 |
if [ ! -e ~/.ssh/config ]; then |
|
162 |
touch ~/.ssh/config |
|
163 |
fi
|
|
164 |
||
7693.1.3
by Brad Crittenden
Changes due to review |
165 |
ssh_config_mod=0 |
4419.4.7
by Tom Berger
check whether the user already has GSSAPIAuthentication in the .ssh/config before prompting them to configure it |
166 |
grep -q "^GSSAPIAuthentication" ~/.ssh/config
|
167 |
if [ $? -ne 0 ]; then |
|
7693.1.3
by Brad Crittenden
Changes due to review |
168 |
ssh_config_mod=1 |
4419.4.7
by Tom Berger
check whether the user already has GSSAPIAuthentication in the .ssh/config before prompting them to configure it |
169 |
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 |
170 |
------------------------------------------------------------
|
171 |
GSSAPIAuthentication no
|
|
172 |
------------------------------------------------------------
|
|
7693.1.3
by Brad Crittenden
Changes due to review |
173 |
|
8931.1.4
by Karl Fogel
* utilities/rocketfuel-setup: Tell the user to hit Return after |
174 |
(Hit Return when done...)
|
7693.1.3
by Brad Crittenden
Changes due to review |
175 |
"
|
176 |
fi
|
|
177 |
if [ "$whoami" != "$lpusername" ]; then |
|
178 |
if [ "$ssh_config_mod" -ne "0" ] |
|
179 |
then
|
|
180 |
intro="Also ensure" |
|
181 |
else
|
|
182 |
ssh_config_mod=1 |
|
183 |
intro="Ensure" |
|
184 |
fi
|
|
185 |
echo "$intro the following directive is in your ~/.ssh/config: |
|
186 |
------------------------------------------------------------
|
|
187 |
Host bazaar.launchpad.net
|
|
188 |
User $lpusername |
|
189 |
------------------------------------------------------------
|
|
8931.1.4
by Karl Fogel
* utilities/rocketfuel-setup: Tell the user to hit Return after |
190 |
|
191 |
(Hit Return when done...)
|
|
7693.1.3
by Brad Crittenden
Changes due to review |
192 |
"
|
193 |
fi
|
|
194 |
||
195 |
if [ "$ssh_config_mod" -ne "0" ]; then |
|
4419.4.7
by Tom Berger
check whether the user already has GSSAPIAuthentication in the .ssh/config before prompting them to configure it |
196 |
read
|
197 |
fi
|
|
4419.4.3
by Tom Berger
tell the user to not use GSSAPIAuthentication for speedy connection to devpad |
198 |
|
4317.1.5
by Mark Shuttleworth
Also setup ssh access to bazaar.launchpad.dev |
199 |
grep -q "^Host .*bazaar.launchpad.dev" ~/.ssh/config
|
200 |
if [ $? -ne 0 ]; then |
|
4419.4.1
by Tom Berger
Instead of modifying .ssh/config, ask the user to make the modifications |
201 |
echo "Please add the following directives to your ~/.ssh/config: |
202 |
------------------------------------------------------------
|
|
203 |
Host bazaar.launchpad.dev
|
|
5601.1.1
by Diogo Matsubara
Update utilities/rocketfuel-setup .ssh/config setting to use launchpad.dev instead of localhost. |
204 |
Hostname launchpad.dev
|
4317.1.5
by Mark Shuttleworth
Also setup ssh access to bazaar.launchpad.dev |
205 |
HostKeyAlias bazaar.launchpad.dev
|
206 |
User sabdfl
|
|
207 |
Port 5022
|
|
208 |
IdentityFile ~/.ssh/launchpad_id_dsa
|
|
4419.4.1
by Tom Berger
Instead of modifying .ssh/config, ask the user to make the modifications |
209 |
------------------------------------------------------------
|
8931.1.4
by Karl Fogel
* utilities/rocketfuel-setup: Tell the user to hit Return after |
210 |
|
211 |
(Hit Return when done...)
|
|
4419.4.1
by Tom Berger
Instead of modifying .ssh/config, ask the user to make the modifications |
212 |
"
|
4419.4.2
by Tom Berger
formatting: indentation |
213 |
read
|
4317.1.5
by Mark Shuttleworth
Also setup ssh access to bazaar.launchpad.dev |
214 |
fi
|
215 |
||
7426.1.1
by Julian Edwards
Tweak rocketfuel-setup so that: |
216 |
# This is not strictly needed for bzr versions >= 1.9 but it's included
|
217 |
# here for backwards compatibility.
|
|
218 |
grep -q "^Host .*bazaar.launchpad.net" ~/.ssh/config
|
|
219 |
if [ $? -ne 0 ]; then |
|
220 |
echo "Please add the following directives to your ~/.ssh/config: |
|
221 |
------------------------------------------------------------
|
|
222 |
Host bazaar.launchpad.net
|
|
223 |
User ${lpusername} |
|
224 |
------------------------------------------------------------
|
|
8931.1.4
by Karl Fogel
* utilities/rocketfuel-setup: Tell the user to hit Return after |
225 |
|
226 |
(Hit Return when done...)
|
|
7426.1.1
by Julian Edwards
Tweak rocketfuel-setup so that: |
227 |
"
|
228 |
read
|
|
229 |
fi
|
|
230 |
||
231 |
||
232 |
LPDEV_SOURCES="/etc/apt/sources.list.d/launchpad-dev.list" |
|
233 |
if [ ! -e $LPDEV_SOURCES ]; then |
|
234 |
sudo touch $LPDEV_SOURCES
|
|
235 |
fi
|
|
4317.1.2
by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too |
236 |
|
7693.1.5
by Brad Crittenden
Merge from trunk. Fix RFS |
237 |
LP_PPA="deb http://ppa.launchpad.net/launchpad/ppa/ubuntu ${DISTRIB_CODENAME} main" |
238 |
grep -q "^${LP_PPA}" $LPDEV_SOURCES |
|
7693.1.1
by Brad Crittenden
Corrected GPG key for bzr, add apache2 to installed packages, add lp:~launchpad ppa key. |
239 |
if [ $? -ne 0 ]; then |
7693.1.3
by Brad Crittenden
Changes due to review |
240 |
echo "Adding ~launchpad PPA repository to package source list." |
7693.1.5
by Brad Crittenden
Merge from trunk. Fix RFS |
241 |
echo "$LP_PPA" | sudo tee -a $LPDEV_SOURCES |
7693.1.1
by Brad Crittenden
Corrected GPG key for bzr, add apache2 to installed packages, add lp:~launchpad ppa key. |
242 |
fi
|
243 |
||
7693.1.5
by Brad Crittenden
Merge from trunk. Fix RFS |
244 |
BZR_PPA="deb http://ppa.launchpad.net/bzr/ppa/ubuntu ${DISTRIB_CODENAME} main" |
245 |
grep -q "^${BZR_PPA}" $LPDEV_SOURCES |
|
7426.1.1
by Julian Edwards
Tweak rocketfuel-setup so that: |
246 |
if [ $? -ne 0 ]; then |
7693.1.3
by Brad Crittenden
Changes due to review |
247 |
echo "Adding ~bzr PPA repository to package source list." |
7693.1.5
by Brad Crittenden
Merge from trunk. Fix RFS |
248 |
echo "$BZR_PPA" | sudo tee -a $LPDEV_SOURCES |
7426.1.1
by Julian Edwards
Tweak rocketfuel-setup so that: |
249 |
fi
|
250 |
||
7598.6.2
by Brad Crittenden
Added LP signing key, moved some items to the default section of bazaar.conf |
251 |
# Get the key used to sign the launchpad-developer-dependencies in the PPA.
|
7693.1.1
by Brad Crittenden
Corrected GPG key for bzr, add apache2 to installed packages, add lp:~launchpad ppa key. |
252 |
REQUIRED_PPA_KEYS="0A5174AF 8C6C1EFD" |
7598.6.4
by Brad Crittenden
Added bzr PPA key and brought up-to-date with new apache local-launchpad settings. |
253 |
for key in $REQUIRED_PPA_KEYS; do |
254 |
sudo apt-key list | grep -q $key |
|
255 |
if [ $? -ne 0 ]; then |
|
256 |
echo "Retrieving key $key." |
|
257 |
gpg --keyserver keyserver.ubuntu.com --recv-keys $key
|
|
258 |
if [ $? -ne 0 ]; then |
|
259 |
echo "Could not retrieve key $key." |
|
260 |
exit 1 |
|
261 |
fi
|
|
262 |
gpg --export -a $key | sudo apt-key add - |
|
263 |
if [ $? -ne 0 ]; then |
|
264 |
echo "Could not install key $key." |
|
265 |
exit 1 |
|
266 |
fi
|
|
267 |
fi
|
|
268 |
done
|
|
7598.6.2
by Brad Crittenden
Added LP signing key, moved some items to the default section of bazaar.conf |
269 |
|
7693.1.1
by Brad Crittenden
Corrected GPG key for bzr, add apache2 to installed packages, add lp:~launchpad ppa key. |
270 |
do_install() { |
7693.1.3
by Brad Crittenden
Changes due to review |
271 |
dpkg -s $pkg | grep -q "^Status: install ok installed" |
7693.1.1
by Brad Crittenden
Corrected GPG key for bzr, add apache2 to installed packages, add lp:~launchpad ppa key. |
272 |
if [ $? -ne 0 ]; then |
273 |
echo "Installing $pkg package..." |
|
274 |
sudo aptitude install $pkg
|
|
275 |
if [ $? -ne 0 ]; then |
|
276 |
echo "Unable to install $pkg." |
|
277 |
exit 1 |
|
278 |
fi
|
|
279 |
fi
|
|
280 |
}
|
|
281 |
||
7426.1.1
by Julian Edwards
Tweak rocketfuel-setup so that: |
282 |
sudo aptitude update |
7693.1.5
by Brad Crittenden
Merge from trunk. Fix RFS |
283 |
REQUIRED_PACKAGES="launchpad-developer-dependencies apache2 apache2-mpm-worker" |
7693.1.1
by Brad Crittenden
Corrected GPG key for bzr, add apache2 to installed packages, add lp:~launchpad ppa key. |
284 |
for pkg in $REQUIRED_PACKAGES; do |
285 |
do_install;
|
|
286 |
done
|
|
4317.1.1
by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP |
287 |
|
7693.1.1
by Brad Crittenden
Corrected GPG key for bzr, add apache2 to installed packages, add lp:~launchpad ppa key. |
288 |
# Create the document root(s) to avoid Apache warnings
|
7598.6.4
by Brad Crittenden
Added bzr PPA key and brought up-to-date with new apache local-launchpad settings. |
289 |
mkdir -p /var/tmp/bazaar.launchpad.dev/static |
7693.1.1
by Brad Crittenden
Corrected GPG key for bzr, add apache2 to installed packages, add lp:~launchpad ppa key. |
290 |
mkdir -p /var/tmp/bazaar.launchpad.dev/mirrors |
4706.2.19
by Jonathan Lange
Make the mirrors directory in rocketfuel-setup. |
291 |
|
4317.1.2
by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too |
292 |
sudo a2enmod proxy > /dev/null |
4317.1.1
by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP |
293 |
if [ $? -ne 0 ]; then |
294 |
echo "ERROR: Unable to enable proxy module in Apache2" |
|
295 |
exit 1 |
|
296 |
fi
|
|
297 |
||
4317.1.2
by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too |
298 |
sudo a2enmod proxy_http > /dev/null |
4317.1.1
by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP |
299 |
if [ $? -ne 0 ]; then |
300 |
echo "ERROR: Unable to enable proxy_http module in Apache2" |
|
301 |
exit 1 |
|
302 |
fi
|
|
303 |
||
4706.2.9
by Jonathan Lange
Update the documentation and add bazaar.launchpad.dev setup to rocketfuel-setup. |
304 |
sudo a2enmod rewrite > /dev/null |
305 |
if [ $? -ne 0 ]; then |
|
306 |
echo "ERROR: Unable to enable rewrite module in Apache2" |
|
307 |
exit 1 |
|
308 |
fi
|
|
309 |
||
6991.1.1
by Guilherme Salgado
Serve *.launchpad.dev through https |
310 |
sudo a2enmod ssl > /dev/null |
311 |
if [ $? -ne 0 ]; then |
|
312 |
echo "ERROR: Unable to enable ssl module in Apache2" |
|
313 |
exit 1 |
|
314 |
fi
|
|
315 |
||
7140.7.2
by Celso Providelo
Adjust rocketfuel-setup and development apache configuration to use mod_deflate. |
316 |
sudo a2enmod deflate > /dev/null |
317 |
if [ $? -ne 0 ]; then |
|
318 |
echo "ERROR: Unable to enable deflate module in Apache2" |
|
319 |
exit 1 |
|
320 |
fi
|
|
4317.1.1
by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP |
321 |
|
7598.6.4
by Brad Crittenden
Added bzr PPA key and brought up-to-date with new apache local-launchpad settings. |
322 |
sudo a2enmod headers > /dev/null |
323 |
if [ $? -ne 0 ]; then |
|
324 |
echo "ERROR: Unable to enable headers module in Apache2" |
|
325 |
exit 1 |
|
326 |
fi
|
|
327 |
||
4317.1.2
by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too |
328 |
# 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. |
329 |
mkdir -p $LP_PROJECT_ROOT
|
330 |
cd $LP_PROJECT_ROOT |
|
6567.2.2
by Barry Warsaw
Respond to review comments. |
331 |
if [ ! -d $LP_SHARED_REPO ]; then |
8687.14.1
by Karl Fogel
In rocketfuel-setup, pass '--2a' instead of '--1.6' to 'bzr init-repo'. |
332 |
# 2a format (a.k.a. "brisbane-core") needed for stacking on Launchpad.
|
333 |
bzr init-repo --2a $LP_SHARED_REPO
|
|
4317.1.2
by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too |
334 |
if [ $? -ne 0 ]; then |
8931.1.4
by Karl Fogel
* utilities/rocketfuel-setup: Tell the user to hit Return after |
335 |
echo "ERROR: Unable to set up local LP repository" |
4317.1.2
by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too |
336 |
exit 1 |
337 |
fi
|
|
338 |
fi
|
|
6567.2.2
by Barry Warsaw
Respond to review comments. |
339 |
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. |
340 |
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 |
341 |
exit 1 |
342 |
fi
|
|
343 |
||
8931.1.5
by Karl Fogel
* utilities/rocketfuel-setup: Tell the user that a certain bzr warning |
344 |
echo "Logging bzr into Launchpad (it's okay if this errors)..." |
7426.1.1
by Julian Edwards
Tweak rocketfuel-setup so that: |
345 |
bzr launchpad-login $lpusername
|
8931.1.5
by Karl Fogel
* utilities/rocketfuel-setup: Tell the user that a certain bzr warning |
346 |
if [ $? -ne 0 ]; then |
347 |
echo "" |
|
348 |
echo "You can ignore any error above about not registering an SSH key" |
|
349 |
echo "with Launchpad. Registering an SSH key is only important if you" |
|
350 |
echo "are writing data to Launchpad, or trying to access private data." |
|
351 |
echo "" |
|
352 |
fi
|
|
7426.1.1
by Julian Edwards
Tweak rocketfuel-setup so that: |
353 |
|
6567.2.2
by Barry Warsaw
Respond to review comments. |
354 |
cd $LP_SHARED_REPO |
6567.1.4
by Barry Warsaw
Last minute patch and whitespace normalization. |
355 |
if [ ! -d $LP_TRUNK_NAME ]; then |
356 |
echo "Making local branch of Launchpad trunk, this may take a while..." |
|
8931.1.2
by Karl Fogel
Use "http://" instead of "bzr+ssh://" for the initial pull URL. |
357 |
# We use "http://" instead of "bzr+ssh://" for the initial pull
|
358 |
# because it's the long pulls that are hardest on the server. Once
|
|
359 |
# the bulk of the data is across, subsequent accesses can use
|
|
360 |
# bzr+ssh://, which will perform better.
|
|
361 |
bzr branch http://bazaar.launchpad.net/~launchpad-pqm/launchpad/devel/ $LP_TRUNK_NAME
|
|
4317.1.2
by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too |
362 |
if [ $? -ne 0 ]; then |
363 |
echo "ERROR: Unable to create local copy of Rocketfuel trunk" |
|
364 |
exit 1 |
|
365 |
fi
|
|
366 |
fi
|
|
367 |
||
6567.1.4
by Barry Warsaw
Last minute patch and whitespace normalization. |
368 |
cd $LP_TRUNK_NAME |
4317.1.2
by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too |
369 |
if [ ! `bzr info | grep -i "parent branch" | cut -d: -f3` = \ |
8931.1.4
by Karl Fogel
* utilities/rocketfuel-setup: Tell the user to hit Return after |
370 |
"//bazaar.launchpad.net/~launchpad-pqm/launchpad/devel/" ]; then |
6567.1.2
by Barry Warsaw
Parameterized most paths so this script is more useful to everyone. |
371 |
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 |
372 |
incorrect pull location, correcting now..."
|
7426.1.1
by Julian Edwards
Tweak rocketfuel-setup so that: |
373 |
bzr pull --remember bzr+ssh://bazaar.launchpad.net/~launchpad-pqm/launchpad/devel/ |
4317.1.2
by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too |
374 |
if [ $? -ne 0 ]; then |
7426.1.1
by Julian Edwards
Tweak rocketfuel-setup so that: |
375 |
echo "ERROR: Unable to set trunk pull location to lp:~launchpad-pqm/launchpad/devel/" |
4317.1.2
by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too |
376 |
exit 1 |
377 |
fi
|
|
378 |
fi
|
|
379 |
||
5543.3.2
by Tim Penhey
Alterations to the way codebrowse is started, and updating rocketfuel-setup |
380 |
sudo make install > /dev/null |
381 |
if [ $? -ne 0 ]; then |
|
382 |
echo "ERROR: Unable to install apache config appropriately" |
|
383 |
exit 1 |
|
384 |
fi
|
|
385 |
||
386 |
||
8931.1.4
by Karl Fogel
* utilities/rocketfuel-setup: Tell the user to hit Return after |
387 |
# Set up Bazaar locations configuration
|
4958.2.3
by Mark Shuttleworth
Make rf-setup create ~/.bazaar if needed |
388 |
if [ ! -d ~/.bazaar ]; then |
389 |
mkdir ~/.bazaar |
|
390 |
if [ $? -ne 0 ]; then |
|
391 |
echo "Unable to create ~/.bazaar/ directory" |
|
392 |
exit 1 |
|
393 |
fi
|
|
394 |
fi
|
|
7598.6.2
by Brad Crittenden
Added LP signing key, moved some items to the default section of bazaar.conf |
395 |
|
4317.1.3
by Mark Shuttleworth
Also fixup ~/.bazaar/locations.conf |
396 |
if [ ! -e ~/.bazaar/locations.conf ]; then |
397 |
touch ~/.bazaar/locations.conf |
|
398 |
fi
|
|
7598.6.2
by Brad Crittenden
Added LP signing key, moved some items to the default section of bazaar.conf |
399 |
|
6666.1.2
by Brad Crittenden
Simplified the setting for locations.conf |
400 |
grep -q "\[${LP_PROJECT_PATH}\]" ~/.bazaar/locations.conf |
4317.1.3
by Mark Shuttleworth
Also fixup ~/.bazaar/locations.conf |
401 |
if [ $? -ne 0 ]; then |
7426.1.1
by Julian Edwards
Tweak rocketfuel-setup so that: |
402 |
cat >> ~/.bazaar/locations.conf << EOF
|
6666.1.2
by Brad Crittenden
Simplified the setting for locations.conf |
403 |
[$LP_PROJECT_PATH]
|
6666.1.1
by Brad Crittenden
Changes to locations.conf to match RocketFuelSetupDetails |
404 |
submit_branch = ${LP_TRUNK_PATH}
|
7426.1.1
by Julian Edwards
Tweak rocketfuel-setup so that: |
405 |
public_branch = bzr+ssh://bazaar.launchpad.net/~${lpusername}/launchpad
|
4317.1.3
by Mark Shuttleworth
Also fixup ~/.bazaar/locations.conf |
406 |
public_branch:policy = appendpath
|
7426.1.1
by Julian Edwards
Tweak rocketfuel-setup so that: |
407 |
push_location = lp:~${lpusername}/launchpad
|
4317.1.6
by Mark Shuttleworth
Make sure new stanza in ~/.bazaar/locations.conf starts on its own line |
408 |
push_location:policy = appendpath
|
7426.1.1
by Julian Edwards
Tweak rocketfuel-setup so that: |
409 |
merge_target = ${LP_TRUNK_PATH}
|
7598.6.2
by Brad Crittenden
Added LP signing key, moved some items to the default section of bazaar.conf |
410 |
submit_to = merge@code.launchpad.net
|
7426.1.1
by Julian Edwards
Tweak rocketfuel-setup so that: |
411 |
EOF
|
4317.1.3
by Mark Shuttleworth
Also fixup ~/.bazaar/locations.conf |
412 |
|
6666.1.1
by Brad Crittenden
Changes to locations.conf to match RocketFuelSetupDetails |
413 |
grep -q "\[$LP_TRUNK_PATH\]" ~/.bazaar/locations.conf |
414 |
if [ $? -ne 0 ]; then |
|
415 |
echo " |
|
416 |
[$LP_TRUNK_PATH] |
|
7598.6.6
by Brad Crittenden
Fixed location of public_branch |
417 |
public_branch = bzr+ssh://bazaar.launchpad.net/~launchpad-pqm/launchpad/devel\
|
6666.1.1
by Brad Crittenden
Changes to locations.conf to match RocketFuelSetupDetails |
418 |
" | tee -a ~/.bazaar/locations.conf > /dev/null |
419 |
fi
|
|
420 |
||
8931.1.1
by Karl Fogel
Use more appropriate defaults for LP_PROJECT_ROOT and LP_TRUNK_NAME. |
421 |
echo "Bazaar branch configuration updated." |
7598.6.2
by Brad Crittenden
Added LP signing key, moved some items to the default section of bazaar.conf |
422 |
|
423 |
fi
|
|
424 |
||
8931.1.4
by Karl Fogel
* utilities/rocketfuel-setup: Tell the user to hit Return after |
425 |
# Set up access to the local supermirror
|
4317.1.5
by Mark Shuttleworth
Also setup ssh access to bazaar.launchpad.dev |
426 |
if [ ! -e ~/.ssh/launchpad_id_dsa ]; then |
8426.6.3
by Michael Hudson
fix a few references to paths in canonical/codehosting |
427 |
cp $LP_TRUNK_PATH/lib/lp/codehosting/tests/id_dsa ~/.ssh/launchpad_id_dsa
|
4317.1.5
by Mark Shuttleworth
Also setup ssh access to bazaar.launchpad.dev |
428 |
chmod 600 ~/.ssh/launchpad_id_dsa
|
8931.1.4
by Karl Fogel
* utilities/rocketfuel-setup: Tell the user to hit Return after |
429 |
echo "Set up ssh key for local supermirror ssh access." |
4317.1.5
by Mark Shuttleworth
Also setup ssh access to bazaar.launchpad.dev |
430 |
fi
|
431 |
||
8931.1.4
by Karl Fogel
* utilities/rocketfuel-setup: Tell the user to hit Return after |
432 |
# Set up scripts in /usr/local/bin
|
4317.1.2
by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too |
433 |
cd /usr/local/bin
|
434 |
if [ ! -e rocketfuel-get ]; then |
|
6567.1.2
by Barry Warsaw
Parameterized most paths so this script is more useful to everyone. |
435 |
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 |
436 |
fi
|
6567.1.2
by Barry Warsaw
Parameterized most paths so this script is more useful to everyone. |
437 |
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 |
438 |
if [ $? -ne 0 ]; then |
439 |
echo "WARNING: /usr/local/bin/rocketfuel-get should be deleted so I can |
|
440 |
recreate it."
|
|
441 |
fi
|
|
5323.2.1
by Mark Shuttleworth
Manage featured projects in the db |
442 |
if [ ! -e rocketfuel-flakes ]; then |
6567.1.2
by Barry Warsaw
Parameterized most paths so this script is more useful to everyone. |
443 |
sudo ln -s $LP_TRUNK_PATH/utilities/rocketfuel-flakes
|
5323.2.1
by Mark Shuttleworth
Manage featured projects in the db |
444 |
fi
|
6567.1.2
by Barry Warsaw
Parameterized most paths so this script is more useful to everyone. |
445 |
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 |
446 |
if [ $? -ne 0 ]; then |
447 |
echo "WARNING: /usr/local/bin/rocketfuel-flakes should be deleted so I can |
|
448 |
recreate it."
|
|
449 |
fi
|
|
4317.1.2
by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too |
450 |
if [ ! -e rocketfuel-branch ]; then |
6567.1.2
by Barry Warsaw
Parameterized most paths so this script is more useful to everyone. |
451 |
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 |
452 |
fi
|
6567.1.2
by Barry Warsaw
Parameterized most paths so this script is more useful to everyone. |
453 |
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 |
454 |
if [ $? -ne 0 ]; then |
455 |
echo "WARNING: /usr/local/bin/rocketfuel-branch should be deleted so I can |
|
456 |
recreate it."
|
|
457 |
fi
|
|
458 |
if [ ! -e rocketfuel-setup ]; then |
|
6567.1.2
by Barry Warsaw
Parameterized most paths so this script is more useful to everyone. |
459 |
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 |
460 |
fi
|
6567.1.2
by Barry Warsaw
Parameterized most paths so this script is more useful to everyone. |
461 |
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 |
462 |
if [ $? -ne 0 ]; then |
463 |
echo "WARNING: /usr/local/bin/rocketfuel-setup should be deleted so I can |
|
464 |
recreate it."
|
|
465 |
fi
|
|
4343.1.3
by Mark Shuttleworth
Add symlink for rocketfuel-status |
466 |
if [ ! -e rocketfuel-status ]; then |
6567.1.2
by Barry Warsaw
Parameterized most paths so this script is more useful to everyone. |
467 |
sudo ln -s $LP_TRUNK_PATH/utilities/rocketfuel-status
|
4343.1.3
by Mark Shuttleworth
Add symlink for rocketfuel-status |
468 |
fi
|
6567.1.2
by Barry Warsaw
Parameterized most paths so this script is more useful to everyone. |
469 |
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 |
470 |
if [ $? -ne 0 ]; then |
471 |
echo "WARNING: /usr/local/bin/rocketfuel-status should be deleted so I can |
|
472 |
recreate it."
|
|
473 |
fi
|
|
4920.2.13
by Mark Shuttleworth
Add rocketfuel-push script and make rocketfuel-setup aware of it |
474 |
if [ ! -e rocketfuel-push ]; then |
6567.1.2
by Barry Warsaw
Parameterized most paths so this script is more useful to everyone. |
475 |
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 |
476 |
fi
|
6567.1.2
by Barry Warsaw
Parameterized most paths so this script is more useful to everyone. |
477 |
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 |
478 |
if [ $? -ne 0 ]; then |
479 |
echo "WARNING: /usr/local/bin/rocketfuel-push should be deleted so I can |
|
480 |
recreate it."
|
|
481 |
fi
|
|
4317.1.2
by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too |
482 |
|
483 |
||
484 |
# Make sure we have all the right code in place for source dependencies
|
|
485 |
/usr/local/bin/rocketfuel-get |
|
486 |
||
4317.1.5
by Mark Shuttleworth
Also setup ssh access to bazaar.launchpad.dev |
487 |
echo " |
8931.1.1
by Karl Fogel
Use more appropriate defaults for LP_PROJECT_ROOT and LP_TRUNK_NAME. |
488 |
Thank you for using this script. You can improve it for everyone by
|
8931.1.4
by Karl Fogel
* utilities/rocketfuel-setup: Tell the user to hit Return after |
489 |
committing changes to Launchpad in utilities/rocketfuel-setup.
|
4317.1.5
by Mark Shuttleworth
Also setup ssh access to bazaar.launchpad.dev |
490 |
|
8931.1.1
by Karl Fogel
Use more appropriate defaults for LP_PROJECT_ROOT and LP_TRUNK_NAME. |
491 |
Please see http://dev.launchpad.net/ for more information on
|
492 |
developing and testing Launchpad, and on submitting changes.
|
|
7426.1.2
by Julian Edwards
remove the canonical smtp server pssword and direct the user to where to find it. |
493 |
|
8931.1.1
by Karl Fogel
Use more appropriate defaults for LP_PROJECT_ROOT and LP_TRUNK_NAME. |
494 |
You can use the following commands to manage your Launchpad
|
495 |
development environment:
|
|
4920.2.13
by Mark Shuttleworth
Add rocketfuel-push script and make rocketfuel-setup aware of it |
496 |
|
497 |
rocketfuel-get
|
|
8931.1.1
by Karl Fogel
Use more appropriate defaults for LP_PROJECT_ROOT and LP_TRUNK_NAME. |
498 |
Update your copy of $LP_TRUNK_NAME and the necessary source |
499 |
dependencies, and make sure all source dependencies are properly
|
|
500 |
linked in to all the branches you are working on.
|
|
6567.1.3
by Barry Warsaw
parameterize all paths so that launchpad code can live anywhere. |
501 |
|
502 |
rocketfuel-branch foo
|
|
8234.1.7
by Gary Poster
rocketfuel scripts and download cache are in place now. |
503 |
Create a new branch of LP called \"foo\" in
|
504 |
$LP_PROJECT_PATH/foo, |
|
6567.1.3
by Barry Warsaw
parameterize all paths so that launchpad code can live anywhere. |
505 |
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 |
506 |
|
507 |
rocketfuel-status
|
|
8234.1.7
by Gary Poster
rocketfuel scripts and download cache are in place now. |
508 |
Check each of the branches in $LP_PROJECT_PATH |
8931.1.4
by Karl Fogel
* utilities/rocketfuel-setup: Tell the user to hit Return after |
509 |
and show which of them have uncommitted changes; also check which ones
|
8234.1.7
by Gary Poster
rocketfuel scripts and download cache are in place now. |
510 |
have revisions that have not yet landed on trunk.
|
4920.2.13
by Mark Shuttleworth
Add rocketfuel-push script and make rocketfuel-setup aware of it |
511 |
|
512 |
rocketfuel-push
|
|
7693.1.1
by Brad Crittenden
Corrected GPG key for bzr, add apache2 to installed packages, add lp:~launchpad ppa key. |
513 |
Push all of your branches to Launchpad, so that you have a server-side
|
4920.2.13
by Mark Shuttleworth
Add rocketfuel-push script and make rocketfuel-setup aware of it |
514 |
backup of everything.
|
4317.1.5
by Mark Shuttleworth
Also setup ssh access to bazaar.launchpad.dev |
515 |
|
516 |
Happy hacking!
|
|
517 |
"
|