aboutsummaryrefslogtreecommitdiffstats
path: root/meta-openstack/recipes-support/postgresql/postgresql_9.%.bbappend
diff options
context:
space:
mode:
Diffstat (limited to 'meta-openstack/recipes-support/postgresql/postgresql_9.%.bbappend')
-rw-r--r--meta-openstack/recipes-support/postgresql/postgresql_9.%.bbappend65
1 files changed, 27 insertions, 38 deletions
diff --git a/meta-openstack/recipes-support/postgresql/postgresql_9.%.bbappend b/meta-openstack/recipes-support/postgresql/postgresql_9.%.bbappend
index b26054e6..5b87960c 100644
--- a/meta-openstack/recipes-support/postgresql/postgresql_9.%.bbappend
+++ b/meta-openstack/recipes-support/postgresql/postgresql_9.%.bbappend
@@ -1,57 +1,46 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
-SRC_URI += "file://postgresql \
- file://postgresql-init"
+SRC_URI += " \
+ file://postgresql-init \
+ file://postgresql-init.service \
+ "
-inherit useradd update-rc.d identity hosts
+inherit identity hosts
-PACKAGECONFIG[libxml] = "--with-libxml CFLAGS=-I${STAGING_INCDIR}/libxml2,--without-libxml,libxml2,libxml2"
+SYSTEMD_AUTO_ENABLE_${PN} = "enable"
# default
DB_DATADIR ?= "/var/lib/postgres/data"
do_install_append() {
- INIT_D_DEST_DIR=${D}${sysconfdir}/init.d
+ D_DEST_DIR=${D}${sysconfdir}/postgresql
- install -d ${D}${sysconfdir}/init.d/
- install -m 0755 ${WORKDIR}/postgresql ${INIT_D_DEST_DIR}/postgresql
- install -m 0755 ${WORKDIR}/postgresql-init ${INIT_D_DEST_DIR}/postgresql-init
+ install -d ${D_DEST_DIR}
+ install -m 0755 ${WORKDIR}/postgresql-init ${D_DEST_DIR}/postgresql-init
- sed -e "s:%DB_DATADIR%:${DB_DATADIR}:g" -i ${INIT_D_DEST_DIR}/postgresql
- sed -e "s:%DB_DATADIR%:${DB_DATADIR}:g" -i ${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 ${INIT_D_DEST_DIR}/postgresql-init
- sed -e "s:%DB_PASSWORD%:${DB_PASSWORD}:g" -i ${INIT_D_DEST_DIR}/postgresql-init
+ 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
- sed -e "s:%CONTROLLER_IP%:${CONTROLLER_IP}:g" -i ${INIT_D_DEST_DIR}/postgresql-init
- sed -e "s:%CONTROLLER_HOST%:${CONTROLLER_HOST}:g" -i ${INIT_D_DEST_DIR}/postgresql-init
+ sed -e "s:%CONTROLLER_IP%:${CONTROLLER_IP}:g" -i ${D_DEST_DIR}/postgresql-init
+ sed -e "s:%CONTROLLER_HOST%:${CONTROLLER_HOST}:g" -i ${D_DEST_DIR}/postgresql-init
- sed -e "s:%COMPUTE_IP%:${COMPUTE_IP}:g" -i ${INIT_D_DEST_DIR}/postgresql-init
- sed -e "s:%COMPUTE_HOST%:${COMPUTE_HOST}:g" -i ${INIT_D_DEST_DIR}/postgresql-init
-}
+ sed -e "s:%COMPUTE_IP%:${COMPUTE_IP}:g" -i ${D_DEST_DIR}/postgresql-init
+ sed -e "s:%COMPUTE_HOST%:${COMPUTE_HOST}:g" -i ${D_DEST_DIR}/postgresql-init
-RDEPENDS_${PN} += "postgresql-timezone eglibc-utils update-rc.d"
-USERADD_PACKAGES = "${PN}"
-GROUPADD_PARAM_${PN} = "--system postgres"
-USERADD_PARAM_${PN} = "--system --home /var/lib/postgres -g postgres \
- --no-create-home --shell /bin/false postgres"
+ install -d ${D}${systemd_unitdir}/system/
+ 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}
+}
PACKAGES += " ${PN}-setup"
-ALLOW_EMPTY_${PN}-setup = "1"
-
-pkg_postinst_${PN}-setup () {
- # postgres 9.2.4 postinst
- if [ -z "$D" ]; then
- /etc/init.d/postgresql-init
- if [ $? -ne 0 ]; then
- echo "[ERROR] postgres: unable to create admin account"
- exit 1
- fi
- fi
-}
-FILES_${PN} += "${localstatedir}/run/${PN}"
+SYSTEMD_PACKAGES += "${PN}-setup"
+SYSTEMD_SERVICE_${PN}-setup = "postgresql-init.service"
-INITSCRIPT_PACKAGES = "${PN}"
-INITSCRIPT_NAME = "${PN}"
-INITSCRIPT_PARAMS = "defaults"
+FILES_${PN}-setup = " \
+ ${systemd_unitdir}/system \
+"