diff options
Diffstat (limited to 'meta-openstack/recipes-support/postgresql/postgresql_9.2.4.bbappend')
-rw-r--r-- | meta-openstack/recipes-support/postgresql/postgresql_9.2.4.bbappend | 35 |
1 files changed, 35 insertions, 0 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 new file mode 100644 index 00000000..98e7207c --- /dev/null +++ b/meta-openstack/recipes-support/postgresql/postgresql_9.2.4.bbappend @@ -0,0 +1,35 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" +PRINC := "${@int(PRINC) + 1}" + +SRC_URI += "file://postgresql" + +inherit useradd update-rc.d identity + +do_install_append() { + install -d ${D}${sysconfdir}/${PN} + chown postgres ${D}${sysconfdir}/${PN} + + install -d ${D}${sysconfdir}/init.d/ + install -m 0755 ${WORKDIR}/postgresql ${D}${sysconfdir}/init.d/postgresql +} + +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" + +pkg_postinst_${PN} () { + if [ "x$D" != "x" ]; then + exit 1 + fi + + sudo -u postgres initdb -D /etc/${PN}/ + /etc/init.d/postgresql start + sudo -u postgres psql -c "CREATE ROLE ${DB_USER} WITH SUPERUSER LOGIN PASSWORD '${DB_PASSWORD}'" + ln -s /usr/share/zoneinfo /usr/share/postgresql/timezone +} + +FILES_${PN} += "${localstatedir}/run/${PN}" + +INITSCRIPT_NAME = "${PN}" +INITSCRIPT_PARAMS = "defaults" |