new file mode 100644
@@ -0,0 +1,56 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides: pgbouncer
+# Required-Start: $local_fs $remote_fs $network
+# Required-Stop: $local_fs $remote_fs $network
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Connection pooler for PostgreSQL
+### END INIT INFO
+
+DAEMON=/usr/bin/pgbouncer
+CONF=/etc/pgbouncer/pgbouncer.ini
+PIDFILE=/var/run/pgbouncer/pgbouncer.pid
+
+test -x $DAEMON || exit 0
+test -f $CONF || exit 0
+
+stop() {
+ start-stop-daemon -K -q -p $PIDFILE -x $DAEMON -s INT
+ for i in 1 2 3 4 5 6 7 8 9 10; do
+ [ -f $PIDFILE ] && kill -0 "$(cat $PIDFILE)" 2>/dev/null || return 0
+ sleep 1
+ done
+}
+
+case "$1" in
+start)
+ echo -n "Starting pgbouncer: "
+ mkdir -p /var/run/pgbouncer /var/log/pgbouncer
+ chown pgbouncer:pgbouncer /var/run/pgbouncer /var/log/pgbouncer
+ if start-stop-daemon -S -q -p $PIDFILE -c pgbouncer -x $DAEMON -- -d $CONF; then
+ echo "done"
+ else
+ echo "failed"
+ exit 1
+ fi
+ ;;
+stop)
+ echo -n "Stopping pgbouncer: "
+ stop
+ echo "done"
+ ;;
+reload)
+ start-stop-daemon -K -q -p $PIDFILE -x $DAEMON -s HUP
+ ;;
+restart)
+ $0 stop
+ $0 start
+ ;;
+*)
+ echo "Usage: $0 {start|stop|reload|restart}"
+ exit 1
+ ;;
+esac
+
+exit 0
new file mode 100644
@@ -0,0 +1,18 @@
+[Unit]
+Description=Connection pooler for PostgreSQL
+Documentation=https://www.pgbouncer.org/
+After=network-online.target
+Wants=network-online.target
+
+[Service]
+Type=notify
+User=pgbouncer
+RuntimeDirectory=pgbouncer
+LogsDirectory=pgbouncer
+ExecStart=/usr/bin/pgbouncer /etc/pgbouncer/pgbouncer.ini
+ExecReload=/bin/kill -HUP $MAINPID
+KillSignal=SIGINT
+Restart=on-failure
+
+[Install]
+WantedBy=multi-user.target
new file mode 100644
@@ -0,0 +1,56 @@
+SUMMARY = "Lightweight connection pooler for PostgreSQL"
+HOMEPAGE = "https://www.pgbouncer.org/"
+BUGTRACKER = "https://github.com/pgbouncer/pgbouncer/issues"
+LICENSE = "BSD-1-Clause AND BSD-3-Clause AND ISC AND PostgreSQL"
+LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=d5f4369a96e12a98e8695033381d6c28 \
+ file://src/common/base64.c;beginline=6;endline=6;md5=e3aa2c2a657829cd2a61898e8fdde49b \
+ file://src/common/sha2.c;beginline=23;endline=48;md5=f924a973f231ccd44fa85d7938a71ece \
+ file://include/common/uthash.h;beginline=1;endline=21;md5=894975335149e863524c4d27839e8cfa \
+ "
+
+SRC_URI = "https://www.pgbouncer.org/downloads/files/${PV}/${BP}.tar.gz \
+ file://pgbouncer.init \
+ file://pgbouncer.service \
+ "
+SRC_URI[sha256sum] = "00886a2994b4844cd37110970df777772cfc42a74c400522c82fba509a3f42d9"
+
+UPSTREAM_CHECK_URI = "https://www.pgbouncer.org/downloads/"
+UPSTREAM_CHECK_REGEX = "pgbouncer-(?P<pver>\d+(\.\d+)+)\.tar\.gz"
+
+DEPENDS = "libevent"
+
+inherit autotools-brokensep pkgconfig systemd update-rc.d useradd
+
+CLEANBROKEN = "1"
+
+EXTRA_AUTORECONF += "-I ${S}/lib/m4"
+
+PACKAGECONFIG ??= "openssl cares ${@bb.utils.filter('DISTRO_FEATURES', 'pam systemd', d)}"
+PACKAGECONFIG[openssl] = "--with-openssl --with-root-ca-file=${sysconfdir}/ssl/certs/ca-certificates.crt,--without-openssl,openssl,,ca-certificates"
+PACKAGECONFIG[cares] = "--with-cares,--without-cares,c-ares"
+PACKAGECONFIG[pam] = "--with-pam,--without-pam,libpam"
+PACKAGECONFIG[ldap] = "--with-ldap,--without-ldap,openldap"
+PACKAGECONFIG[systemd] = "--with-systemd,--without-systemd,systemd"
+
+EXTRA_OEMAKE += "dist_man_MANS="
+
+do_install:append() {
+ install -d ${D}${sysconfdir}/pgbouncer
+ install -m 0640 -g pgbouncer ${S}/etc/pgbouncer.ini ${D}${sysconfdir}/pgbouncer/
+ install -m 0640 -g pgbouncer /dev/null ${D}${sysconfdir}/pgbouncer/userlist.txt
+ install -D -m 0755 ${UNPACKDIR}/pgbouncer.init ${D}${sysconfdir}/init.d/pgbouncer
+ install -D -m 0644 ${UNPACKDIR}/pgbouncer.service ${D}${systemd_system_unitdir}/pgbouncer.service
+}
+
+USERADD_PACKAGES = "${PN}"
+USERADD_PARAM:${PN} = "--system --home-dir /nonexistent --no-create-home --shell /sbin/nologin --user-group pgbouncer"
+
+INITSCRIPT_NAME = "pgbouncer"
+INITSCRIPT_PARAMS = "start 65 . stop 35 0 1 2 3 4 5 6 ."
+
+SYSTEMD_SERVICE:${PN} = "pgbouncer.service"
+SYSTEMD_AUTO_ENABLE:${PN} = "disable"
+
+CONFFILES:${PN} = "${sysconfdir}/pgbouncer/pgbouncer.ini \
+ ${sysconfdir}/pgbouncer/userlist.txt \
+ "
PgBouncer is a lightweight connection pooler for PostgreSQL. AI-Generated: Uses Claude (claude-opus-5-5) Signed-off-by: Babanpreet Singh <bbnpreetsingh@gmail.com> --- .../pgbouncer/pgbouncer/pgbouncer.init | 56 +++++++++++++++++++ .../pgbouncer/pgbouncer/pgbouncer.service | 18 ++++++ .../pgbouncer/pgbouncer_1.26.1.bb | 56 +++++++++++++++++++ 3 files changed, 130 insertions(+) create mode 100644 meta-networking/recipes-support/pgbouncer/pgbouncer/pgbouncer.init create mode 100644 meta-networking/recipes-support/pgbouncer/pgbouncer/pgbouncer.service create mode 100644 meta-networking/recipes-support/pgbouncer/pgbouncer_1.26.1.bb