Initial commit

This commit is contained in:
2025-09-30 20:55:34 +03:00
commit 905d2346b7
8 changed files with 150 additions and 0 deletions
+2
View File
@@ -0,0 +1,2 @@
# Exclude bpm archives
*.bpm
+15
View File
@@ -0,0 +1,15 @@
#!/bin/bash
# Git repository
REPO="https://git.postgresql.org/git/postgresql.git"
# Get tag name using 'git ls-remote'
TAG_NAME=$(git ls-remote --exit-code --refs --tags --sort='v:refname' "$REPO" | cut -d'/' -f3 | grep '^REL' | grep -v 'BETA\|RC' | tail -1)
# Trim prefix
VERSION=${TAG_NAME//REL_/}
# Replace '_' with '.'
VERSION=${VERSION//_/.}
echo "$VERSION"
+44
View File
@@ -0,0 +1,44 @@
name: postgresql
description: A powerful, open source object-relational database system
version: "18.0"
revision: 1
url: https://www.postgresql.org/
license: PostgreSQL
architecture: any
type: source
depends:
- gcc-libs
- glibc
- icu
- krb5
- openldap
- libxml2
- libxslt
- llvm-libs
- lz4
- openssl
- pam
- readline
- sysusers
- util-linux
- zlib
- zstd
optional_depends:
- perl
- python3
- tcl
make_depends:
- clang
- docbook-xml
- docbook-xsl-nons
- llvm
- perl
- perl-ipc-run
- python3
- tcl
- bzip2
downloads:
- url: https://ftp.postgresql.org/pub/source/v${BPM_PKG_VERSION}/postgresql-${BPM_PKG_VERSION}.tar.bz2
extract_to_bpm_source: true
extract_strip_components: 1
checksum: 0d5b903b1e5fe361bca7aa9507519933773eb34266b1357c4e7780fdee6d6078
+5
View File
@@ -0,0 +1,5 @@
#!/bin/bash
if [ -d /srv/pgsql/data ]; then
/usr/bin/postgresql-check-db-dir /srv/pgsql/data || true
fi
+6
View File
@@ -0,0 +1,6 @@
name: postgresql
description: Postgresql system daemon
type: background
start_cmd: /etc/esvm/scripts/postgresql.sh
exit_method: kill
restart: true
+17
View File
@@ -0,0 +1,17 @@
#!/bin/sh
PGROOT=/srv/postgresql
PGDATA="$PGROOT"/data
[ -d /run/postgresql ] || install -d -o postgres -g postgres /run/postgresql
[ "$PGROOT" != "/srv/postgresql" ] && ln -sf "$PGROOT" /srv/postgresql
if [ ! -d "$PGDATA" ]; then
install -dm0700 -o postgres -g postgres "$PGDATA"
su - postgres -m -c "/usr/bin/initdb -D '$PGDATA'"
[ -f /etc/postgresql/postgresql.conf ] && ln -sf /etc/postgresql/postgresql.conf "$PGDATA"/postgresql.conf
fi
exec su - postgres -m -c "/usr/bin/postgres -D '$PGDATA'"
+1
View File
@@ -0,0 +1 @@
u postgres 41 "PostgreSQL user" /srv/postgresql/ /bin/bash
+60
View File
@@ -0,0 +1,60 @@
# This is the source.sh script. It is executed by BPM in a temporary directory when compiling a source package
# BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE
# BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT
# The prepare function is executed in the root of the temp directory
# This function is used for putting downloaded files to the correct location or applying patches
prepare() {
# Fix typo in sgml file
sed -i -e 's/"app-pgchecksums "/"app-pgchecksums"/' "$BPM_SOURCE"/doc/src/sgml/ref/pg_combinebackup.sgml
# Change server socket location from /tmp to /run/postgresql
sed -i -e '/DEFAULT_PGSOCKET_DIR/s@/tmp@/run/postgresql@' "$BPM_SOURCE"/src/include/pg_config_manual.h
}
# The build function is executed in the source directory
# This function is used to compile the source code
build() {
./configure --prefix=/usr \
--sysconfdir=/etc \
--mandir=/usr/share/man \
--datadir=/usr/share/postgresql \
--disable-rpath \
--enable-nls \
--enable-tap-tests \
--with-gssapi \
--with-icu \
--with-ldap \
--with-libxml \
--with-libxslt \
--with-llvm \
--with-lz4 \
--with-openssl \
--with-pam \
--with-perl \
--with-python \
--with-readline \
--with-system-tzdata=/usr/share/zoneinfo \
--without-systemd \
--with-tcl \
--with-uuid=e2fs \
--with-zstd
make
}
# The package function is executed in the source directory
# This function is used to move the compiled files into the output directory
package() {
make DESTDIR="$BPM_OUTPUT" install install-docs
make -C contrib DESTDIR="$BPM_OUTPUT" install
# Install esvm service
install -Dm755 "$BPM_WORKDIR"/postgresql.sh "$BPM_OUTPUT"/etc/esvm/scripts/postgresql.sh
install -Dm644 "$BPM_WORKDIR"/postgresql.esv "$BPM_OUTPUT"/etc/esvm/services/postgresql.esv
# Install sysusers file
install -Dm644 "$BPM_WORKDIR"/sysusers "$BPM_OUTPUT"/usr/lib/sysusers.d/postgresql.conf
# Install package license
install -Dm644 "$BPM_SOURCE"/COPYRIGHT "$BPM_OUTPUT"/usr/share/licenses/postgresql/COPYRIGHT
}