public inbox for [email protected]
help / color / mirror / Atom feedFrom: Strahinja Kustudić <[email protected]>
To: Bernd Helmle <[email protected]>
Cc: Devrim GÜNDÜZ <[email protected]>
Cc: Jeff Frost <[email protected]>
Cc: pgsql-pkg-yum <[email protected]>
Subject: Re: systemd service files vs. postgresql9x-setup
Date: Wed, 18 May 2016 17:06:30 +0200
Message-ID: <CADKbJJWtk_wh-SF5rrsLxNUvgmd2FnzShQGvj7-dwTa5VRGqRw@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
List-Unsubscribe: <mailto:[email protected]?body=unsub%20pgsql-pkg-yum>
I propose the same patch with a modification to work with spaces in the
path, since systemctl prints spaces as '\x20', so we just needed one more
sed to replace that with a space.
Would also like to see this fixed in the next minor release, since it makes
it really hard to change PGDATA the correct way, which is by droping a
.conf file into /etc/systemd/system/postgresql-9.x.service.d/ directory.
Also would be really cool if the postgres rpm created the
/etc/systemd/system/postgresql-9.x.service.d/ directory, but it's not that
important as the setup scripts working correctly.
Strahinja Kustudić | Lead System Engineer | Nordeus
On Fri, Mar 11, 2016 at 1:01 PM, Bernd Helmle <[email protected]> wrote:
>
>
> --On 18. September 2015 16:48:09 +0300 Devrim GÜNDÜZ <[email protected]>
> wrote:
>
> > First of all: Thanks for the patch!
> >
> > The next set of new minor releases are due in a few weeks. I think we
> > can apply this patch then.
> >
> > (We need a issue tracker!)
>
> Hmm, i've totally forgotten that. I see that it's not committed yet, so i
> just go forward and ask if there's something missing we need to address?
>
> --
> Thanks
>
> Bernd
>
>
> --
> Sent via pgsql-pkg-yum mailing list ([email protected])
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-pkg-yum
>
--
Sent via pgsql-pkg-yum mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-pkg-yum
Attachments:
[text/x-patch] read-PGDATA-from-systemctl-and-space-in-path.patch (3.0K, 3-read-PGDATA-from-systemctl-and-space-in-path.patch)
download | inline diff:
diff --git a/rpm/redhat/9.4/postgresql/EL-7/postgresql94-setup b/rpm/redhat/9.4/postgresql/EL-7/postgresql94-setup
index 1f0cb0f..44cc090 100644
--- a/rpm/redhat/9.4/postgresql/EL-7/postgresql94-setup
+++ b/rpm/redhat/9.4/postgresql/EL-7/postgresql94-setup
@@ -73,36 +73,20 @@ case "$1" in
;;
esac
-# this parsing technique fails for PGDATA pathnames containing spaces,
-# but there's not much I can do about it given systemctl's output format...
PGDATA=`systemctl show -p Environment "${SERVICE_NAME}.service" |
sed 's/^Environment=//' | tr ' ' '\n' |
- sed -n 's/^PGDATA=//p' | tail -n 1`
+ sed -n 's/^PGDATA=//p' | tail -n 1 |
+ sed 's/\\x20/ /g'` # replace '\x20' with space
if [ x"$PGDATA" = x ]; then
echo "failed to find PGDATA setting in ${SERVICE_NAME}.service"
exit 1
fi
-# Find the unit file for new version.
-if [ -f "/etc/systemd/system/${SERVICE_NAME}.service" ]
-then
- SERVICE_FILE="/etc/systemd/system/${SERVICE_NAME}.service"
-elif [ -f "/lib/systemd/system/${SERVICE_NAME}.service" ]
-then
- SERVICE_FILE="/lib/systemd/system/${SERVICE_NAME}.service"
-else
- echo "Could not find systemd unit file ${SERVICE_NAME}.service"
- exit 1
-fi
-
# Log file for pg_upgrade
PGUPLOG=/var/lib/pgsql/$PGMAJORVERSION/pgupgrade.log
# Log file for initdb
PGLOG=/var/lib/pgsql/9.4/initdb.log
-# Get data directory from the service file
-PGDATA=`sed -n 's/Environment=PGDATA=//p' "${SERVICE_FILE}"`
-
export PGDATA
# For SELinux we need to use 'runuser' not 'su'
diff --git a/rpm/redhat/9.5/postgresql/EL-7/postgresql95-setup b/rpm/redhat/9.5/postgresql/EL-7/postgresql95-setup
index 697e0b4..c68a1a3 100644
--- a/rpm/redhat/9.5/postgresql/EL-7/postgresql95-setup
+++ b/rpm/redhat/9.5/postgresql/EL-7/postgresql95-setup
@@ -73,36 +73,20 @@ case "$1" in
;;
esac
-# this parsing technique fails for PGDATA pathnames containing spaces,
-# but there's not much I can do about it given systemctl's output format...
PGDATA=`systemctl show -p Environment "${SERVICE_NAME}.service" |
sed 's/^Environment=//' | tr ' ' '\n' |
- sed -n 's/^PGDATA=//p' | tail -n 1`
+ sed -n 's/^PGDATA=//p' | tail -n 1 |
+ sed 's/\\x20/ /g'` # replace '\x20' with space
if [ x"$PGDATA" = x ]; then
echo "failed to find PGDATA setting in ${SERVICE_NAME}.service"
exit 1
fi
-# Find the unit file for new version.
-if [ -f "/etc/systemd/system/${SERVICE_NAME}.service" ]
-then
- SERVICE_FILE="/etc/systemd/system/${SERVICE_NAME}.service"
-elif [ -f "/lib/systemd/system/${SERVICE_NAME}.service" ]
-then
- SERVICE_FILE="/lib/systemd/system/${SERVICE_NAME}.service"
-else
- echo "Could not find systemd unit file ${SERVICE_NAME}.service"
- exit 1
-fi
-
# Log file for pg_upgrade
PGUPLOG=/var/lib/pgsql/$PGMAJORVERSION/pgupgrade.log
# Log file for initdb
PGLOG=/var/lib/pgsql/9.5/initdb.log
-# Get data directory from the service file
-PGDATA=`sed -n 's/Environment=PGDATA=//p' "${SERVICE_FILE}"`
-
export PGDATA
# For SELinux we need to use 'runuser' not 'su'
view thread (7+ messages)
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected]
Subject: Re: systemd service files vs. postgresql9x-setup
In-Reply-To: <CADKbJJWtk_wh-SF5rrsLxNUvgmd2FnzShQGvj7-dwTa5VRGqRw@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox