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