diff options
| -rw-r--r-- | meta-oe/recipes-support/postgresql/files/postgresql.service | 27 | ||||
| -rw-r--r-- | meta-oe/recipes-support/postgresql/postgresql.inc | 22 |
2 files changed, 48 insertions, 1 deletions
diff --git a/meta-oe/recipes-support/postgresql/files/postgresql.service b/meta-oe/recipes-support/postgresql/files/postgresql.service new file mode 100644 index 0000000000..4ec959e842 --- /dev/null +++ b/meta-oe/recipes-support/postgresql/files/postgresql.service | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | [Unit] | ||
| 2 | Description=PostgreSQL database server | ||
| 3 | After=network.target | ||
| 4 | |||
| 5 | [Service] | ||
| 6 | Type=forking | ||
| 7 | User=postgres | ||
| 8 | Group=postgres | ||
| 9 | |||
| 10 | # Port number for server to listen on | ||
| 11 | Environment=PGPORT=5432 | ||
| 12 | |||
| 13 | # Location of database directory | ||
| 14 | Environment=PGDATA=/var/lib/postgresql/data | ||
| 15 | |||
| 16 | # Disable OOM kill on the postmaster | ||
| 17 | OOMScoreAdjust=-17 | ||
| 18 | |||
| 19 | ExecStart=@BINDIR@/pg_ctl start -D ${PGDATA} -s -o "-p ${PGPORT}" -w -t 300 | ||
| 20 | ExecStop=@BINDIR@/pg_ctl stop -D ${PGDATA} -s -m fast | ||
| 21 | ExecReload=@BINDIR@/pg_ctl reload -D ${PGDATA} -s | ||
| 22 | |||
| 23 | # Give a reasonable amount of time for the server to start up/shut down | ||
| 24 | TimeoutSec=300 | ||
| 25 | |||
| 26 | [Install] | ||
| 27 | WantedBy=multi-user.target | ||
diff --git a/meta-oe/recipes-support/postgresql/postgresql.inc b/meta-oe/recipes-support/postgresql/postgresql.inc index 774c8fd0c9..d45f4b5edf 100644 --- a/meta-oe/recipes-support/postgresql/postgresql.inc +++ b/meta-oe/recipes-support/postgresql/postgresql.inc | |||
| @@ -30,6 +30,7 @@ SRC_URI = "http://ftp.postgresql.org/pub/source/v${PV}/${BP}.tar.bz2 \ | |||
| 30 | file://postgresql.pam \ | 30 | file://postgresql.pam \ |
| 31 | file://0001-Use-pkg-config-for-libxml2-detection.patch \ | 31 | file://0001-Use-pkg-config-for-libxml2-detection.patch \ |
| 32 | file://postgresql-setup \ | 32 | file://postgresql-setup \ |
| 33 | file://postgresql.service \ | ||
| 33 | " | 34 | " |
| 34 | 35 | ||
| 35 | LEAD_SONAME = "libpq.so" | 36 | LEAD_SONAME = "libpq.so" |
| @@ -37,7 +38,20 @@ LEAD_SONAME = "libpq.so" | |||
| 37 | # LDFLAGS for shared libraries | 38 | # LDFLAGS for shared libraries |
| 38 | export LDFLAGS_SL = "${LDFLAGS}" | 39 | export LDFLAGS_SL = "${LDFLAGS}" |
| 39 | 40 | ||
| 40 | inherit autotools pkgconfig perlnative pythonnative useradd update-rc.d | 41 | inherit autotools pkgconfig perlnative pythonnative useradd update-rc.d systemd |
| 42 | |||
| 43 | SYSTEMD_SERVICE_${PN} = "postgresql.service" | ||
| 44 | SYSTEMD_AUTO_ENABLE_${PN} = "disable" | ||
| 45 | |||
| 46 | DEPENDS_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd-systemctl-native', '', d)}" | ||
| 47 | pkg_postinst_${PN} () { | ||
| 48 | if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd sysvinit', 'true', 'false', d)}; then | ||
| 49 | if [ -n "$D" ]; then | ||
| 50 | OPTS="--root=$D" | ||
| 51 | fi | ||
| 52 | systemctl $OPTS mask postgresql-server.service | ||
| 53 | fi | ||
| 54 | } | ||
| 41 | 55 | ||
| 42 | enable_pam = "${@base_contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}" | 56 | enable_pam = "${@base_contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}" |
| 43 | PACKAGECONFIG ??= "${enable_pam} openssl python uuid libxml tcl nls libxml perl" | 57 | PACKAGECONFIG ??= "${enable_pam} openssl python uuid libxml tcl nls libxml perl" |
| @@ -184,6 +198,12 @@ do_install_append() { | |||
| 184 | install -d ${D}${sysconfdir}/pam.d | 198 | install -d ${D}${sysconfdir}/pam.d |
| 185 | install -m 644 ${WORKDIR}/postgresql.pam ${D}${sysconfdir}/pam.d/postgresql | 199 | install -m 644 ${WORKDIR}/postgresql.pam ${D}${sysconfdir}/pam.d/postgresql |
| 186 | fi | 200 | fi |
| 201 | |||
| 202 | # Install systemd unit files | ||
| 203 | install -d ${D}${systemd_unitdir}/system | ||
| 204 | install -m 0644 ${WORKDIR}/postgresql.service ${D}${systemd_unitdir}/system | ||
| 205 | sed -i -e 's,@BINDIR@,${bindir},g' \ | ||
| 206 | ${D}${systemd_unitdir}/system/postgresql.service | ||
| 187 | } | 207 | } |
| 188 | 208 | ||
| 189 | SSTATE_SCAN_FILES += "Makefile.global" | 209 | SSTATE_SCAN_FILES += "Makefile.global" |
