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'