summaryrefslogtreecommitdiffstats
path: root/meta-openstack/recipes-dangling/postgresql
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@windriver.com>2014-08-25 12:24:29 -0400
committerBruce Ashfield <bruce.ashfield@windriver.com>2014-08-25 12:24:29 -0400
commite9136650b58e24c4641e7cf008c857f349c92c03 (patch)
treebe0cd8306c86b7f8b888aae92520018783ce0148 /meta-openstack/recipes-dangling/postgresql
parent634957bdf2e430fc252a638fb4e9499884385b4d (diff)
downloadmeta-cloud-services-e9136650b58e24c4641e7cf008c857f349c92c03.tar.gz
recipes-dangling: remove all dangling bbappends
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Diffstat (limited to 'meta-openstack/recipes-dangling/postgresql')
-rw-r--r--meta-openstack/recipes-dangling/postgresql/postgresql/postgresql92
-rw-r--r--meta-openstack/recipes-dangling/postgresql/postgresql/postgresql-init43
-rw-r--r--meta-openstack/recipes-dangling/postgresql/postgresql_8.4.7.bbappend35
3 files changed, 0 insertions, 170 deletions
diff --git a/meta-openstack/recipes-dangling/postgresql/postgresql/postgresql b/meta-openstack/recipes-dangling/postgresql/postgresql/postgresql
deleted file mode 100644
index 5a34ec0..0000000
--- a/meta-openstack/recipes-dangling/postgresql/postgresql/postgresql
+++ /dev/null
@@ -1,92 +0,0 @@
1#!/bin/sh
2
3### BEGIN INIT INFO
4# Provides: postgresql
5# Required-Start: $local_fs $remote_fs $network $time
6# Required-Stop: $local_fs $remote_fs $network $time
7# Should-Start: $syslog
8# Should-Stop: $syslog
9# Default-Start: 2 3 4 5
10# Default-Stop: 0 1 6
11# Short-Description: PostgreSQL RDBMS server
12### END INIT INFO
13
14DAEMON=/usr/bin/postmaster
15DESC="PostgreSQL RDBMS server"
16
17datadir=`grep ^data_directory /etc/postgresql/postgresql.conf |sed -e "s#^.*= '##; s#'.*##"`
18if [ "$datadir" = "" ] ; then
19 datadir=/etc/postgresql
20else
21 if [ ! -e $datadir/postgresql.conf ] ; then
22 if [ -e /etc/postgresql/postgresql.conf -a -e $datadir ] ; then
23 ln -s /etc/postgresql/*.conf $datadir/
24 fi
25 fi
26fi
27
28cd /
29
30start ()
31{
32 echo -n "Starting postgres server..."
33 if pidof ${DAEMON} > /dev/null; then
34 echo "already running."
35 exit 0
36 fi
37 touch /var/log/postgresql.log
38 chown postgres /var/log/postgresql.log
39 sudo -u postgres /usr/bin/pg_ctl start -w -D $datadir -s -l /var/log/postgresql.log
40 if [ $? -eq 0 ]; then
41 echo "done."
42 else
43 echo "failed."
44 fi
45}
46
47stop ()
48{
49 echo -n "Stopping postgres server..."
50 if ! pidof ${DAEMON} >/dev/null; then
51 echo "not running."
52 exit 0
53 fi
54 sudo -u postgres /usr/bin/pg_ctl stop -w -D $datadir -m fast -s
55 if [ $? -eq 0 ]; then
56 echo "done."
57 else
58 if [ -f /etc/postgresql/postmaster.pid -a "$datadir" != "/etc/postgresql" ] ; then
59 # Special case for transition
60 sudo -u postgres /usr/bin/pg_ctl stop -w -D /etc/postgresql -m fast -s
61 fi
62 if ! pidof ${DAEMON} > /dev/null; then
63 echo "done."
64 else
65 echo "failed."
66 exit 1
67 fi
68 fi
69}
70
71case "$1" in
72 start)
73 start
74 ;;
75 stop)
76 stop
77 ;;
78 force-reload)
79 stop
80 start
81 ;;
82 restart)
83 stop
84 start
85 ;;
86 *)
87 echo "Usage: $0 {start|stop|force-reload|restart}"
88 exit 1
89 ;;
90esac
91
92exit 0
diff --git a/meta-openstack/recipes-dangling/postgresql/postgresql/postgresql-init b/meta-openstack/recipes-dangling/postgresql/postgresql/postgresql-init
deleted file mode 100644
index c9c3807..0000000
--- a/meta-openstack/recipes-dangling/postgresql/postgresql/postgresql-init
+++ /dev/null
@@ -1,43 +0,0 @@
1#!/bin/sh
2# set -x
3
4PN=postgresql
5CONTROLLER_IP=%CONTROLLER_IP%
6COMPUTE_IP=%COMPUTE_IP%
7DB_USER=%DB_USER%
8DB_PASSWORD=%DB_PASSWORD%
9
10if [ -e /etc/${PN}/PG_VERSION ]; then
11 # the database has already been initialized, return
12 exit 0
13fi
14
15sudo -u postgres initdb -D /etc/${PN}/
16echo "listen_addresses = '*'" >> /etc/${PN}/postgresql.conf
17echo "host all all ${CONTROLLER_IP}/32 trust" >> /etc/${PN}/pg_hba.conf
18echo "host all all ${COMPUTE_IP}/32 trust" >> /etc/${PN}/pg_hba.conf
19/etc/init.d/postgresql start
20
21count=0
22done=0
23while [ $count -le 10 ] && [ $done -eq 0 ]; do
24 sudo -u postgres psql -c "CREATE ROLE ${DB_USER} WITH SUPERUSER LOGIN PASSWORD '${DB_PASSWORD}'" 2> /dev/null
25 if [ $? -ne 0 ]; then
26 echo "[INFO] postgres: failed to create account for ${DB_USER}, trying again"
27 /etc/init.d/postgresql stop
28 sleep 3
29 /etc/init.d/postgresql start
30 sleep 3
31 else
32 echo "[INFO] postgres: created account for ${DB_USER}, continuing .. "
33 done=1
34 fi
35 count=`expr $count + 1`
36done
37
38if [ $done -eq 0 ]; then
39 echo "[ERROR] postgres: unable to create admin account"
40 exit 1
41fi
42
43ln -s /usr/share/zoneinfo /usr/share/postgresql/timezone || true
diff --git a/meta-openstack/recipes-dangling/postgresql/postgresql_8.4.7.bbappend b/meta-openstack/recipes-dangling/postgresql/postgresql_8.4.7.bbappend
deleted file mode 100644
index 98e7207..0000000
--- a/meta-openstack/recipes-dangling/postgresql/postgresql_8.4.7.bbappend
+++ /dev/null
@@ -1,35 +0,0 @@
1FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
2PRINC := "${@int(PRINC) + 1}"
3
4SRC_URI += "file://postgresql"
5
6inherit useradd update-rc.d identity
7
8do_install_append() {
9 install -d ${D}${sysconfdir}/${PN}
10 chown postgres ${D}${sysconfdir}/${PN}
11
12 install -d ${D}${sysconfdir}/init.d/
13 install -m 0755 ${WORKDIR}/postgresql ${D}${sysconfdir}/init.d/postgresql
14}
15
16USERADD_PACKAGES = "${PN}"
17GROUPADD_PARAM_${PN} = "--system postgres"
18USERADD_PARAM_${PN} = "--system --home /var/lib/postgres -g postgres \
19 --no-create-home --shell /bin/false postgres"
20
21pkg_postinst_${PN} () {
22 if [ "x$D" != "x" ]; then
23 exit 1
24 fi
25
26 sudo -u postgres initdb -D /etc/${PN}/
27 /etc/init.d/postgresql start
28 sudo -u postgres psql -c "CREATE ROLE ${DB_USER} WITH SUPERUSER LOGIN PASSWORD '${DB_PASSWORD}'"
29 ln -s /usr/share/zoneinfo /usr/share/postgresql/timezone
30}
31
32FILES_${PN} += "${localstatedir}/run/${PN}"
33
34INITSCRIPT_NAME = "${PN}"
35INITSCRIPT_PARAMS = "defaults"