From cabd6b3bcc6e4e7de93e24259ac729572766798a753991cecda764f5b5e4d3cc Mon Sep 17 00:00:00 2001 From: Reinhard Max Date: Wed, 5 Jul 2017 11:24:29 +0000 Subject: [PATCH 01/16] Sync changes with SLE12 OBS-URL: https://build.opensuse.org/package/show/server:database:postgresql/postgresql?expand=0&rev=82 --- postgresql.changes | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/postgresql.changes b/postgresql.changes index 3fb088c..c6a32d7 100644 --- a/postgresql.changes +++ b/postgresql.changes @@ -1,7 +1,12 @@ +------------------------------------------------------------------- +Wed Jun 28 09:35:46 UTC 2017 - max@suse.com + +- Bump version and defaultpackage to 9.6 in SLE12 (bsc#1046324). + ------------------------------------------------------------------- Sun Oct 30 06:17:24 UTC 2016 - 13ilya@gmail.com -- Bump version and defaultpackage to 9.6. +- Bump version and defaultpackage to 9.6 in Factory. ------------------------------------------------------------------- Mon Sep 28 15:04:31 UTC 2015 - max@suse.com @@ -9,10 +14,15 @@ Mon Sep 28 15:04:31 UTC 2015 - max@suse.com - Move ~postgres/.bash_profile to postgresql-server to avoid a file conflict between the versioned server packages. +------------------------------------------------------------------- +Mon Aug 17 00:25:13 CEST 2015 - ro@suse.de + +- Bump version and defaultpackage to 9.4. in SLE (bnc#941886) + ------------------------------------------------------------------- Wed Feb 18 15:28:45 UTC 2015 - max@suse.com -- Bump version and defaultpackage to 9.4. +- Bump version and defaultpackage to 9.4 in Factory. ------------------------------------------------------------------- Tue Sep 17 11:44:19 UTC 2013 - max@suse.com From 5bb6fea7ae711d7a3ab8510543cc338f489ca2749b1b549680654fecbdc7db99 Mon Sep 17 00:00:00 2001 From: Reinhard Max Date: Wed, 13 Sep 2017 16:53:50 +0000 Subject: [PATCH 02/16] Accepting request 525781 from home:darix:branches:server:database:postgresql - bump to 10 OBS-URL: https://build.opensuse.org/request/show/525781 OBS-URL: https://build.opensuse.org/package/show/server:database:postgresql/postgresql?expand=0&rev=83 --- postgresql.changes | 5 +++++ postgresql.spec | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/postgresql.changes b/postgresql.changes index c6a32d7..b035fb8 100644 --- a/postgresql.changes +++ b/postgresql.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Aug 3 23:06:39 UTC 2017 - mrueckert@suse.de + +- bump to 10 + ------------------------------------------------------------------- Wed Jun 28 09:35:46 UTC 2017 - max@suse.com diff --git a/postgresql.spec b/postgresql.spec index 8ffa50d..2f50404 100644 --- a/postgresql.spec +++ b/postgresql.spec @@ -15,13 +15,13 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # -%define defaultpackage postgresql96 +%define defaultpackage postgresql10 Name: postgresql Summary: Basic Clients and Utilities for PostgreSQL License: PostgreSQL Group: Productivity/Databases/Tools -Version: 9.6 +Version: 10 Release: 0 Url: https://www.postgresql.org/ BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -195,4 +195,4 @@ sed 's,@LIBDIR@,%_libdir,g' %{SOURCE0} > \ %defattr(-,root,root,-) %doc README -%changelog \ No newline at end of file +%changelog From 0f2fbd2c2721b4c0cb86c2964331dd7de634d96653fb521863fb8a0ed0e3d1f8 Mon Sep 17 00:00:00 2001 From: Reinhard Max Date: Thu, 21 Sep 2017 13:48:21 +0000 Subject: [PATCH 03/16] - Refine the dependencies between the "dummy" packages and the actual implementation of PostgreSQL. The dummy packages now require an arbitrary implementation and recommend the default version. - Move the contents of postgresql-init to the server package. OBS-URL: https://build.opensuse.org/package/show/server:database:postgresql/postgresql?expand=0&rev=84 --- postgresql-firewall | 4 + postgresql-init | 199 +++++++++++++++++++++++++++++++++++++++ postgresql-sysconfig | 51 ++++++++++ postgresql-tmpfiles.conf | 2 + postgresql.changes | 9 ++ postgresql.service | 19 ++++ postgresql.spec | 129 ++++++++++++++++++++++--- 7 files changed, 402 insertions(+), 11 deletions(-) create mode 100644 postgresql-firewall create mode 100644 postgresql-init create mode 100644 postgresql-sysconfig create mode 100644 postgresql-tmpfiles.conf create mode 100644 postgresql.service diff --git a/postgresql-firewall b/postgresql-firewall new file mode 100644 index 0000000..2391bdc --- /dev/null +++ b/postgresql-firewall @@ -0,0 +1,4 @@ +## Name: PostgreSQL Server +## Description: Opens TCP port 5432 to allow remote connections to the PostgreSQL server. + +TCP="5432" diff --git a/postgresql-init b/postgresql-init new file mode 100644 index 0000000..62b95be --- /dev/null +++ b/postgresql-init @@ -0,0 +1,199 @@ +#!/bin/sh +# Copyright (c) 1995-2004 SUSE Linux AG, Nuernberg, Germany. +# All rights reserved. +# +# System startup script for PostgreSQL +# +# LSB compatible service control script; see http://www.linuxbase.org/spec/ +# +### BEGIN INIT INFO +# Provides: postgresql +# Required-Start: $network $remote_fs +# Required-Stop: $network $remote_fs +# Default-Start: 3 5 +# Default-Stop: +# Description: Start the PostgreSQL master daemon +### END INIT INFO + +# Source SuSE config +PG_SYSCONFIG=/etc/sysconfig/postgresql +test -f $PG_SYSCONFIG && . $PG_SYSCONFIG + +# Shell functions sourced from /etc/rc.status: +# rc_check check and set local and overall rc status +# rc_status check and set local and overall rc status +# rc_status -v ditto but be verbose in local rc status +# rc_status -v -r ditto and clear the local rc status +# rc_failed set local and overall rc status to failed +# rc_reset clear local rc status (overall remains) +# rc_exit exit appropriate to overall rc status +. /etc/rc.status + +eval DATADIR=${POSTGRES_DATADIR:-~postgres/data} +OPTIONS=${POSTGRES_OPTIONS} +PIDFILE=$DATADIR/postmaster.pid + +# The echo return value for success (defined in /etc/rc.config). +rc_reset + +# Return values acc. to LSB for all commands but status: +# 0 - success +# 1 - generic or unspecified error +# 2 - invalid or excess argument(s) +# 3 - unimplemented feature (e.g. "reload") +# 4 - insufficient privilege +# 5 - program is not installed +# 6 - program is not configured +# 7 - program is not running +# +# Note that starting an already running service, stopping +# or restarting a not-running service as well as the restart +# with force-reload (in case signalling is not supported) are +# considered a success. + +# +if test -r $DATADIR/PG_VERSION ; then + DATA_VERSION=$(cat $DATADIR/PG_VERSION) + POSTGRES=/usr/lib/postgresql${DATA_VERSION/./}/bin/postgres +fi +if test -x /usr/bin/postgres; then + ACTIVE=$(readlink -q -f /usr/bin/postgres) + test -z "$POSTGRES" && POSTGRES="$ACTIVE" +fi +if test -z "$POSTGRESQL_QUIET"; then + export POSTGRESQL_QUIET=1 + if test -n "$DATA_VERSION"; then + if test -z "$ACTIVE" -o "$ACTIVE" != "$POSTGRES"; then + echo " Your database files were created by PostgreSQL version $DATA_VERSION." + if test -x "$POSTGRES"; then + echo " Using the executables in $(dirname $POSTGRES)." + else + echo " Could not find executables for this version." + echo " Please install the PostgreSQL server package for version $DATA_VERSION." + fi + fi + elif test -z "$ACTIVE"; then + echo " Cannot find an active PostgreSQL server binary. Please install one of the PostgreSQL" + echo " server packages or activate an already installed version using update-alternatives." + fi +fi +if test ! -x "$POSTGRES"; then + test "$1" = "stop" && exit 0 || exit 5 +fi +BINDIR=$(dirname $POSTGRES) +VERSION=$($POSTGRES --version|awk '{print $NF}') +LOGFILE=$DATADIR/postmaster.log +pg_ctl () { + CMD="$BINDIR/pg_ctl ${POSTGRES_TIMEOUT:+-t $POSTGRES_TIMEOUT} $@" + su - postgres -c "$CMD" +} + +case "$1" in + start) + if [ ! -f $DATADIR/PG_VERSION ]; then + echo -n "Initializing PostgreSQL $VERSION at location ${DATADIR}" + LANG_SYSCONFIG=/etc/sysconfig/language + test -f "$LANG_SYSCONFIG" && . $LANG_SYSCONFIG + LANG=${POSTGRES_LANG:-$RC_LANG} + INITDB=/usr/bin/initdb + V=$(printf "%02d%02d" $(echo $VERSION|awk -F. '{print $1, $2}')) + AUTH="ident"; test $V -lt 0804 && AUTH="ident sameuser" + install -d -o postgres -g postgres -m 700 ${DATADIR} && + su - postgres -c \ + "$INITDB --locale=$LANG --auth=\"$AUTH\" $DATADIR &> initlog" || + rc_failed + rc_status -v + rc_status || { + echo "You can find a log of the initialisation in ~postgres/initlog ." + rc_exit + } + fi + echo -n "Starting PostgreSQL $VERSION " + if pg_ctl status -s -D $DATADIR >/dev/null + then + rc_failed 0 + else + set -o pipefail + pg_ctl start -s -w -D $DATADIR -l $LOGFILE -o "\"$OPTIONS\"" + fi + rc_status -v + ;; + + stop) + echo -n "Shutting down PostgreSQL $VERSION " + if pg_ctl status -s -D $DATADIR >/dev/null + then + pg_ctl stop -s -D $DATADIR -m fast &> /dev/null + else + rc_failed 0 + fi + rc_status -v + ;; + + try-restart|condrestart) + ## Do a restart only if the service was active before. + ## Note: try-restart is now part of LSB (as of 1.9). + ## RH has a similar command named condrestart. + if test "$1" = "condrestart"; then + echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}" + fi + $0 status + if test $? = 0; then + $0 restart + else + rc_reset # Not running is not a failure. + fi + # Remember status and be quiet + rc_status + ;; + + restart) + ## Stop the service and regardless of whether it was + ## running or not, start it again. + $0 stop + $0 start + rc_status + ;; + + force-reload | reload) + echo -n "Reloading configuration for PostgreSQL $VERSION " + pg_ctl reload -s -D $DATADIR + rc_status -v + ;; + + status) + echo -n "Checking for PostgreSQL $VERSION: " + ## Check status with checkproc(8), if process is running + ## checkproc will return with exit status 0. + + # Status has a slightly different for the status command: + # 0 - service running + # 1 - service dead, but /var/run/ pid file exists + # 2 - service dead, but /var/lock/ lock file exists + # 3 - service not running + + # NOTE: checkproc returns LSB compliant status values. + if ! pg_ctl status -s -D $DATADIR >/dev/null + then + if test -f $DATADIR/postmaster.pid; then + rc_failed 1 + else + rc_failed 3 + fi + fi + rc_status -v + ;; + + probe) + rc_failed 3 + rc_status -v + ;; + + *) + echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}" + exit 1 + ;; +esac + +# Inform the caller not only verbosely and set an exit status. +rc_exit diff --git a/postgresql-sysconfig b/postgresql-sysconfig new file mode 100644 index 0000000..997c0fa --- /dev/null +++ b/postgresql-sysconfig @@ -0,0 +1,51 @@ +## Path: Applications/PostgreSQL +## Description: The PostgreSQL Database System +## Type: string() +## Default: "~postgres/data" +## ServiceRestart: postgresql +# +# In which directory should the PostgreSQL database reside? +# +POSTGRES_DATADIR="~postgres/data" + +## Path: Applications/PostgreSQL +## Description: The PostgreSQL Database System +## Type: string() +## Default: "" +## ServiceRestart: postgresql +# +# The options that are given to the PostgreSQL master daemon on startup. +# See the manual pages for postmaster and postgres for valid options. +# +# Don't put "-D datadir" here since it is set by the startup script +# based on the variable POSTGRES_DATADIR above. +# +POSTGRES_OPTIONS="" + + +## Path: Applications/PostgreSQL +## Description: The PostgreSQL Database System +## Type: string() +## Default: "600" +## ServiceRestart: postgresql +# +# This value controls how many seconds the pg_ctl helper program waits +# for the startup or shutdown of the PostgreSQL server to complete. +# +POSTGRES_TIMEOUT="600" + +## Path: Applications/PostgreSQL +## Description: The PostgreSQL Database System +## Type: string() +## Default: "C" +## ServiceRestart: "" +# +# Specifies the locale under which the PostgreSQL database location +# should be initialized and run. If needed, it has to be changed +# before PostgreSQL is started for the first time. To change the +# locale of an existsing PostgreSQL database location, it must be +# dumped, removed and initialized from scratch using the new locale. +# +# If unset or empty $RC_LANG from /etc/sysconfig/language is used. +# +POSTGRES_LANG="" diff --git a/postgresql-tmpfiles.conf b/postgresql-tmpfiles.conf new file mode 100644 index 0000000..ea21c99 --- /dev/null +++ b/postgresql-tmpfiles.conf @@ -0,0 +1,2 @@ +# For the PostgreSQL server's unix domain socket +d /var/run/postgresql 1777 root root - diff --git a/postgresql.changes b/postgresql.changes index b035fb8..eba9b3d 100644 --- a/postgresql.changes +++ b/postgresql.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Thu Sep 21 07:59:26 UTC 2017 - max@suse.com + +- Refine the dependencies between the "dummy" packages and the + actual implementation of PostgreSQL. The dummy packages now + require an arbitrary implementation and recommend the default + version. +- Move the contents of postgresql-init to the server package. + ------------------------------------------------------------------- Thu Aug 3 23:06:39 UTC 2017 - mrueckert@suse.de diff --git a/postgresql.service b/postgresql.service new file mode 100644 index 0000000..c439eef --- /dev/null +++ b/postgresql.service @@ -0,0 +1,19 @@ +[Unit] + +Description=PostgreSQL database server +After=syslog.target +After=network.target + +[Service] +Type=forking +User=postgres +EnvironmentFile=-/etc/sysconfig/postgresql +ExecStart=/usr/lib/postgresql-init start +ExecStop=/usr/lib/postgresql-init stop +ExecReload=/usr/lib/postgresql-init reload + +# The server might be slow to stop, and that's fine. Don't kill it +SendSIGKILL=no + +[Install] +WantedBy=multi-user.target diff --git a/postgresql.spec b/postgresql.spec index 2f50404..cbd5048 100644 --- a/postgresql.spec +++ b/postgresql.spec @@ -17,6 +17,12 @@ %define defaultpackage postgresql10 +%if 0%{?suse_version} >= 1300 +%bcond_without systemd +%else +%bcond_with systemd +%endif + Name: postgresql Summary: Basic Clients and Utilities for PostgreSQL License: PostgreSQL @@ -25,10 +31,24 @@ Version: 10 Release: 0 Url: https://www.postgresql.org/ BuildRoot: %{_tmppath}/%{name}-%{version}-build -Requires: %defaultpackage +Provides: postgresql-noarch = %version-%release +Requires: postgresql-implementation +Recommends: %defaultpackage BuildArch: noarch -Source0: postgresql-bashprofile +Source0: postgresql-init +Source1: postgresql-sysconfig +Source2: postgresql-firewall +Source3: postgresql-tmpfiles.conf +Source4: postgresql.service +Source5: postgresql-bashprofile +%if 0%{?suse_version} > 1100 + %define fwdir /etc/sysconfig/SuSEfirewall2.d/services + %define fwname postgresql +%else + %define fwdir /etc/sysconfig/scripts + %define fwname SuSEfirewall2-postgresql +%endif %description PostgreSQL is an advanced object-relational database management system @@ -45,7 +65,18 @@ package. %package server Summary: The Programs Needed to Create and Run a PostgreSQL Server Group: Productivity/Databases/Servers -Requires: %defaultpackage-server +Provides: postgresql-server-noarch = %version-%release +Requires: postgresql-server-implementation +Recommends: %defaultpackage-server +Provides: postgresql-init = %version +Obsoletes: postgresql-init < %version +%if %{with systemd} +BuildRequires: pkgconfig(systemd) +%{?systemd_requires} +%else +Requires(postun): %insserv_prereq +%endif + %description server PostgreSQL is an advanced object-relational database management system @@ -60,7 +91,9 @@ PostgreSQL databases. %package docs Summary: HTML Documentation for PostgreSQL Group: Productivity/Databases/Tools -Requires: %defaultpackage-docs +Provides: postgresql-docs-noarch = %version-%release +Requires: postgresql-docs-implementation +Recommends: %defaultpackage-docs %description docs PostgreSQL is an advanced object-relational database management system @@ -76,7 +109,9 @@ postgresql package. %package contrib Summary: Contributed Extensions and Additions to PostgreSQL Group: Productivity/Databases/Tools -Requires: %defaultpackage-contrib +Provides: postgresql-docs-noarch = %version-%release +Requires: postgresql-docs-implementation +Recommends: %defaultpackage-contrib %description contrib PostgreSQL is an advanced object-relational database management system @@ -94,7 +129,9 @@ Documentation for the modules contained in this package can be found in %package devel Summary: PostgreSQL development header files and libraries Group: Productivity/Databases/Tools -Requires: %defaultpackage-devel +Provides: postgresql-devel-noarch = %version-%release +Requires: postgresql-devel-implementation +Recommends: %defaultpackage-devel %description devel PostgreSQL is an advanced object-relational database management system @@ -111,7 +148,9 @@ which will interact with a PostgreSQL server. %package plperl Summary: The PL/Tcl, PL/Perl, and PL/Python procedural languages for PostgreSQL Group: Productivity/Databases/Servers -Requires: %defaultpackage-plperl +Provides: postgresql-plperl-noarch = %version-%release +Requires: postgresql-plperl-implementation +Recommends: %defaultpackage-plperl %description plperl PostgreSQL is an advanced object-relational database management system @@ -126,7 +165,9 @@ functions, and triggers. %package plpython Summary: The PL/Python Procedural Languages for PostgreSQL Group: Productivity/Databases/Servers -Requires: %defaultpackage-plpython +Provides: postgresql-devel-noarch = %version-%release +Requires: postgresql-plpython-implementation +Recommends: %defaultpackage-plpython %description plpython PostgreSQL is an advanced object-relational database management system @@ -141,7 +182,9 @@ functions, and triggers. %package pltcl Summary: PL/Tcl Procedural Language for PostgreSQL Group: Productivity/Databases/Tools -Requires: %defaultpackage-pltcl +Provides: postgresql-pltcl-noarch = %version-%release +Requires: postgresql-pltcl-implementation +Recommends: %defaultpackage-pltcl %description pltcl PostgreSQL is an advanced object-relational database management system @@ -158,8 +201,57 @@ echo "This is a dummy package to provide a dependency on the default PostgreSQL %install mkdir -p %buildroot/var/lib/pgsql/ -sed 's,@LIBDIR@,%_libdir,g' %{SOURCE0} > \ - %buildroot/var/lib/pgsql/.bash_profile +install -m640 %{SOURCE5} %buildroot/var/lib/pgsql/.bash_profile + +install -m755 -d %buildroot/var/adm/fillup-templates +install -m644 %{S:1} %buildroot/var/adm/fillup-templates/sysconfig.postgresql + +install -m755 -d %buildroot%fwdir +install -m644 %{S:2} %buildroot%fwdir/%fwname + +install -m755 -d %buildroot/usr/sbin +%if %{with systemd} +install -m755 -d %buildroot/%_tmpfilesdir +install -m644 %{S:3} %buildroot%_tmpfilesdir/postgresql.conf + +install -m755 -d %buildroot/usr/lib +install -m755 %{S:0} %buildroot/usr/lib + +install -m755 -d %buildroot%_unitdir +install -m444 %{S:4} %buildroot%_unitdir + +ln -sf service %buildroot/usr/sbin/rcpostgresql +%else +install -m755 -d %buildroot/etc/init.d +install -m755 %{S:0} %buildroot/etc/init.d/postgresql +ln -sf /etc/init.d/postgresql %buildroot/usr/sbin/rcpostgresql +%endif + +%pre server +groupadd -g 26 -o -r postgres >/dev/null 2>/dev/null || : +useradd -g postgres -o -r -d /var/lib/pgsql -s /bin/bash \ + -c "PostgreSQL Server" -u 26 postgres 2>/dev/null || : + +%post server +%fillup_only -n postgresql +%if %{with systemd} +%tmpfiles_create %_tmpfilesdir/postgresql.conf +%service_add_post postgresql.service +%endif + +%preun server +%if %{with systemd} +%service_del_preun postgresql.service +%else +%stop_on_removal postgresql +%endif + +%postun server +%if %{with systemd} +%service_del_postun postgresql.service +%else +%insserv_cleanup +%endif %files %defattr(-,root,root,-) @@ -171,6 +263,21 @@ sed 's,@LIBDIR@,%_libdir,g' %{SOURCE0} > \ %attr(750,postgres,postgres) %dir /var/lib/pgsql %attr(640,postgres,postgres) %config(noreplace) /var/lib/pgsql/.bash_profile +%if 0%{?suse_version} > 1110 +%dir %fwdir +%endif +%config %fwdir/%fwname +/var/adm/fillup-templates/sysconfig.postgresql +/usr/sbin/rcpostgresql +%if %{with systemd} +%_tmpfilesdir/postgresql.conf +%_unitdir/ +/usr/lib/* +%else +%config /etc/init.d/postgresql +%endif + + %files docs %defattr(-,root,root,-) %doc README From fbfec6a5aebc9d9b7b110bd7205edbd7e6e4d1f86984dfc17d1868c0ad62d5a9 Mon Sep 17 00:00:00 2001 From: Reinhard Max Date: Thu, 21 Sep 2017 16:15:27 +0000 Subject: [PATCH 04/16] OBS-URL: https://build.opensuse.org/package/show/server:database:postgresql/postgresql?expand=0&rev=85 --- postgresql.service | 6 +++--- postgresql.spec | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/postgresql.service b/postgresql.service index c439eef..7b43015 100644 --- a/postgresql.service +++ b/postgresql.service @@ -8,9 +8,9 @@ After=network.target Type=forking User=postgres EnvironmentFile=-/etc/sysconfig/postgresql -ExecStart=/usr/lib/postgresql-init start -ExecStop=/usr/lib/postgresql-init stop -ExecReload=/usr/lib/postgresql-init reload +ExecStart=/usr/lib/postgresql-script start +ExecStop=/usr/lib/postgresql-script stop +ExecReload=/usr/lib/postgresql-script reload # The server might be slow to stop, and that's fine. Don't kill it SendSIGKILL=no diff --git a/postgresql.spec b/postgresql.spec index cbd5048..a2b954c 100644 --- a/postgresql.spec +++ b/postgresql.spec @@ -41,6 +41,7 @@ Source2: postgresql-firewall Source3: postgresql-tmpfiles.conf Source4: postgresql.service Source5: postgresql-bashprofile +Source6: postgresql-script %if 0%{?suse_version} > 1100 %define fwdir /etc/sysconfig/SuSEfirewall2.d/services @@ -215,7 +216,7 @@ install -m755 -d %buildroot/%_tmpfilesdir install -m644 %{S:3} %buildroot%_tmpfilesdir/postgresql.conf install -m755 -d %buildroot/usr/lib -install -m755 %{S:0} %buildroot/usr/lib +install -m755 %{S:6} %buildroot/usr/lib install -m755 -d %buildroot%_unitdir install -m444 %{S:4} %buildroot%_unitdir From 5715de7283353d9708800f306bde8e8a37112bd94770854922251544222bdaa4 Mon Sep 17 00:00:00 2001 From: Reinhard Max Date: Fri, 22 Sep 2017 13:04:23 +0000 Subject: [PATCH 05/16] add postgresql-script OBS-URL: https://build.opensuse.org/package/show/server:database:postgresql/postgresql?expand=0&rev=86 --- postgresql-script | 72 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 postgresql-script diff --git a/postgresql-script b/postgresql-script new file mode 100644 index 0000000..9eac0db --- /dev/null +++ b/postgresql-script @@ -0,0 +1,72 @@ +#!/bin/sh + +PG_SYSCONFIG=/etc/sysconfig/postgresql +test -f $PG_SYSCONFIG && . $PG_SYSCONFIG + +eval DATADIR=${POSTGRES_DATADIR:-~postgres/data} +OPTIONS=${POSTGRES_OPTIONS} +PIDFILE=$DATADIR/postmaster.pid + +# +if test -r $DATADIR/PG_VERSION ; then + DATA_VERSION=$(cat $DATADIR/PG_VERSION) + POSTGRES=/usr/lib/postgresql${DATA_VERSION/./}/bin/postgres +fi +if test -x /usr/bin/postgres; then + ACTIVE=$(readlink -q -f /usr/bin/postgres) + test -z "$POSTGRES" && POSTGRES="$ACTIVE" +fi +if test -n "$DATA_VERSION"; then + if test -z "$ACTIVE" -o "$ACTIVE" != "$POSTGRES"; then + echo " Your database files were created by PostgreSQL version $DATA_VERSION." + if test -x "$POSTGRES"; then + echo " Using the executables in $(dirname $POSTGRES)." + else + echo " Could not find executables for this version." + echo " Please install the PostgreSQL server package for version $DATA_VERSION." + fi + fi +elif test -z "$ACTIVE"; then + echo " Cannot find an active PostgreSQL server binary. Please install one of the PostgreSQL" + echo " server packages or activate an already installed version using update-alternatives." +fi +if test ! -x "$POSTGRES"; then + exit 1 +fi +BINDIR=$(dirname $POSTGRES) +VERSION=$($POSTGRES --version|awk '{print $NF}') +pg_ctl () { + $BINDIR/pg_ctl -s -D $DATADIR ${POSTGRES_TIMEOUT:+-t $POSTGRES_TIMEOUT} "$@" +} + +cd ~ +case "$1" in + start) + if [ ! -f $DATADIR/PG_VERSION ]; then + LANG_SYSCONFIG=/etc/sysconfig/language + test -f "$LANG_SYSCONFIG" && . $LANG_SYSCONFIG + LANG=${POSTGRES_LANG:-$RC_LANG} + V=$(printf "%02d%02d" $(echo $VERSION|awk -F. '{print $1, $2}')) + install -d -m 700 ${DATADIR} && + echo "Initializing PostgreSQL $VERSION at location ${DATADIR}" + /usr/bin/initdb --locale=$LANG --auth=ident $DATADIR &> initlog || { + echo "Initialisation failed. See $PWD/initlog ." + exit 1 + } + fi + pg_ctl start -w ${OPTIONS:+-o "$OPTIONS"} + ;; + + stop) + pg_ctl stop -m fast + ;; + + reload) + pg_ctl reload + ;; + + *) + echo "Usage: $0 {start|stop|reload}" + exit 1 + ;; +esac From 18cf98848855ae85ec38e461f244cc8a02812c1c163db1832577727a436620e9 Mon Sep 17 00:00:00 2001 From: Reinhard Max Date: Mon, 25 Sep 2017 09:57:54 +0000 Subject: [PATCH 06/16] Fix some provides OBS-URL: https://build.opensuse.org/package/show/server:database:postgresql/postgresql?expand=0&rev=87 --- postgresql.spec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/postgresql.spec b/postgresql.spec index a2b954c..384216d 100644 --- a/postgresql.spec +++ b/postgresql.spec @@ -69,7 +69,7 @@ Group: Productivity/Databases/Servers Provides: postgresql-server-noarch = %version-%release Requires: postgresql-server-implementation Recommends: %defaultpackage-server -Provides: postgresql-init = %version +Provides: postgresql-init = %version-%release Obsoletes: postgresql-init < %version %if %{with systemd} BuildRequires: pkgconfig(systemd) @@ -110,7 +110,7 @@ postgresql package. %package contrib Summary: Contributed Extensions and Additions to PostgreSQL Group: Productivity/Databases/Tools -Provides: postgresql-docs-noarch = %version-%release +Provides: postgresql-contrib-noarch = %version-%release Requires: postgresql-docs-implementation Recommends: %defaultpackage-contrib @@ -166,7 +166,7 @@ functions, and triggers. %package plpython Summary: The PL/Python Procedural Languages for PostgreSQL Group: Productivity/Databases/Servers -Provides: postgresql-devel-noarch = %version-%release +Provides: postgresql-plpython-noarch = %version-%release Requires: postgresql-plpython-implementation Recommends: %defaultpackage-plpython From 97f76876081b8a911240e359a8b9cee0f300e7d3d623dacd6d2ba6eb83873758 Mon Sep 17 00:00:00 2001 From: Reinhard Max Date: Mon, 25 Sep 2017 15:18:43 +0000 Subject: [PATCH 07/16] More dependency adjustments OBS-URL: https://build.opensuse.org/package/show/server:database:postgresql/postgresql?expand=0&rev=88 --- postgresql.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgresql.spec b/postgresql.spec index 384216d..423de25 100644 --- a/postgresql.spec +++ b/postgresql.spec @@ -70,7 +70,7 @@ Provides: postgresql-server-noarch = %version-%release Requires: postgresql-server-implementation Recommends: %defaultpackage-server Provides: postgresql-init = %version-%release -Obsoletes: postgresql-init < %version +Obsoletes: postgresql-init < %version-%release %if %{with systemd} BuildRequires: pkgconfig(systemd) %{?systemd_requires} From 2d1ca233ebc9d94bcade5e456a2c880c4471b8b0548940e367e45f5954840923 Mon Sep 17 00:00:00 2001 From: Reinhard Max Date: Fri, 6 Oct 2017 12:41:43 +0000 Subject: [PATCH 08/16] Dependency refinements and reduction of rpmlint warnings. OBS-URL: https://build.opensuse.org/package/show/server:database:postgresql/postgresql?expand=0&rev=89 --- postgresql.spec | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/postgresql.spec b/postgresql.spec index 423de25..d2ff7c9 100644 --- a/postgresql.spec +++ b/postgresql.spec @@ -69,7 +69,7 @@ Group: Productivity/Databases/Servers Provides: postgresql-server-noarch = %version-%release Requires: postgresql-server-implementation Recommends: %defaultpackage-server -Provides: postgresql-init = %version-%release +Provides: postgresql-init = %version.0-%release Obsoletes: postgresql-init < %version-%release %if %{with systemd} BuildRequires: pkgconfig(systemd) @@ -129,7 +129,7 @@ Documentation for the modules contained in this package can be found in %package devel Summary: PostgreSQL development header files and libraries -Group: Productivity/Databases/Tools +Group: Development/Libraries/C and C++ Provides: postgresql-devel-noarch = %version-%release Requires: postgresql-devel-implementation Recommends: %defaultpackage-devel @@ -197,6 +197,8 @@ This package contains the PL/Tcl procedural language for PostgreSQL. With thie module one can use Tcl to write stored procedures, functions, and triggers. +%prep + %build echo "This is a dummy package to provide a dependency on the default PostgreSQL version." > README @@ -229,9 +231,12 @@ ln -sf /etc/init.d/postgresql %buildroot/usr/sbin/rcpostgresql %endif %pre server -groupadd -g 26 -o -r postgres >/dev/null 2>/dev/null || : -useradd -g postgres -o -r -d /var/lib/pgsql -s /bin/bash \ - -c "PostgreSQL Server" -u 26 postgres 2>/dev/null || : +getent group postgres > /dev/null || + groupadd -g 26 -o -r postgres +getent passwd postgres > /dev/null || + useradd -g postgres -o -r -d /var/lib/pgsql -s /bin/bash \ + -c "PostgreSQL Server" -u 26 postgres +%service_add_pre postgresql.service %post server %fillup_only -n postgresql From b13c8cb1c4794c56fe8e8a63715b9fc35f67350e5c1a845872db6ca21a875d9b Mon Sep 17 00:00:00 2001 From: Marcus Rueckert Date: Fri, 6 Oct 2017 14:39:51 +0000 Subject: [PATCH 09/16] - properly guard the systemd macro in %pre server so it wont be used on sle11 - add Requires(pre) so we have groupadd/useradd available OBS-URL: https://build.opensuse.org/package/show/server:database:postgresql/postgresql?expand=0&rev=90 --- postgresql.changes | 7 +++++++ postgresql.spec | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/postgresql.changes b/postgresql.changes index eba9b3d..32c9b5c 100644 --- a/postgresql.changes +++ b/postgresql.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Fri Oct 6 14:33:54 UTC 2017 - mrueckert@suse.de + +- properly guard the systemd macro in %pre server so it wont be + used on sle11 +- add Requires(pre) so we have groupadd/useradd available + ------------------------------------------------------------------- Thu Sep 21 07:59:26 UTC 2017 - max@suse.com diff --git a/postgresql.spec b/postgresql.spec index d2ff7c9..8ef4bbf 100644 --- a/postgresql.spec +++ b/postgresql.spec @@ -69,6 +69,11 @@ Group: Productivity/Databases/Servers Provides: postgresql-server-noarch = %version-%release Requires: postgresql-server-implementation Recommends: %defaultpackage-server +%if 0%{?suse_version} >= 1315 +Requires(pre): shadow +%else +Requires(pre): pwdutils +%endif Provides: postgresql-init = %version.0-%release Obsoletes: postgresql-init < %version-%release %if %{with systemd} @@ -236,7 +241,9 @@ getent group postgres > /dev/null || getent passwd postgres > /dev/null || useradd -g postgres -o -r -d /var/lib/pgsql -s /bin/bash \ -c "PostgreSQL Server" -u 26 postgres +%if %{with systemd} %service_add_pre postgresql.service +%endif %post server %fillup_only -n postgresql From 00771bc5b02846ed8b97dc0313bb711bab57d4b68c6f2673da13636396e33393 Mon Sep 17 00:00:00 2001 From: Marcus Rueckert Date: Fri, 6 Oct 2017 17:05:30 +0000 Subject: [PATCH 10/16] we actually needed the bumped version in the obsoletes more than in the provides OBS-URL: https://build.opensuse.org/package/show/server:database:postgresql/postgresql?expand=0&rev=91 --- postgresql.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgresql.spec b/postgresql.spec index 8ef4bbf..ae1df68 100644 --- a/postgresql.spec +++ b/postgresql.spec @@ -75,7 +75,7 @@ Requires(pre): shadow Requires(pre): pwdutils %endif Provides: postgresql-init = %version.0-%release -Obsoletes: postgresql-init < %version-%release +Obsoletes: postgresql-init < %version.0-%release %if %{with systemd} BuildRequires: pkgconfig(systemd) %{?systemd_requires} From 68e3cdac9a1d9f3378fa9dd53c33e0896cd016e0132e6054f95cae1b51796639 Mon Sep 17 00:00:00 2001 From: Reinhard Max Date: Fri, 3 Nov 2017 12:59:51 +0000 Subject: [PATCH 11/16] - Move the start/stop script to /usr/share/postgresql - Add a script for handling update-alternatives as subpackages get installed/uninstalled, so that the implementation packages don't have to repeat the logic (postgresql-install-alternatives). - Add the postgresql-test subpackage. - Fix some dependencies. - Save the enabled and running state when upgrading from the obsolete postgresql-init package. OBS-URL: https://build.opensuse.org/package/show/server:database:postgresql/postgresql?expand=0&rev=92 --- postgresql-install-alternatives | 27 +++++++++++++++ postgresql.changes | 12 +++++++ postgresql.service | 6 ++-- postgresql.spec | 61 +++++++++++++++++++++++++++++---- 4 files changed, 97 insertions(+), 9 deletions(-) create mode 100644 postgresql-install-alternatives diff --git a/postgresql-install-alternatives b/postgresql-install-alternatives new file mode 100644 index 0000000..0f1f0be --- /dev/null +++ b/postgresql-install-alternatives @@ -0,0 +1,27 @@ +#!/bin/bash + +shopt -s nullglob + +if test "$#" -ne 2; then + echo "usage: $0 basedir priority" 1>&2 + exit 1 +fi + +PGBASEDIR=$1 +PRIO=$2 + +PGBINDIR=$PGBASEDIR/bin + +for FILE in $PGBINDIR/*; do + NAME=$(basename $FILE) + DIR=/usr/bin + SLAVES="$SLAVES --slave $DIR/$NAME $NAME $FILE" +done + +if test -n "$SLAVES"; then + update-alternatives --quiet --install \ + /usr/lib/postgresql postgresql $PGBASEDIR $PRIO \ + $SLAVES +else + update-alternatives --remove postgresql $PGBASEDIR +fi diff --git a/postgresql.changes b/postgresql.changes index 32c9b5c..833ef5d 100644 --- a/postgresql.changes +++ b/postgresql.changes @@ -1,3 +1,15 @@ +------------------------------------------------------------------- +Fri Nov 3 12:55:14 UTC 2017 - max@suse.com + +- Move the start/stop script to /usr/share/postgresql +- Add a script for handling update-alternatives as subpackages + get installed/uninstalled, so that the implementation packages + don't have to repeat the logic (postgresql-install-alternatives). +- Add the postgresql-test subpackage. +- Fix some dependencies. +- Save the enabled and running state when upgrading from the + obsolete postgresql-init package. + ------------------------------------------------------------------- Fri Oct 6 14:33:54 UTC 2017 - mrueckert@suse.de diff --git a/postgresql.service b/postgresql.service index 7b43015..3a1ec46 100644 --- a/postgresql.service +++ b/postgresql.service @@ -8,9 +8,9 @@ After=network.target Type=forking User=postgres EnvironmentFile=-/etc/sysconfig/postgresql -ExecStart=/usr/lib/postgresql-script start -ExecStop=/usr/lib/postgresql-script stop -ExecReload=/usr/lib/postgresql-script reload +ExecStart=/usr/share/postgresql/postgresql-script start +ExecStop=/usr/share/postgresql/postgresql-script stop +ExecReload=/usr/share/postgresql/postgresql-script reload # The server might be slow to stop, and that's fine. Don't kill it SendSIGKILL=no diff --git a/postgresql.spec b/postgresql.spec index ae1df68..9676df1 100644 --- a/postgresql.spec +++ b/postgresql.spec @@ -42,6 +42,7 @@ Source3: postgresql-tmpfiles.conf Source4: postgresql.service Source5: postgresql-bashprofile Source6: postgresql-script +Source7: postgresql-install-alternatives %if 0%{?suse_version} > 1100 %define fwdir /etc/sysconfig/SuSEfirewall2.d/services @@ -68,6 +69,7 @@ Summary: The Programs Needed to Create and Run a PostgreSQL Server Group: Productivity/Databases/Servers Provides: postgresql-server-noarch = %version-%release Requires: postgresql-server-implementation +Requires: postgresql = %version-%release Recommends: %defaultpackage-server %if 0%{?suse_version} >= 1315 Requires(pre): shadow @@ -94,6 +96,18 @@ This package includes the programs needed to create and run a PostgreSQL server, which will in turn allow you to create and maintain PostgreSQL databases. +%package test +Summary: The test suite for PostgreSQL +Group: Productivity/Databases/Servers +Provides: postgresql-test-noarch = %version-%release +Requires: postgresql-test-implementation +Recommends: %defaultpackage-implementation + +%description test +This package contains the sources and pre-built binaries of various +tests for the PostgreSQL database management system, including +regression tests and benchmarks. + %package docs Summary: HTML Documentation for PostgreSQL Group: Productivity/Databases/Tools @@ -116,7 +130,7 @@ postgresql package. Summary: Contributed Extensions and Additions to PostgreSQL Group: Productivity/Databases/Tools Provides: postgresql-contrib-noarch = %version-%release -Requires: postgresql-docs-implementation +Requires: postgresql-contrib-implementation Recommends: %defaultpackage-contrib %description contrib @@ -222,8 +236,9 @@ install -m755 -d %buildroot/usr/sbin install -m755 -d %buildroot/%_tmpfilesdir install -m644 %{S:3} %buildroot%_tmpfilesdir/postgresql.conf -install -m755 -d %buildroot/usr/lib -install -m755 %{S:6} %buildroot/usr/lib +install -m755 -d %buildroot/usr/share/postgresql +install -m755 %{S:6} %buildroot/usr/share/postgresql +install -m755 %{S:7} %buildroot/usr/share/postgresql/install-alternatives install -m755 -d %buildroot%_unitdir install -m444 %{S:4} %buildroot%_unitdir @@ -235,6 +250,9 @@ install -m755 %{S:0} %buildroot/etc/init.d/postgresql ln -sf /etc/init.d/postgresql %buildroot/usr/sbin/rcpostgresql %endif +%define eflag /run/postgresql-was-enabled +%define aflag /run/postgresql-was-running + %pre server getent group postgres > /dev/null || groupadd -g 26 -o -r postgres @@ -243,6 +261,16 @@ getent passwd postgres > /dev/null || -c "PostgreSQL Server" -u 26 postgres %if %{with systemd} %service_add_pre postgresql.service + +# Save the "enabled" and "active" state across the transition of +# ownership of postgresql.service from postgresql-init to +# postgresql-server. +if [ "$FIRST_ARG" -ge 1 ]; then \ + if [ x$(systemctl is-enabled postgresql.service 2>/dev/null ||:) = "xenabled" ]; then + touch %eflag + fi + systemctl is-active postgresql.service &>/dev/null && touch %aflag ||: +fi %endif %post server @@ -254,21 +282,42 @@ getent passwd postgres > /dev/null || %preun server %if %{with systemd} -%service_del_preun postgresql.service +# Cannot use systemd macros here, because they're doing too much +/usr/bin/systemctl --no-reload disable postgresql.service || : %else %stop_on_removal postgresql %endif %postun server %if %{with systemd} -%service_del_postun postgresql.service +# Cannot use systemd macros here, because they're doing too much +rm -f "/var/lib/systemd/migrated/postgresql" +/usr/bin/systemctl daemon-reload || : + %else %insserv_cleanup %endif +%if %{with systemd} +%posttrans server +# Save the "enabled" and "active" state across the transition of +# ownership of postgresql.service from postgresql-init to +# postgresql-server. +if test -f %eflag; then + rm -f %eflag + systemctl enable postgresql.service +fi +if test -f %aflag; then + rm -f %aflag + systemctl start postgresql.service +fi +%endif + %files %defattr(-,root,root,-) %doc README +%dir /usr/share/postgresql +/usr/share/postgresql/install-alternatives %files server %defattr(-,root,root,-) @@ -285,7 +334,7 @@ getent passwd postgres > /dev/null || %if %{with systemd} %_tmpfilesdir/postgresql.conf %_unitdir/ -/usr/lib/* +/usr/share/postgresql/postgresql-script %else %config /etc/init.d/postgresql %endif From f115c678e17893f918e86c4080728d7b595bb5b77608191fe6bb68eceb739f0d Mon Sep 17 00:00:00 2001 From: Reinhard Max Date: Fri, 3 Nov 2017 13:27:36 +0000 Subject: [PATCH 12/16] OBS-URL: https://build.opensuse.org/package/show/server:database:postgresql/postgresql?expand=0&rev=93 --- postgresql.spec | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/postgresql.spec b/postgresql.spec index 9676df1..06ab380 100644 --- a/postgresql.spec +++ b/postgresql.spec @@ -232,14 +232,15 @@ install -m755 -d %buildroot%fwdir install -m644 %{S:2} %buildroot%fwdir/%fwname install -m755 -d %buildroot/usr/sbin -%if %{with systemd} -install -m755 -d %buildroot/%_tmpfilesdir -install -m644 %{S:3} %buildroot%_tmpfilesdir/postgresql.conf install -m755 -d %buildroot/usr/share/postgresql install -m755 %{S:6} %buildroot/usr/share/postgresql install -m755 %{S:7} %buildroot/usr/share/postgresql/install-alternatives +%if %{with systemd} +install -m755 -d %buildroot/%_tmpfilesdir +install -m644 %{S:3} %buildroot%_tmpfilesdir/postgresql.conf + install -m755 -d %buildroot%_unitdir install -m444 %{S:4} %buildroot%_unitdir From e5d1ca2c6bec34bc2e3c703a16d07221c7c6f5d390b802b37f9546d648bccb84 Mon Sep 17 00:00:00 2001 From: Reinhard Max Date: Fri, 3 Nov 2017 13:30:59 +0000 Subject: [PATCH 13/16] OBS-URL: https://build.opensuse.org/package/show/server:database:postgresql/postgresql?expand=0&rev=94 --- postgresql.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgresql.spec b/postgresql.spec index 06ab380..89ed5a8 100644 --- a/postgresql.spec +++ b/postgresql.spec @@ -234,12 +234,12 @@ install -m644 %{S:2} %buildroot%fwdir/%fwname install -m755 -d %buildroot/usr/sbin install -m755 -d %buildroot/usr/share/postgresql -install -m755 %{S:6} %buildroot/usr/share/postgresql install -m755 %{S:7} %buildroot/usr/share/postgresql/install-alternatives %if %{with systemd} install -m755 -d %buildroot/%_tmpfilesdir install -m644 %{S:3} %buildroot%_tmpfilesdir/postgresql.conf +install -m755 %{S:6} %buildroot/usr/share/postgresql install -m755 -d %buildroot%_unitdir install -m444 %{S:4} %buildroot%_unitdir From 6631adb5914a411d597f51a75e8453b3a7c12762abf245ee8ae40d0ae2d61e07 Mon Sep 17 00:00:00 2001 From: Reinhard Max Date: Tue, 14 Nov 2017 08:56:22 +0000 Subject: [PATCH 14/16] - postgresql-test was missing a %files section. OBS-URL: https://build.opensuse.org/package/show/server:database:postgresql/postgresql?expand=0&rev=95 --- postgresql.changes | 5 +++++ postgresql.spec | 3 +++ 2 files changed, 8 insertions(+) diff --git a/postgresql.changes b/postgresql.changes index 833ef5d..cb76d8c 100644 --- a/postgresql.changes +++ b/postgresql.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue Nov 14 08:52:46 UTC 2017 - max@suse.com + +- postgresql-test was missing a %files section. + ------------------------------------------------------------------- Fri Nov 3 12:55:14 UTC 2017 - max@suse.com diff --git a/postgresql.spec b/postgresql.spec index 89ed5a8..1a059c7 100644 --- a/postgresql.spec +++ b/postgresql.spec @@ -340,6 +340,9 @@ fi %config /etc/init.d/postgresql %endif +%files test +%defattr(-,root,root,-) +%doc README %files docs %defattr(-,root,root,-) From 3eac0cf9882710f7c79559fc2d6f63ca4dc16da067955cd668c847dc73b5b25b Mon Sep 17 00:00:00 2001 From: Reinhard Max Date: Wed, 22 Nov 2017 13:04:57 +0000 Subject: [PATCH 15/16] - CVE-2017-14798, bsc#1062722: Fix LPE via postgres init script. This only affected SysV-init based systems (i.e. SLE11). OBS-URL: https://build.opensuse.org/package/show/server:database:postgresql/postgresql?expand=0&rev=96 --- postgresql-init | 1 - postgresql.changes | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/postgresql-init b/postgresql-init index 62b95be..97bdc9a 100644 --- a/postgresql-init +++ b/postgresql-init @@ -98,7 +98,6 @@ case "$1" in INITDB=/usr/bin/initdb V=$(printf "%02d%02d" $(echo $VERSION|awk -F. '{print $1, $2}')) AUTH="ident"; test $V -lt 0804 && AUTH="ident sameuser" - install -d -o postgres -g postgres -m 700 ${DATADIR} && su - postgres -c \ "$INITDB --locale=$LANG --auth=\"$AUTH\" $DATADIR &> initlog" || rc_failed diff --git a/postgresql.changes b/postgresql.changes index cb76d8c..9c0e001 100644 --- a/postgresql.changes +++ b/postgresql.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Nov 22 13:03:42 UTC 2017 - max@suse.com + +- CVE-2017-14798, bsc#1062722: Fix LPE via postgres init script. + This only affected SysV-init based systems (i.e. SLE11). + ------------------------------------------------------------------- Tue Nov 14 08:52:46 UTC 2017 - max@suse.com From 15a35fecca29d5baafe8825ba4f35f974482bf83bb5b463ad67e1e898d2632e7 Mon Sep 17 00:00:00 2001 From: Reinhard Max Date: Fri, 24 Nov 2017 12:45:09 +0000 Subject: [PATCH 16/16] Accepting request 545144 from home:darix:branches:server:database:postgresql - instead of hardcoding version 10, just check if the prio is smaller than 80. - simplify the postgresql-install-alternatives to only require the pg version and go from there. supported calls of the script are: /usr/share/postgresql/install-alternatives postgresqlXY /usr/share/postgresql/install-alternatives XY where XY can currently be: 92 93 94 95 96 10 OBS-URL: https://build.opensuse.org/request/show/545144 OBS-URL: https://build.opensuse.org/package/show/server:database:postgresql/postgresql?expand=0&rev=97 --- postgresql-install-alternatives | 17 +++++++++++++---- postgresql.changes | 18 ++++++++++++++++++ 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/postgresql-install-alternatives b/postgresql-install-alternatives index 0f1f0be..1729902 100644 --- a/postgresql-install-alternatives +++ b/postgresql-install-alternatives @@ -2,13 +2,22 @@ shopt -s nullglob -if test "$#" -ne 2; then - echo "usage: $0 basedir priority" 1>&2 +if test "$#" -ne 1; then + echo "usage: $0 pgversion" 1>&2 exit 1 fi -PGBASEDIR=$1 -PRIO=$2 +PRIO=$1 +case "$PRIO" in + postgresql*) + PRIO="${PRIO##postgresql}" + ;; +esac + +PGBASEDIR=/usr/lib/postgresql$PRIO +if [ $PRIO -lt 80 ] ; then + PRIO="${PRIO}0" +fi PGBINDIR=$PGBASEDIR/bin diff --git a/postgresql.changes b/postgresql.changes index 9c0e001..ac2fc14 100644 --- a/postgresql.changes +++ b/postgresql.changes @@ -1,3 +1,21 @@ +------------------------------------------------------------------- +Fri Nov 24 11:24:09 UTC 2017 - mrueckert@suse.de + +- instead of hardcoding version 10, just check if the prio is + smaller than 80. + +------------------------------------------------------------------- +Thu Nov 23 17:05:21 UTC 2017 - mrueckert@suse.de + +- simplify the postgresql-install-alternatives to only require the + pg version and go from there. + + supported calls of the script are: + /usr/share/postgresql/install-alternatives postgresqlXY + /usr/share/postgresql/install-alternatives XY + + where XY can currently be: 92 93 94 95 96 10 + ------------------------------------------------------------------- Wed Nov 22 13:03:42 UTC 2017 - max@suse.com