|
|
7686b4 |
diff -up postgresql-9.2.5/postgresql-check-db-dir.scl-env-check postgresql-9.2.5/postgresql-check-db-dir
|
|
|
7686b4 |
--- postgresql-9.2.5/postgresql-check-db-dir.scl-env-check 2013-11-19 18:53:19.427860959 +0100
|
|
|
7686b4 |
+++ postgresql-9.2.5/postgresql-check-db-dir 2013-11-22 15:29:59.053418528 +0100
|
|
|
7686b4 |
@@ -37,7 +37,7 @@ then
|
|
|
7686b4 |
elif [ x`cat "$PGDATA/PG_VERSION"` = x"$PREVMAJORVERSION" ]
|
|
|
7686b4 |
then
|
|
|
7686b4 |
echo $"An old version of the database format was found."
|
|
|
7686b4 |
- echo $"Use \"postgresql-setup upgrade\" to upgrade to version $PGMAJORVERSION."
|
|
|
7686b4 |
+ echo $"Use \"scl enable __SCL_NAME__ 'postgresql-setup upgrade'\" to upgrade to version $PGMAJORVERSION."
|
|
|
7686b4 |
echo $"See $PGDOCDIR/README.rpm-dist for more information."
|
|
|
7686b4 |
exit 1
|
|
|
7686b4 |
else
|
|
|
7686b4 |
@@ -49,7 +49,7 @@ then
|
|
|
7686b4 |
else
|
|
|
7686b4 |
# No existing PGDATA! Warn the user to initdb it.
|
|
|
7686b4 |
echo $"\"$PGDATA\" is missing or empty."
|
|
|
7686b4 |
- echo $"Use \"postgresql-setup initdb\" to initialize the database cluster."
|
|
|
7686b4 |
+ echo $"Use \"scl enable __SCL_NAME__ 'postgresql-setup initdb'\" to initialize the database cluster."
|
|
|
7686b4 |
echo $"See $PGDOCDIR/README.rpm-dist for more information."
|
|
|
7686b4 |
exit 1
|
|
|
7686b4 |
fi
|
|
|
7686b4 |
diff -up postgresql-9.2.5/postgresql.service.scl-env-check postgresql-9.2.5/postgresql.service
|
|
|
7686b4 |
--- postgresql-9.2.5/postgresql.service.scl-env-check 2013-11-22 15:26:20.372109015 +0100
|
|
|
7686b4 |
+++ postgresql-9.2.5/postgresql.service 2013-11-22 15:29:59.053418528 +0100
|
|
|
7686b4 |
@@ -39,6 +39,9 @@ Environment=PGPORT=5432
|
|
|
7686b4 |
# Location of database directory
|
|
|
7686b4 |
Environment=PGDATA=/var/lib/pgsql/data
|
|
|
7686b4 |
|
|
|
7686b4 |
+# Load scl environment settings
|
|
|
7686b4 |
+EnvironmentFile=__SCL_SCRIPTS__/service-environment
|
|
|
7686b4 |
+
|
|
|
7686b4 |
# Where to send early-startup messages from the server (before the logging
|
|
|
7686b4 |
# options of postgresql.conf take effect)
|
|
|
7686b4 |
# This is normally controlled by the global default set by systemd
|
|
|
7686b4 |
@@ -47,10 +50,10 @@ Environment=PGDATA=/var/lib/pgsql/data
|
|
|
7686b4 |
# Disable OOM kill on the postmaster
|
|
|
7686b4 |
OOMScoreAdjust=-1000
|
|
|
7686b4 |
|
|
|
7686b4 |
-ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGDATA}
|
|
|
7686b4 |
-ExecStart=/usr/bin/pg_ctl start -D ${PGDATA} -s -o "-p ${PGPORT}" -w -t 300
|
|
|
7686b4 |
-ExecStop=/usr/bin/pg_ctl stop -D ${PGDATA} -s -m fast
|
|
|
7686b4 |
-ExecReload=/usr/bin/pg_ctl reload -D ${PGDATA} -s
|
|
|
7686b4 |
+ExecStartPre=/usr/bin/scl-service $POSTGRESQL92_SCLS_ENABLED /usr/bin/postgresql-check-db-dir ${PGDATA}
|
|
|
7686b4 |
+ExecStart=/usr/bin/scl-service $POSTGRESQL92_SCLS_ENABLED /usr/bin/pg_ctl start -D ${PGDATA} -s -o "-p ${PGPORT}" -w -t 300
|
|
|
7686b4 |
+ExecStop=/usr/bin/scl-service $POSTGRESQL92_SCLS_ENABLED /usr/bin/pg_ctl stop -D ${PGDATA} -s -m fast
|
|
|
7686b4 |
+ExecReload=/usr/bin/scl-service $POSTGRESQL92_SCLS_ENABLED /usr/bin/pg_ctl reload -D ${PGDATA} -s
|
|
|
7686b4 |
|
|
|
7686b4 |
# Give a reasonable amount of time for the server to start up/shut down
|
|
|
7686b4 |
TimeoutSec=300
|
|
|
7686b4 |
diff -up postgresql-9.2.5/postgresql-setup.scl-env-check postgresql-9.2.5/postgresql-setup
|
|
|
7686b4 |
--- postgresql-9.2.5/postgresql-setup.scl-env-check 2013-11-22 15:26:20.371109008 +0100
|
|
|
7686b4 |
+++ postgresql-9.2.5/postgresql-setup 2013-11-22 15:38:24.442468204 +0100
|
|
|
7686b4 |
@@ -20,7 +20,7 @@ PREVPGENGINE=xxxx
|
|
|
7686b4 |
SERVICE_NAME="$2"
|
|
|
7686b4 |
if [ x"$SERVICE_NAME" = x ]
|
|
|
7686b4 |
then
|
|
|
7686b4 |
- SERVICE_NAME=postgresql
|
|
|
7686b4 |
+ SERVICE_NAME=__SCL_NAME__-postgresql
|
|
|
7686b4 |
fi
|
|
|
7686b4 |
|
|
|
7686b4 |
# this parsing technique fails for PGDATA pathnames containing spaces,
|
|
|
7686b4 |
@@ -85,7 +85,10 @@ perform_initdb(){
|
|
|
7686b4 |
fi
|
|
|
7686b4 |
|
|
|
7686b4 |
# Initialize the database
|
|
|
7686b4 |
- $SU -l postgres -c "$PGENGINE/initdb --pgdata='$PGDATA' --auth='ident'" >> "$PGLOG" 2>&1 < /dev/null
|
|
|
7686b4 |
+ $SU -l postgres -c "
|
|
|
7686b4 |
+ source __SCL_SCRIPTS__/service-environment ; \
|
|
|
7686b4 |
+ source scl_source enable \$POSTGRESQL92_SCLS_ENABLED ; \
|
|
|
7686b4 |
+ $PGENGINE/initdb --pgdata='$PGDATA' --auth='ident'" >> "$PGLOG" 2>&1 < /dev/null
|
|
|
7686b4 |
|
|
|
7686b4 |
# Create directory for postmaster log files
|
|
|
7686b4 |
mkdir "$PGDATA/pg_log"
|
|
|
7686b4 |
@@ -159,7 +162,10 @@ upgrade(){
|
|
|
7686b4 |
if perform_initdb
|
|
|
7686b4 |
then
|
|
|
7686b4 |
# Do the upgrade
|
|
|
7686b4 |
- $SU -l postgres -c "$PGENGINE/pg_upgrade \
|
|
|
7686b4 |
+ $SU -l postgres -c "
|
|
|
7686b4 |
+ source __SCL_SCRIPTS__/service-environment ; \
|
|
|
7686b4 |
+ source scl_source enable \$POSTGRESQL92_SCLS_ENABLED ; \
|
|
|
7686b4 |
+ $PGENGINE/pg_upgrade \
|
|
|
7686b4 |
'--old-bindir=$PREVPGENGINE' \
|
|
|
7686b4 |
'--new-bindir=$PGENGINE' \
|
|
|
7686b4 |
'--old-datadir=$PGDATAOLD' \
|