[meta-virtualization] [m-c-s][PATCH 2/3] postgresql: update all instances of PGDATA

Mark Asselstine mark.asselstine at windriver.com
Thu Mar 29 12:29:12 PDT 2018


While investigating a postgresql startup issue I found we were only
updating one instance of PGDATA where several exist. We do not use
these other instances but they are files installed in the system and
should reflect our customized setting for PGDATA.

Signed-off-by: Mark Asselstine <mark.asselstine at windriver.com>
---
 meta-openstack/recipes-dbs/postgresql/postgresql_9.%.bbappend | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/meta-openstack/recipes-dbs/postgresql/postgresql_9.%.bbappend b/meta-openstack/recipes-dbs/postgresql/postgresql_9.%.bbappend
index 5b87960..1b8a952 100644
--- a/meta-openstack/recipes-dbs/postgresql/postgresql_9.%.bbappend
+++ b/meta-openstack/recipes-dbs/postgresql/postgresql_9.%.bbappend
@@ -19,7 +19,6 @@ do_install_append() {
     install -m 0755 ${WORKDIR}/postgresql-init ${D_DEST_DIR}/postgresql-init
 
     sed -e "s:%DB_DATADIR%:${DB_DATADIR}:g" -i ${D_DEST_DIR}/postgresql-init
-    sed -e "s:\(PGDATA=\).*$:\1${DB_DATADIR}:g" -i ${D}${systemd_unitdir}/system/postgresql.service
 
     sed -e "s:%DB_USER%:${DB_USER}:g" -i ${D_DEST_DIR}/postgresql-init
     sed -e "s:%DB_PASSWORD%:${DB_PASSWORD}:g" -i ${D_DEST_DIR}/postgresql-init
@@ -34,6 +33,16 @@ do_install_append() {
     PG_INIT_SERVICE_FILE=${D}${systemd_unitdir}/system/postgresql-init.service
     install -m 644 ${WORKDIR}/postgresql-init.service ${PG_INIT_SERVICE_FILE}
     sed -e "s:%SYSCONFIGDIR%:${sysconfdir}:g" -i ${PG_INIT_SERVICE_FILE}
+
+    # Update PGDATA throughout
+    files="${D}${localstatedir}/lib/${BPN}/.bash_profile"
+    files="$files ${D}${systemd_unitdir}/system/postgresql.service"
+    files="$files ${D}${bindir}/${BPN}-setup"
+    files="$files ${D}${sysconfdir}/init.d/${BPN}-server"
+    for f in $files
+    do
+        sed -e "s:\(PGDATA=\).*$:\1${DB_DATADIR}:g" -i $f
+    done
 }
 
 PACKAGES += " ${PN}-setup"
-- 
2.7.4



More information about the meta-virtualization mailing list