systemd service files vs. postgresql9x-setup

From: Bernd Helmle <mailings(at)oopsware(dot)de>
To: pgsql-pkg-yum(at)postgresql(dot)org
Subject: systemd service files vs. postgresql9x-setup
Date: 2015-08-12 14:18:06
Message-ID: 0EDD19E44F05669CE0D68F45@eje.credativ.lan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-pkg-yum

Hi,

Looks like postgresql9[45]-setup is careless when someone tries to use them
in customized
systemd environments (e.g. via drop-in configurations[1]). Currently we do
this:

# 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`

[...some more code later...]

# Get data directory from the service file
PGDATA=`sed -n 's/Environment=PGDATA=//p' "${SERVICE_FILE}"`

So we obviously overwrite any PGDATA setting returned by 'systemctl show'
earlier. If someone uses service files only, this doesn't heavily matter,
since SERVICE_FILE is tested against multiple locations. However, drop-in
configurations are ignored/overwritten with this method. I don't
understand, why we do the sed approach anyways, since 'systemctl show'
already covers all cases, afaics. So i suggest to get rid of handling the
SERVICE_FILE directly and leave 'systemctl show' alone, patch attached.

Opinions?

[1] <http://www.freedesktop.org/software/systemd/man/systemd.unit.html>

--
Thanks

Bernd

Attachment Content-Type Size
0001-Get-rid-of-sed-magic-to-retrieve-PGDATA-directly-fro.patch application/octet-stream 2.7 KB

Responses

Browse pgsql-pkg-yum by date

  From Date Subject
Next Message Jeff Frost 2015-08-12 23:54:41 Re: systemd service files vs. postgresql9x-setup
Previous Message Devrim GÜNDÜZ 2015-08-11 06:38:25 Unavailability