Merge lp:~jtv/launchpad/bug-445011 into lp:launchpad

Proposed by Jeroen T. Vermeulen
Status: Merged
Approved by: Jeroen T. Vermeulen
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~jtv/launchpad/bug-445011
Merge into: lp:launchpad
Diff against target: 50 lines
1 file modified
utilities/launchpad-database-setup (+20/-7)
To merge this branch: bzr merge lp:~jtv/launchpad/bug-445011
Reviewer Review Type Date Requested Status
Stuart Bishop (community) Approve
Review via email: mp+12978@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

= Bug 445011 =

My previous branch was redundant with ongoing work. This one fixes
just the database setup script to work with postgres 8.4.

Jeroen

Revision history for this message
Stuart Bishop (stub) wrote :

Cool.

I haven't tested it - this script scares me ;)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'utilities/launchpad-database-setup'
2--- utilities/launchpad-database-setup 2009-07-17 00:26:05 +0000
3+++ utilities/launchpad-database-setup 2009-10-07 09:55:24 +0000
4@@ -17,17 +17,22 @@
5 # https://launchpad.canonical.com/DatabaseSetup which are intended for
6 # initial Launchpad setup on an otherwise unconfigured postgresql instance
7
8-if [ -e /etc/init.d/postgresql-8.3 ]; then
9- pgversion=8.3
10- echo "Using postgres 8.3"
11-elif [ -e /etc/init.d/postgresql-8.2]; then
12- pgversion=8.2
13- echo "Using postgres 8.2"
14-else
15+for pgversion in 8.4 8.3 8.2
16+do
17+ if [ -e /etc/init.d/postgresql-$pgversion ]
18+ then
19+ break
20+ fi
21+done
22+
23+if [ -z "$pgversion" ]
24+then
25 echo "Unable to determine your postgres version."
26 exit 1
27 fi
28
29+echo "Using postgres $pgversion"
30+
31 # Make sure that we have the correct version running on port 5432
32 sudo grep -q "port.*5432" /etc/postgresql/$pgversion/main/postgresql.conf
33 if [ $? -ne 0 ]; then
34@@ -81,9 +86,17 @@
35 log_statement='all'
36 log_line_prefix='[%t] %q%u@%d '
37 fsync = off
38+
39+EOF
40+
41+if [ "$pgversion" = 8.2 -o "$pgversion" = 8.3 ]
42+then
43+ sudo grep -q '^[[:space:]]*max_fsm_relations' /etc/postgresql/$pgversion/main/postgresql.conf || \
44+ sudo tee -a /etc/postgresql/$pgversion/main/postgresql.conf <<'EOF'
45 max_fsm_relations=2000
46
47 EOF
48+fi
49
50 sudo /etc/init.d/postgresql-$pgversion start
51