mirror of
git://git.openembedded.org/meta-openembedded
synced 2026-01-04 16:10:10 +00:00
postgresql: add systemd unit file
Add systemd unit file for postgresql. When 'sysvinit' and 'systemd' are both in DISTRO_FEATURES, we need to prevent the init script from running via systemd. Signed-off-by: Chong Lu <Chong.Lu@windriver.com> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
This commit is contained in:
parent
dfa0b4c86d
commit
711f3b8da8
27
meta-oe/recipes-support/postgresql/files/postgresql.service
Normal file
27
meta-oe/recipes-support/postgresql/files/postgresql.service
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
[Unit]
|
||||
Description=PostgreSQL database server
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
User=postgres
|
||||
Group=postgres
|
||||
|
||||
# Port number for server to listen on
|
||||
Environment=PGPORT=5432
|
||||
|
||||
# Location of database directory
|
||||
Environment=PGDATA=/var/lib/postgresql/data
|
||||
|
||||
# Disable OOM kill on the postmaster
|
||||
OOMScoreAdjust=-17
|
||||
|
||||
ExecStart=@BINDIR@/pg_ctl start -D ${PGDATA} -s -o "-p ${PGPORT}" -w -t 300
|
||||
ExecStop=@BINDIR@/pg_ctl stop -D ${PGDATA} -s -m fast
|
||||
ExecReload=@BINDIR@/pg_ctl reload -D ${PGDATA} -s
|
||||
|
||||
# Give a reasonable amount of time for the server to start up/shut down
|
||||
TimeoutSec=300
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
@ -30,6 +30,7 @@ SRC_URI = "http://ftp.postgresql.org/pub/source/v${PV}/${BP}.tar.bz2 \
|
|||
file://postgresql.pam \
|
||||
file://0001-Use-pkg-config-for-libxml2-detection.patch \
|
||||
file://postgresql-setup \
|
||||
file://postgresql.service \
|
||||
"
|
||||
|
||||
LEAD_SONAME = "libpq.so"
|
||||
|
|
@ -37,7 +38,20 @@ LEAD_SONAME = "libpq.so"
|
|||
# LDFLAGS for shared libraries
|
||||
export LDFLAGS_SL = "${LDFLAGS}"
|
||||
|
||||
inherit autotools pkgconfig perlnative pythonnative useradd update-rc.d
|
||||
inherit autotools pkgconfig perlnative pythonnative useradd update-rc.d systemd
|
||||
|
||||
SYSTEMD_SERVICE_${PN} = "postgresql.service"
|
||||
SYSTEMD_AUTO_ENABLE_${PN} = "disable"
|
||||
|
||||
DEPENDS_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd-systemctl-native', '', d)}"
|
||||
pkg_postinst_${PN} () {
|
||||
if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd sysvinit', 'true', 'false', d)}; then
|
||||
if [ -n "$D" ]; then
|
||||
OPTS="--root=$D"
|
||||
fi
|
||||
systemctl $OPTS mask postgresql-server.service
|
||||
fi
|
||||
}
|
||||
|
||||
enable_pam = "${@base_contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}"
|
||||
PACKAGECONFIG ??= "${enable_pam} openssl python uuid libxml tcl nls libxml perl"
|
||||
|
|
@ -184,6 +198,12 @@ do_install_append() {
|
|||
install -d ${D}${sysconfdir}/pam.d
|
||||
install -m 644 ${WORKDIR}/postgresql.pam ${D}${sysconfdir}/pam.d/postgresql
|
||||
fi
|
||||
|
||||
# Install systemd unit files
|
||||
install -d ${D}${systemd_unitdir}/system
|
||||
install -m 0644 ${WORKDIR}/postgresql.service ${D}${systemd_unitdir}/system
|
||||
sed -i -e 's,@BINDIR@,${bindir},g' \
|
||||
${D}${systemd_unitdir}/system/postgresql.service
|
||||
}
|
||||
|
||||
SSTATE_SCAN_FILES += "Makefile.global"
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user