From 353cfc25f1c06c51e91af44f26b826aefcb9b643 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Sun, 29 Oct 2023 15:56:04 +0300 Subject: [PATCH] Improve PostgreSQL init script --- specs/postgresql-10/SOURCES/postgresql.init | 24 ++++++++++----------- specs/postgresql-10/postgresql-10.spec | 9 +++++--- specs/postgresql-11/SOURCES/postgresql.init | 24 ++++++++++----------- specs/postgresql-11/postgresql-11.spec | 9 +++++--- specs/postgresql-12/SOURCES/postgresql.init | 24 ++++++++++----------- specs/postgresql-12/postgresql-12.spec | 9 +++++--- specs/postgresql-13/SOURCES/postgresql.init | 24 ++++++++++----------- specs/postgresql-13/postgresql-13.spec | 9 +++++--- specs/postgresql-14/SOURCES/postgresql.init | 24 ++++++++++----------- specs/postgresql-14/postgresql-14.spec | 9 +++++--- specs/postgresql-15/SOURCES/postgresql.init | 24 ++++++++++----------- specs/postgresql-15/postgresql-15.spec | 6 +++--- specs/postgresql-16/SOURCES/postgresql.init | 22 +++++++++---------- specs/postgresql-16/postgresql-16.spec | 9 +++++--- 14 files changed, 122 insertions(+), 104 deletions(-) diff --git a/specs/postgresql-10/SOURCES/postgresql.init b/specs/postgresql-10/SOURCES/postgresql.init index 02093259f..afcf9dd86 100644 --- a/specs/postgresql-10/SOURCES/postgresql.init +++ b/specs/postgresql-10/SOURCES/postgresql.init @@ -1,7 +1,7 @@ #!/bin/bash -# postgresql This is the init script for starting up the PostgreSQL -# server. +# postgresql This is the init script for starting up the PostgreSQL {{MAJOR_VERSION}} +# server. # # chkconfig: - 64 36 # description: PostgreSQL database server. @@ -32,12 +32,12 @@ GROUP_NAME="{{GROUP_NAME}}" short_name="pgsql" -kv[prog_name]="postgresql" +kv[prog_name]="postgresql-${PKG_VERSION}" -kv.readSysconfig "${kv[prog_name]}-${MAJOR_VERSION}" +kv.readSysconfig "postgresql-${MAJOR_VERSION}" -kv[lock_file]="${kv[lock_dir]}/${kv[prog_name]}${PKG_VERSION}" -kv[pid_file]="${kv[pid_dir]}/${kv[prog_name]}${PKG_VERSION}.pid" +kv[lock_file]="${kv[lock_dir]}/${kv[prog_name]}" +kv[pid_file]="${kv[pid_dir]}/${kv[prog_name]}.pid" pg_engine="${PG_ENGINE:-/usr/${short_name}-${MAJOR_VERSION}/bin}" pg_postmaster="${PG_POSTMASTER:-${pg_engine}/postmaster}" @@ -153,8 +153,8 @@ upgrade() { local cur_version="${1-$MAJOR_VERSION}" local prev_version="${2-$PREV_VERSION}" - local cur_init="${kv[prog_name]}-$cur_version" - local prev_init="${kv[prog_name]}-$prev_version" + local cur_init="postgresql-$cur_version" + local prev_init="postgresql-$prev_version" if [[ ! -f "$INIT_DIR/$cur_init" ]] ; then kv.error "Couldn't find init script $INIT_DIR/$cur_init" $ACTION_ERROR @@ -171,10 +171,10 @@ upgrade() { return $ACTION_ERROR fi - local old_data=$(sed -n 's/^PGDATA=//p' "$INIT_DIR/${kv[prog_name]}-$cur_version") - local old_port=$(sed -n 's/^PGPORT=//p' "$INIT_DIR/${kv[prog_name]}-$prev_version") - local new_data=$(sed -n 's/^PGDATA=//p' "$INIT_DIR/${kv[prog_name]}-$cur_version") - local new_port=$(sed -n 's/^PGPORT=//p' "$INIT_DIR/${kv[prog_name]}-$prev_version") + local old_data=$(sed -n 's/^PGDATA=//p' "$INIT_DIR/postgresql-$cur_version") + local old_port=$(sed -n 's/^PGPORT=//p' "$INIT_DIR/postgresql-$prev_version") + local new_data=$(sed -n 's/^PGDATA=//p' "$INIT_DIR/postgresql-$cur_version") + local new_port=$(sed -n 's/^PGPORT=//p' "$INIT_DIR/postgresql-$prev_version") /sbin/service "${PROG_NAME}${PKG_VERSION}" initdb diff --git a/specs/postgresql-10/postgresql-10.spec b/specs/postgresql-10/postgresql-10.spec index 2067cf906..c5e19f6ae 100644 --- a/specs/postgresql-10/postgresql-10.spec +++ b/specs/postgresql-10/postgresql-10.spec @@ -23,7 +23,7 @@ %define majorver 10 %define minorver 23 -%define rel 0 +%define rel 1 %define fullver %{majorver}.%{minorver} %define pkgver 10 %define realname postgresql @@ -141,7 +141,7 @@ PostgreSQL is an advanced Object-Relational database management system (DBMS) that supports almost all SQL constructs (including transactions, subselects and user-defined types and functions). The postgresql package includes the client programs and libraries that -you'll need to access a PostgreSQL DBMS server. These PostgreSQL +you'll need to access a PostgreSQL DBMS server. These PostgreSQL client programs are programs that directly manipulate the internal structure of PostgreSQL databases on a PostgreSQL server. These client programs can be located on the same machine with the PostgreSQL @@ -499,7 +499,7 @@ sed -i 's/{{PREV_VERSION}}/%{prev_version}/g' %{buildroot}%{_unitdir}/postgresql sed -i 's/{{USER_NAME}}/%{username}/g' %{buildroot}%{_unitdir}/postgresql-%{majorver}.service sed -i 's/{{GROUP_NAME}}/%{groupname}/g' %{buildroot}%{_unitdir}/postgresql-%{majorver}.service -ln -sf %{_initddir}/%{service_name} %{buildroot}%{_initddir}/%{tinyname}%{majorver} +ln -sf %{service_name} %{buildroot}%{_initddir}/%{tinyname}%{majorver} %if %pam install -d %{buildroot}%{_sysconfdir}/pam.d @@ -1080,6 +1080,9 @@ rm -rf %{buildroot} ################################################################################ %changelog +* Sun Oct 29 2023 Anton Novojilov - 10.23-1 +- Improved init script compatibility with systemd + * Thu Feb 09 2023 Anton Novojilov - 10.23-0 - https://www.postgresql.org/docs/10/release-10-23.html diff --git a/specs/postgresql-11/SOURCES/postgresql.init b/specs/postgresql-11/SOURCES/postgresql.init index 02093259f..afcf9dd86 100644 --- a/specs/postgresql-11/SOURCES/postgresql.init +++ b/specs/postgresql-11/SOURCES/postgresql.init @@ -1,7 +1,7 @@ #!/bin/bash -# postgresql This is the init script for starting up the PostgreSQL -# server. +# postgresql This is the init script for starting up the PostgreSQL {{MAJOR_VERSION}} +# server. # # chkconfig: - 64 36 # description: PostgreSQL database server. @@ -32,12 +32,12 @@ GROUP_NAME="{{GROUP_NAME}}" short_name="pgsql" -kv[prog_name]="postgresql" +kv[prog_name]="postgresql-${PKG_VERSION}" -kv.readSysconfig "${kv[prog_name]}-${MAJOR_VERSION}" +kv.readSysconfig "postgresql-${MAJOR_VERSION}" -kv[lock_file]="${kv[lock_dir]}/${kv[prog_name]}${PKG_VERSION}" -kv[pid_file]="${kv[pid_dir]}/${kv[prog_name]}${PKG_VERSION}.pid" +kv[lock_file]="${kv[lock_dir]}/${kv[prog_name]}" +kv[pid_file]="${kv[pid_dir]}/${kv[prog_name]}.pid" pg_engine="${PG_ENGINE:-/usr/${short_name}-${MAJOR_VERSION}/bin}" pg_postmaster="${PG_POSTMASTER:-${pg_engine}/postmaster}" @@ -153,8 +153,8 @@ upgrade() { local cur_version="${1-$MAJOR_VERSION}" local prev_version="${2-$PREV_VERSION}" - local cur_init="${kv[prog_name]}-$cur_version" - local prev_init="${kv[prog_name]}-$prev_version" + local cur_init="postgresql-$cur_version" + local prev_init="postgresql-$prev_version" if [[ ! -f "$INIT_DIR/$cur_init" ]] ; then kv.error "Couldn't find init script $INIT_DIR/$cur_init" $ACTION_ERROR @@ -171,10 +171,10 @@ upgrade() { return $ACTION_ERROR fi - local old_data=$(sed -n 's/^PGDATA=//p' "$INIT_DIR/${kv[prog_name]}-$cur_version") - local old_port=$(sed -n 's/^PGPORT=//p' "$INIT_DIR/${kv[prog_name]}-$prev_version") - local new_data=$(sed -n 's/^PGDATA=//p' "$INIT_DIR/${kv[prog_name]}-$cur_version") - local new_port=$(sed -n 's/^PGPORT=//p' "$INIT_DIR/${kv[prog_name]}-$prev_version") + local old_data=$(sed -n 's/^PGDATA=//p' "$INIT_DIR/postgresql-$cur_version") + local old_port=$(sed -n 's/^PGPORT=//p' "$INIT_DIR/postgresql-$prev_version") + local new_data=$(sed -n 's/^PGDATA=//p' "$INIT_DIR/postgresql-$cur_version") + local new_port=$(sed -n 's/^PGPORT=//p' "$INIT_DIR/postgresql-$prev_version") /sbin/service "${PROG_NAME}${PKG_VERSION}" initdb diff --git a/specs/postgresql-11/postgresql-11.spec b/specs/postgresql-11/postgresql-11.spec index 984fb153d..3ba68f9a5 100644 --- a/specs/postgresql-11/postgresql-11.spec +++ b/specs/postgresql-11/postgresql-11.spec @@ -24,7 +24,7 @@ %define majorver 11 %define minorver 21 -%define rel 0 +%define rel 1 %define fullver %{majorver}.%{minorver} %define pkgver 11 %define realname postgresql @@ -151,7 +151,7 @@ PostgreSQL is an advanced Object-Relational database management system (DBMS) that supports almost all SQL constructs (including transactions, subselects and user-defined types and functions). The postgresql package includes the client programs and libraries that -you'll need to access a PostgreSQL DBMS server. These PostgreSQL +you'll need to access a PostgreSQL DBMS server. These PostgreSQL client programs are programs that directly manipulate the internal structure of PostgreSQL databases on a PostgreSQL server. These client programs can be located on the same machine with the PostgreSQL @@ -548,7 +548,7 @@ sed -i 's/{{PREV_VERSION}}/%{prev_version}/g' %{buildroot}%{_unitdir}/postgresql sed -i 's/{{USER_NAME}}/%{username}/g' %{buildroot}%{_unitdir}/postgresql-%{majorver}.service sed -i 's/{{GROUP_NAME}}/%{groupname}/g' %{buildroot}%{_unitdir}/postgresql-%{majorver}.service -ln -sf %{_initddir}/%{service_name} %{buildroot}%{_initddir}/%{tinyname}%{majorver} +ln -sf %{service_name} %{buildroot}%{_initddir}/%{tinyname}%{majorver} %if %pam install -d %{buildroot}%{_sysconfdir}/pam.d @@ -1145,6 +1145,9 @@ rm -rf %{buildroot} ################################################################################ %changelog +* Sun Oct 29 2023 Anton Novojilov - 11.21-1 +- Improved init script compatibility with systemd + * Wed Sep 20 2023 Anton Novojilov - 11.21-0 - https://www.postgresql.org/docs/11/release-11-21.html diff --git a/specs/postgresql-12/SOURCES/postgresql.init b/specs/postgresql-12/SOURCES/postgresql.init index 02093259f..afcf9dd86 100644 --- a/specs/postgresql-12/SOURCES/postgresql.init +++ b/specs/postgresql-12/SOURCES/postgresql.init @@ -1,7 +1,7 @@ #!/bin/bash -# postgresql This is the init script for starting up the PostgreSQL -# server. +# postgresql This is the init script for starting up the PostgreSQL {{MAJOR_VERSION}} +# server. # # chkconfig: - 64 36 # description: PostgreSQL database server. @@ -32,12 +32,12 @@ GROUP_NAME="{{GROUP_NAME}}" short_name="pgsql" -kv[prog_name]="postgresql" +kv[prog_name]="postgresql-${PKG_VERSION}" -kv.readSysconfig "${kv[prog_name]}-${MAJOR_VERSION}" +kv.readSysconfig "postgresql-${MAJOR_VERSION}" -kv[lock_file]="${kv[lock_dir]}/${kv[prog_name]}${PKG_VERSION}" -kv[pid_file]="${kv[pid_dir]}/${kv[prog_name]}${PKG_VERSION}.pid" +kv[lock_file]="${kv[lock_dir]}/${kv[prog_name]}" +kv[pid_file]="${kv[pid_dir]}/${kv[prog_name]}.pid" pg_engine="${PG_ENGINE:-/usr/${short_name}-${MAJOR_VERSION}/bin}" pg_postmaster="${PG_POSTMASTER:-${pg_engine}/postmaster}" @@ -153,8 +153,8 @@ upgrade() { local cur_version="${1-$MAJOR_VERSION}" local prev_version="${2-$PREV_VERSION}" - local cur_init="${kv[prog_name]}-$cur_version" - local prev_init="${kv[prog_name]}-$prev_version" + local cur_init="postgresql-$cur_version" + local prev_init="postgresql-$prev_version" if [[ ! -f "$INIT_DIR/$cur_init" ]] ; then kv.error "Couldn't find init script $INIT_DIR/$cur_init" $ACTION_ERROR @@ -171,10 +171,10 @@ upgrade() { return $ACTION_ERROR fi - local old_data=$(sed -n 's/^PGDATA=//p' "$INIT_DIR/${kv[prog_name]}-$cur_version") - local old_port=$(sed -n 's/^PGPORT=//p' "$INIT_DIR/${kv[prog_name]}-$prev_version") - local new_data=$(sed -n 's/^PGDATA=//p' "$INIT_DIR/${kv[prog_name]}-$cur_version") - local new_port=$(sed -n 's/^PGPORT=//p' "$INIT_DIR/${kv[prog_name]}-$prev_version") + local old_data=$(sed -n 's/^PGDATA=//p' "$INIT_DIR/postgresql-$cur_version") + local old_port=$(sed -n 's/^PGPORT=//p' "$INIT_DIR/postgresql-$prev_version") + local new_data=$(sed -n 's/^PGDATA=//p' "$INIT_DIR/postgresql-$cur_version") + local new_port=$(sed -n 's/^PGPORT=//p' "$INIT_DIR/postgresql-$prev_version") /sbin/service "${PROG_NAME}${PKG_VERSION}" initdb diff --git a/specs/postgresql-12/postgresql-12.spec b/specs/postgresql-12/postgresql-12.spec index ceeb84384..6040e2d5b 100644 --- a/specs/postgresql-12/postgresql-12.spec +++ b/specs/postgresql-12/postgresql-12.spec @@ -24,7 +24,7 @@ %define majorver 12 %define minorver 16 -%define rel 0 +%define rel 1 %define fullver %{majorver}.%{minorver} %define pkgver 12 %define realname postgresql @@ -151,7 +151,7 @@ PostgreSQL is an advanced Object-Relational database management system (DBMS) that supports almost all SQL constructs (including transactions, subselects and user-defined types and functions). The postgresql package includes the client programs and libraries that -you'll need to access a PostgreSQL DBMS server. These PostgreSQL +you'll need to access a PostgreSQL DBMS server. These PostgreSQL client programs are programs that directly manipulate the internal structure of PostgreSQL databases on a PostgreSQL server. These client programs can be located on the same machine with the PostgreSQL @@ -550,7 +550,7 @@ sed -i 's/{{PREV_VERSION}}/%{prev_version}/g' %{buildroot}%{_unitdir}/postgresql sed -i 's/{{USER_NAME}}/%{username}/g' %{buildroot}%{_unitdir}/postgresql-%{majorver}.service sed -i 's/{{GROUP_NAME}}/%{groupname}/g' %{buildroot}%{_unitdir}/postgresql-%{majorver}.service -ln -sf %{_initddir}/%{service_name} %{buildroot}%{_initddir}/%{tinyname}%{majorver} +ln -sf %{service_name} %{buildroot}%{_initddir}/%{tinyname}%{majorver} %if %pam install -d %{buildroot}%{_sysconfdir}/pam.d @@ -1147,6 +1147,9 @@ rm -rf %{buildroot} ################################################################################ %changelog +* Sun Oct 29 2023 Anton Novojilov - 12.16-1 +- Improved init script compatibility with systemd + * Wed Sep 20 2023 Anton Novojilov - 12.16-0 - https://www.postgresql.org/docs/12/release-12-16.html diff --git a/specs/postgresql-13/SOURCES/postgresql.init b/specs/postgresql-13/SOURCES/postgresql.init index 02093259f..afcf9dd86 100644 --- a/specs/postgresql-13/SOURCES/postgresql.init +++ b/specs/postgresql-13/SOURCES/postgresql.init @@ -1,7 +1,7 @@ #!/bin/bash -# postgresql This is the init script for starting up the PostgreSQL -# server. +# postgresql This is the init script for starting up the PostgreSQL {{MAJOR_VERSION}} +# server. # # chkconfig: - 64 36 # description: PostgreSQL database server. @@ -32,12 +32,12 @@ GROUP_NAME="{{GROUP_NAME}}" short_name="pgsql" -kv[prog_name]="postgresql" +kv[prog_name]="postgresql-${PKG_VERSION}" -kv.readSysconfig "${kv[prog_name]}-${MAJOR_VERSION}" +kv.readSysconfig "postgresql-${MAJOR_VERSION}" -kv[lock_file]="${kv[lock_dir]}/${kv[prog_name]}${PKG_VERSION}" -kv[pid_file]="${kv[pid_dir]}/${kv[prog_name]}${PKG_VERSION}.pid" +kv[lock_file]="${kv[lock_dir]}/${kv[prog_name]}" +kv[pid_file]="${kv[pid_dir]}/${kv[prog_name]}.pid" pg_engine="${PG_ENGINE:-/usr/${short_name}-${MAJOR_VERSION}/bin}" pg_postmaster="${PG_POSTMASTER:-${pg_engine}/postmaster}" @@ -153,8 +153,8 @@ upgrade() { local cur_version="${1-$MAJOR_VERSION}" local prev_version="${2-$PREV_VERSION}" - local cur_init="${kv[prog_name]}-$cur_version" - local prev_init="${kv[prog_name]}-$prev_version" + local cur_init="postgresql-$cur_version" + local prev_init="postgresql-$prev_version" if [[ ! -f "$INIT_DIR/$cur_init" ]] ; then kv.error "Couldn't find init script $INIT_DIR/$cur_init" $ACTION_ERROR @@ -171,10 +171,10 @@ upgrade() { return $ACTION_ERROR fi - local old_data=$(sed -n 's/^PGDATA=//p' "$INIT_DIR/${kv[prog_name]}-$cur_version") - local old_port=$(sed -n 's/^PGPORT=//p' "$INIT_DIR/${kv[prog_name]}-$prev_version") - local new_data=$(sed -n 's/^PGDATA=//p' "$INIT_DIR/${kv[prog_name]}-$cur_version") - local new_port=$(sed -n 's/^PGPORT=//p' "$INIT_DIR/${kv[prog_name]}-$prev_version") + local old_data=$(sed -n 's/^PGDATA=//p' "$INIT_DIR/postgresql-$cur_version") + local old_port=$(sed -n 's/^PGPORT=//p' "$INIT_DIR/postgresql-$prev_version") + local new_data=$(sed -n 's/^PGDATA=//p' "$INIT_DIR/postgresql-$cur_version") + local new_port=$(sed -n 's/^PGPORT=//p' "$INIT_DIR/postgresql-$prev_version") /sbin/service "${PROG_NAME}${PKG_VERSION}" initdb diff --git a/specs/postgresql-13/postgresql-13.spec b/specs/postgresql-13/postgresql-13.spec index be1d53ea5..501366eb0 100644 --- a/specs/postgresql-13/postgresql-13.spec +++ b/specs/postgresql-13/postgresql-13.spec @@ -24,7 +24,7 @@ %define majorver 13 %define minorver 12 -%define rel 0 +%define rel 1 %define fullver %{majorver}.%{minorver} %define pkgver 13 %define realname postgresql @@ -151,7 +151,7 @@ PostgreSQL is an advanced Object-Relational database management system (DBMS) that supports almost all SQL constructs (including transactions, subselects and user-defined types and functions). The postgresql package includes the client programs and libraries that -you'll need to access a PostgreSQL DBMS server. These PostgreSQL +you'll need to access a PostgreSQL DBMS server. These PostgreSQL client programs are programs that directly manipulate the internal structure of PostgreSQL databases on a PostgreSQL server. These client programs can be located on the same machine with the PostgreSQL @@ -550,7 +550,7 @@ sed -i 's/{{PREV_VERSION}}/%{prev_version}/g' %{buildroot}%{_unitdir}/postgresql sed -i 's/{{USER_NAME}}/%{username}/g' %{buildroot}%{_unitdir}/postgresql-%{majorver}.service sed -i 's/{{GROUP_NAME}}/%{groupname}/g' %{buildroot}%{_unitdir}/postgresql-%{majorver}.service -ln -sf %{_initddir}/%{service_name} %{buildroot}%{_initddir}/%{tinyname}%{majorver} +ln -sf %{service_name} %{buildroot}%{_initddir}/%{tinyname}%{majorver} %if %pam install -d %{buildroot}%{_sysconfdir}/pam.d @@ -1150,6 +1150,9 @@ rm -rf %{buildroot} ################################################################################ %changelog +* Sun Oct 29 2023 Anton Novojilov - 13.12-1 +- Improved init script compatibility with systemd + * Wed Sep 20 2023 Anton Novojilov - 13.12-0 - https://www.postgresql.org/docs/13/release-13-12.html diff --git a/specs/postgresql-14/SOURCES/postgresql.init b/specs/postgresql-14/SOURCES/postgresql.init index 02093259f..afcf9dd86 100644 --- a/specs/postgresql-14/SOURCES/postgresql.init +++ b/specs/postgresql-14/SOURCES/postgresql.init @@ -1,7 +1,7 @@ #!/bin/bash -# postgresql This is the init script for starting up the PostgreSQL -# server. +# postgresql This is the init script for starting up the PostgreSQL {{MAJOR_VERSION}} +# server. # # chkconfig: - 64 36 # description: PostgreSQL database server. @@ -32,12 +32,12 @@ GROUP_NAME="{{GROUP_NAME}}" short_name="pgsql" -kv[prog_name]="postgresql" +kv[prog_name]="postgresql-${PKG_VERSION}" -kv.readSysconfig "${kv[prog_name]}-${MAJOR_VERSION}" +kv.readSysconfig "postgresql-${MAJOR_VERSION}" -kv[lock_file]="${kv[lock_dir]}/${kv[prog_name]}${PKG_VERSION}" -kv[pid_file]="${kv[pid_dir]}/${kv[prog_name]}${PKG_VERSION}.pid" +kv[lock_file]="${kv[lock_dir]}/${kv[prog_name]}" +kv[pid_file]="${kv[pid_dir]}/${kv[prog_name]}.pid" pg_engine="${PG_ENGINE:-/usr/${short_name}-${MAJOR_VERSION}/bin}" pg_postmaster="${PG_POSTMASTER:-${pg_engine}/postmaster}" @@ -153,8 +153,8 @@ upgrade() { local cur_version="${1-$MAJOR_VERSION}" local prev_version="${2-$PREV_VERSION}" - local cur_init="${kv[prog_name]}-$cur_version" - local prev_init="${kv[prog_name]}-$prev_version" + local cur_init="postgresql-$cur_version" + local prev_init="postgresql-$prev_version" if [[ ! -f "$INIT_DIR/$cur_init" ]] ; then kv.error "Couldn't find init script $INIT_DIR/$cur_init" $ACTION_ERROR @@ -171,10 +171,10 @@ upgrade() { return $ACTION_ERROR fi - local old_data=$(sed -n 's/^PGDATA=//p' "$INIT_DIR/${kv[prog_name]}-$cur_version") - local old_port=$(sed -n 's/^PGPORT=//p' "$INIT_DIR/${kv[prog_name]}-$prev_version") - local new_data=$(sed -n 's/^PGDATA=//p' "$INIT_DIR/${kv[prog_name]}-$cur_version") - local new_port=$(sed -n 's/^PGPORT=//p' "$INIT_DIR/${kv[prog_name]}-$prev_version") + local old_data=$(sed -n 's/^PGDATA=//p' "$INIT_DIR/postgresql-$cur_version") + local old_port=$(sed -n 's/^PGPORT=//p' "$INIT_DIR/postgresql-$prev_version") + local new_data=$(sed -n 's/^PGDATA=//p' "$INIT_DIR/postgresql-$cur_version") + local new_port=$(sed -n 's/^PGPORT=//p' "$INIT_DIR/postgresql-$prev_version") /sbin/service "${PROG_NAME}${PKG_VERSION}" initdb diff --git a/specs/postgresql-14/postgresql-14.spec b/specs/postgresql-14/postgresql-14.spec index a4b51d5fb..1f7a0efa6 100644 --- a/specs/postgresql-14/postgresql-14.spec +++ b/specs/postgresql-14/postgresql-14.spec @@ -24,7 +24,7 @@ %define majorver 14 %define minorver 9 -%define rel 0 +%define rel 1 %define fullver %{majorver}.%{minorver} %define pkgver 14 %define realname postgresql @@ -151,7 +151,7 @@ PostgreSQL is an advanced Object-Relational database management system (DBMS) that supports almost all SQL constructs (including transactions, subselects and user-defined types and functions). The postgresql package includes the client programs and libraries that -you'll need to access a PostgreSQL DBMS server. These PostgreSQL +you'll need to access a PostgreSQL DBMS server. These PostgreSQL client programs are programs that directly manipulate the internal structure of PostgreSQL databases on a PostgreSQL server. These client programs can be located on the same machine with the PostgreSQL @@ -550,7 +550,7 @@ sed -i 's/{{PREV_VERSION}}/%{prev_version}/g' %{buildroot}%{_unitdir}/postgresql sed -i 's/{{USER_NAME}}/%{username}/g' %{buildroot}%{_unitdir}/postgresql-%{majorver}.service sed -i 's/{{GROUP_NAME}}/%{groupname}/g' %{buildroot}%{_unitdir}/postgresql-%{majorver}.service -ln -sf %{_initddir}/%{service_name} %{buildroot}%{_initddir}/%{tinyname}%{majorver} +ln -sf %{service_name} %{buildroot}%{_initddir}/%{tinyname}%{majorver} %if %pam install -d %{buildroot}%{_sysconfdir}/pam.d @@ -1158,6 +1158,9 @@ rm -rf %{buildroot} ################################################################################ %changelog +* Sun Oct 29 2023 Anton Novojilov - 14.9-1 +- Improved init script compatibility with systemd + * Wed Sep 20 2023 Anton Novojilov - 14.9-0 - https://www.postgresql.org/docs/14/release-14-9.html diff --git a/specs/postgresql-15/SOURCES/postgresql.init b/specs/postgresql-15/SOURCES/postgresql.init index 02093259f..afcf9dd86 100644 --- a/specs/postgresql-15/SOURCES/postgresql.init +++ b/specs/postgresql-15/SOURCES/postgresql.init @@ -1,7 +1,7 @@ #!/bin/bash -# postgresql This is the init script for starting up the PostgreSQL -# server. +# postgresql This is the init script for starting up the PostgreSQL {{MAJOR_VERSION}} +# server. # # chkconfig: - 64 36 # description: PostgreSQL database server. @@ -32,12 +32,12 @@ GROUP_NAME="{{GROUP_NAME}}" short_name="pgsql" -kv[prog_name]="postgresql" +kv[prog_name]="postgresql-${PKG_VERSION}" -kv.readSysconfig "${kv[prog_name]}-${MAJOR_VERSION}" +kv.readSysconfig "postgresql-${MAJOR_VERSION}" -kv[lock_file]="${kv[lock_dir]}/${kv[prog_name]}${PKG_VERSION}" -kv[pid_file]="${kv[pid_dir]}/${kv[prog_name]}${PKG_VERSION}.pid" +kv[lock_file]="${kv[lock_dir]}/${kv[prog_name]}" +kv[pid_file]="${kv[pid_dir]}/${kv[prog_name]}.pid" pg_engine="${PG_ENGINE:-/usr/${short_name}-${MAJOR_VERSION}/bin}" pg_postmaster="${PG_POSTMASTER:-${pg_engine}/postmaster}" @@ -153,8 +153,8 @@ upgrade() { local cur_version="${1-$MAJOR_VERSION}" local prev_version="${2-$PREV_VERSION}" - local cur_init="${kv[prog_name]}-$cur_version" - local prev_init="${kv[prog_name]}-$prev_version" + local cur_init="postgresql-$cur_version" + local prev_init="postgresql-$prev_version" if [[ ! -f "$INIT_DIR/$cur_init" ]] ; then kv.error "Couldn't find init script $INIT_DIR/$cur_init" $ACTION_ERROR @@ -171,10 +171,10 @@ upgrade() { return $ACTION_ERROR fi - local old_data=$(sed -n 's/^PGDATA=//p' "$INIT_DIR/${kv[prog_name]}-$cur_version") - local old_port=$(sed -n 's/^PGPORT=//p' "$INIT_DIR/${kv[prog_name]}-$prev_version") - local new_data=$(sed -n 's/^PGDATA=//p' "$INIT_DIR/${kv[prog_name]}-$cur_version") - local new_port=$(sed -n 's/^PGPORT=//p' "$INIT_DIR/${kv[prog_name]}-$prev_version") + local old_data=$(sed -n 's/^PGDATA=//p' "$INIT_DIR/postgresql-$cur_version") + local old_port=$(sed -n 's/^PGPORT=//p' "$INIT_DIR/postgresql-$prev_version") + local new_data=$(sed -n 's/^PGDATA=//p' "$INIT_DIR/postgresql-$cur_version") + local new_port=$(sed -n 's/^PGPORT=//p' "$INIT_DIR/postgresql-$prev_version") /sbin/service "${PROG_NAME}${PKG_VERSION}" initdb diff --git a/specs/postgresql-15/postgresql-15.spec b/specs/postgresql-15/postgresql-15.spec index ee3992c3d..6c537ed66 100644 --- a/specs/postgresql-15/postgresql-15.spec +++ b/specs/postgresql-15/postgresql-15.spec @@ -25,7 +25,7 @@ %define majorver 15 %define minorver 4 -%define rel 0 +%define rel 1 %define fullver %{majorver}.%{minorver} %define pkgver 15 %define realname postgresql @@ -157,7 +157,7 @@ PostgreSQL is an advanced Object-Relational database management system (DBMS) that supports almost all SQL constructs (including transactions, subselects and user-defined types and functions). The postgresql package includes the client programs and libraries that -you'll need to access a PostgreSQL DBMS server. These PostgreSQL +you'll need to access a PostgreSQL DBMS server. These PostgreSQL client programs are programs that directly manipulate the internal structure of PostgreSQL databases on a PostgreSQL server. These client programs can be located on the same machine with the PostgreSQL @@ -559,7 +559,7 @@ sed -i 's/{{PREV_VERSION}}/%{prev_version}/g' %{buildroot}%{_unitdir}/postgresql sed -i 's/{{USER_NAME}}/%{username}/g' %{buildroot}%{_unitdir}/postgresql-%{majorver}.service sed -i 's/{{GROUP_NAME}}/%{groupname}/g' %{buildroot}%{_unitdir}/postgresql-%{majorver}.service -ln -sf %{_initddir}/%{service_name} %{buildroot}%{_initddir}/%{tinyname}%{majorver} +ln -sf %{service_name} %{buildroot}%{_initddir}/%{tinyname}%{majorver} %if %pam install -d %{buildroot}%{_sysconfdir}/pam.d diff --git a/specs/postgresql-16/SOURCES/postgresql.init b/specs/postgresql-16/SOURCES/postgresql.init index 4c8c07d30..e64188a30 100644 --- a/specs/postgresql-16/SOURCES/postgresql.init +++ b/specs/postgresql-16/SOURCES/postgresql.init @@ -1,7 +1,7 @@ #!/bin/bash -# postgresql This is the init script for starting up the PostgreSQL -# server. +# postgresql This is the init script for starting up the PostgreSQL {{MAJOR_VERSION}} +# server. # # chkconfig: - 64 36 # description: PostgreSQL database server. @@ -32,12 +32,12 @@ GROUP_NAME="{{GROUP_NAME}}" short_name="pgsql" -kv[prog_name]="postgresql" +kv[prog_name]="postgresql-${PKG_VERSION}" kv.readSysconfig "${kv[prog_name]}-${MAJOR_VERSION}" -kv[lock_file]="${kv[lock_dir]}/${kv[prog_name]}${PKG_VERSION}" -kv[pid_file]="${kv[pid_dir]}/${kv[prog_name]}${PKG_VERSION}.pid" +kv[lock_file]="${kv[lock_dir]}/${kv[prog_name]}" +kv[pid_file]="${kv[pid_dir]}/${kv[prog_name]}.pid" pg_engine="${PG_ENGINE:-/usr/${short_name}-${MAJOR_VERSION}/bin}" pg_postgres="${PG_POSTGRES:-${pg_engine}/postgres}" @@ -153,8 +153,8 @@ upgrade() { local cur_version="${1-$MAJOR_VERSION}" local prev_version="${2-$PREV_VERSION}" - local cur_init="${kv[prog_name]}-$cur_version" - local prev_init="${kv[prog_name]}-$prev_version" + local cur_init="postgresql-$cur_version" + local prev_init="postgresql-$prev_version" if [[ ! -f "$INIT_DIR/$cur_init" ]] ; then kv.error "Couldn't find init script $INIT_DIR/$cur_init" $ACTION_ERROR @@ -171,10 +171,10 @@ upgrade() { return $ACTION_ERROR fi - local old_data=$(sed -n 's/^PGDATA=//p' "$INIT_DIR/${kv[prog_name]}-$cur_version") - local old_port=$(sed -n 's/^PGPORT=//p' "$INIT_DIR/${kv[prog_name]}-$prev_version") - local new_data=$(sed -n 's/^PGDATA=//p' "$INIT_DIR/${kv[prog_name]}-$cur_version") - local new_port=$(sed -n 's/^PGPORT=//p' "$INIT_DIR/${kv[prog_name]}-$prev_version") + local old_data=$(sed -n 's/^PGDATA=//p' "$INIT_DIR/postgresql-$cur_version") + local old_port=$(sed -n 's/^PGPORT=//p' "$INIT_DIR/postgresql-$prev_version") + local new_data=$(sed -n 's/^PGDATA=//p' "$INIT_DIR/postgresql-$cur_version") + local new_port=$(sed -n 's/^PGPORT=//p' "$INIT_DIR/postgresql-$prev_version") /sbin/service "${PROG_NAME}${PKG_VERSION}" initdb diff --git a/specs/postgresql-16/postgresql-16.spec b/specs/postgresql-16/postgresql-16.spec index 88a4b8457..74a26befe 100644 --- a/specs/postgresql-16/postgresql-16.spec +++ b/specs/postgresql-16/postgresql-16.spec @@ -25,7 +25,7 @@ %define majorver 16 %define minorver 0 -%define rel 0 +%define rel 1 %define fullver %{majorver}.%{minorver} %define pkgver 16 %define realname postgresql @@ -157,7 +157,7 @@ PostgreSQL is an advanced Object-Relational database management system (DBMS) that supports almost all SQL constructs (including transactions, subselects and user-defined types and functions). The postgresql package includes the client programs and libraries that -you'll need to access a PostgreSQL DBMS server. These PostgreSQL +you'll need to access a PostgreSQL DBMS server. These PostgreSQL client programs are programs that directly manipulate the internal structure of PostgreSQL databases on a PostgreSQL server. These client programs can be located on the same machine with the PostgreSQL @@ -559,7 +559,7 @@ sed -i 's/{{PREV_VERSION}}/%{prev_version}/g' %{buildroot}%{_unitdir}/postgresql sed -i 's/{{USER_NAME}}/%{username}/g' %{buildroot}%{_unitdir}/postgresql-%{majorver}.service sed -i 's/{{GROUP_NAME}}/%{groupname}/g' %{buildroot}%{_unitdir}/postgresql-%{majorver}.service -ln -sf %{_initddir}/%{service_name} %{buildroot}%{_initddir}/%{tinyname}%{majorver} +ln -sf %{service_name} %{buildroot}%{_initddir}/%{tinyname}%{majorver} %if %pam install -d %{buildroot}%{_sysconfdir}/pam.d @@ -1169,5 +1169,8 @@ rm -rf %{buildroot} ################################################################################ %changelog +* Sun Oct 29 2023 Anton Novojilov - 16.0-1 +- Improved init script compatibility with systemd + * Fri Sep 22 2023 Anton Novojilov - 16.0-0 - Initial build for kaos-repo