summaryrefslogtreecommitdiffstats
path: root/meta-openstack
diff options
context:
space:
mode:
Diffstat (limited to 'meta-openstack')
-rw-r--r--meta-openstack/recipes-support/postgresql/postgresql_9.2.4.bbappend27
1 files changed, 26 insertions, 1 deletions
diff --git a/meta-openstack/recipes-support/postgresql/postgresql_9.2.4.bbappend b/meta-openstack/recipes-support/postgresql/postgresql_9.2.4.bbappend
index 98e7207..f131e21 100644
--- a/meta-openstack/recipes-support/postgresql/postgresql_9.2.4.bbappend
+++ b/meta-openstack/recipes-support/postgresql/postgresql_9.2.4.bbappend
@@ -19,14 +19,39 @@ USERADD_PARAM_${PN} = "--system --home /var/lib/postgres -g postgres \
19 --no-create-home --shell /bin/false postgres" 19 --no-create-home --shell /bin/false postgres"
20 20
21pkg_postinst_${PN} () { 21pkg_postinst_${PN} () {
22 # postgres 9.2.4 postinst
22 if [ "x$D" != "x" ]; then 23 if [ "x$D" != "x" ]; then
23 exit 1 24 exit 1
24 fi 25 fi
25 26
26 sudo -u postgres initdb -D /etc/${PN}/ 27 sudo -u postgres initdb -D /etc/${PN}/
28 sleep 2
27 /etc/init.d/postgresql start 29 /etc/init.d/postgresql start
28 sudo -u postgres psql -c "CREATE ROLE ${DB_USER} WITH SUPERUSER LOGIN PASSWORD '${DB_PASSWORD}'" 30 sleep 5
31
32 count=0
33 done=0
34 while [ $count -le 10 ] && [ $done -eq 0 ]; do
35 sudo -u postgres psql -c "CREATE ROLE ${DB_USER} WITH SUPERUSER LOGIN PASSWORD '${DB_PASSWORD}'" 2> /dev/null
36 if [ $? -ne 0 ]; then
37 echo "[INFO] postgres: failed to create account for ${DB_USER}, trying again"
38 /etc/init.d/postgresql stop
39 sleep 2
40 /etc/init.d/postgresql start
41 sleep 1
42 else
43 done=1
44 fi
45 count=`expr $count + 1`
46 done
47
48 if [ $done -eq 0 ]; then
49 echo "[ERROR] postgres: unable to create admin account"
50 exit 1
51 fi
52
29 ln -s /usr/share/zoneinfo /usr/share/postgresql/timezone 53 ln -s /usr/share/zoneinfo /usr/share/postgresql/timezone
54 # end postgres 9.2.4 postinst
30} 55}
31 56
32FILES_${PN} += "${localstatedir}/run/${PN}" 57FILES_${PN} += "${localstatedir}/run/${PN}"