Omaha #4533 Upgrade PostgreSQL to 9.3.9.

Former-commit-id: 85e76387ff22609803bc4a13413d912b7d3fab6e
This commit is contained in:
David Lovely 2015-08-05 20:11:54 -05:00
parent cb6dadd09b
commit fb17d06dfe
13 changed files with 1 additions and 619 deletions

View file

@ -1,364 +0,0 @@
%define _build_arch %(uname -i)
%define _postgresql_version 9.3.5
%define _postgres_build_loc %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
#
# AWIPS II PostgreSQL Spec File
#
Name: awips2-postgresql
Summary: AWIPS II PostgreSQL Distribution
Version: %{_postgresql_version}
Release: %{_component_version}.%{_component_release}%{?dist}
Group: AWIPSII
BuildRoot: %{_build_root}
BuildArch: %{_build_arch}
URL: N/A
License: N/A
Distribution: N/A
Vendor: Raytheon
Packager: Bryan Kowal
AutoReq: no
provides: awips2-postgresql
provides: awips2-base-component
%description
AWIPS II PostgreSQL Distribution - Contains the AWIPS II PostgreSQL Distribution.
This is just the postgresql application. There is a separate rpm that will initialize
and populate the AWIPS II databases.
%prep
# Ensure that a "buildroot" has been specified.
if [ "%{_build_root}" = "" ]; then
echo "ERROR: A BuildRoot has not been specified."
echo "FATAL: Unable to Continue ... Terminating."
exit 1
fi
if [ -d %{_build_root} ]; then
rm -rf %{_build_root}
fi
/bin/mkdir -p %{_build_root}
if [ $? -ne 0 ]; then
exit 1
fi
if [ -d %{_postgres_build_loc} ]; then
rm -rf %{_postgres_build_loc}
fi
mkdir -p %{_postgres_build_loc}
if [ $? -ne 0 ]; then
exit 1
fi
mkdir -p %{_postgres_build_loc}/awips2/postgresql
if [ $? -ne 0 ]; then
exit 1
fi
SRC_DIR="%{_baseline_workspace}/rpms/awips2.core/Installer.postgres/SOURCES"
POSTGRESQL_TAR_FILE="postgresql-%{_postgresql_version}.tar.gz"
# Copy our source tar file to the build directory.
cp ${SRC_DIR}/${POSTGRESQL_TAR_FILE} %{_postgres_build_loc}
# Untar the postgresql source
cd %{_postgres_build_loc}
tar -xvf ${POSTGRESQL_TAR_FILE}
%build
cd %{_postgres_build_loc}/postgresql-%{_postgresql_version}
./configure --prefix=%{_postgres_build_loc}/awips2/postgresql \
--with-libxml
if [ $? -ne 0 ]; then
exit 1
fi
make clean
if [ $? -ne 0 ]; then
exit 1
fi
make
if [ $? -ne 0 ]; then
exit 1
fi
cd %{_postgres_build_loc}/postgresql-%{_postgresql_version}/contrib/xml2
make
if [ $? -ne 0 ]; then
exit 1
fi
%install
# Copies the standard Raytheon licenses into a license directory for the
# current component.
function copyLegal()
{
# $1 == Component Build Root
COMPONENT_BUILD_DIR=${1}
mkdir -p ${RPM_BUILD_ROOT}/${COMPONENT_BUILD_DIR}/licenses
# Create a Tar file with our FOSS licenses.
tar -cjf %{_baseline_workspace}/rpms/legal/FOSS_licenses.tar \
%{_baseline_workspace}/rpms/legal/FOSS_licenses/
cp "%{_baseline_workspace}/rpms/legal/Master_Rights_File.pdf" \
${RPM_BUILD_ROOT}/${COMPONENT_BUILD_DIR}/licenses
cp %{_baseline_workspace}/rpms/legal/FOSS_licenses.tar \
${RPM_BUILD_ROOT}/${COMPONENT_BUILD_DIR}/licenses
rm -f %{_baseline_workspace}/rpms/legal/FOSS_licenses.tar
}
mkdir -p %{_build_root}/awips2/postgresql
mkdir -p %{_build_root}/awips2/psql
cd %{_postgres_build_loc}/postgresql-%{_postgresql_version}
make install
if [ $? -ne 0 ]; then
exit 1
fi
cd %{_postgres_build_loc}/postgresql-%{_postgresql_version}/contrib/xml2
make install
if [ $? -ne 0 ]; then
exit 1
fi
# relocate the psql executable
mkdir -p %{_build_root}/awips2/psql/bin
mv -v %{_postgres_build_loc}/awips2/postgresql/bin/psql \
%{_build_root}/awips2/psql/bin/psql
if [ $? -ne 0 ]; then
exit 1
fi
# duplicate libpq; eventually, we should just have PostgreSQL
# reference the libpq in /awips2/psq/lib
mkdir -p %{_build_root}/awips2/psql/lib
cp -Pv %{_postgres_build_loc}/awips2/postgresql/lib/libpq.so* \
%{_build_root}/awips2/psql/lib
if [ $? -ne 0 ]; then
exit 1
fi
SRC_DIR="%{_baseline_workspace}/rpms/awips2.core/Installer.postgres/SOURCES"
PROJ_SRC="proj-4.8.0.zip"
POSTGIS_SRC="postgis-2.0.6.tar.gz"
GEOS_BASE="geos-3.4.2"
GEOS_SRC="geos-3.4.2.tar.bz2"
GDAL_SRC="gdal192.zip"
# The directory that the src will be in after the tars are unzipped.
PROJ_SRC_DIR="proj-4.8.0"
POSTGIS_SRC_DIR="postgis-2.0.6"
GEOS_SRC_DIR="geos-3.4.2"
GDAL_SRC_DIR="gdal-1.9.2"
cp ${SRC_DIR}/${POSTGIS_SRC} %{_postgres_build_loc}
cp ${SRC_DIR}/${PROJ_SRC} %{_postgres_build_loc}
cp %{_baseline_workspace}/foss/${GEOS_BASE}/packaged/${GEOS_SRC} %{_postgres_build_loc}
cp ${SRC_DIR}/${GDAL_SRC} %{_postgres_build_loc}
cd %{_postgres_build_loc}
unzip ${PROJ_SRC}
if [ $? -ne 0 ]; then
exit 1
fi
tar -xvf ${POSTGIS_SRC}
if [ $? -ne 0 ]; then
exit 1
fi
tar -xvf ${GEOS_SRC}
if [ $? -ne 0 ]; then
exit 1
fi
unzip ${GDAL_SRC}
if [ $? -ne 0 ]; then
exit 1
fi
cd ${GEOS_SRC_DIR}
./configure --prefix=%{_postgres_build_loc}/awips2/postgresql
if [ $? -ne 0 ]; then
exit 1
fi
make
if [ $? -ne 0 ]; then
exit 1
fi
make install
if [ $? -ne 0 ]; then
exit 1
fi
cd ../${PROJ_SRC_DIR}
./configure --prefix=%{_postgres_build_loc}/awips2/postgresql --without-jni
if [ $? -ne 0 ]; then
exit 1
fi
make
if [ $? -ne 0 ]; then
exit 1
fi
make install
if [ $? -ne 0 ]; then
exit 1
fi
cd ../${GDAL_SRC_DIR}
./configure --prefix=%{_postgres_build_loc}/awips2/postgresql \
--with-expat-lib=%{_usr}/%{_lib}
if [ $? -ne 0 ]; then
exit 1
fi
make
if [ $? -ne 0 ]; then
exit 1
fi
make install
if [ $? -ne 0 ]; then
exit 1
fi
cd ../${POSTGIS_SRC_DIR}
_POSTGRESQL_ROOT=%{_postgres_build_loc}/awips2/postgresql
_POSTGRESQL_BIN=${_POSTGRESQL_ROOT}/bin
./configure \
--with-pgconfig=${_POSTGRESQL_BIN}/pg_config \
--with-geosconfig=${_POSTGRESQL_BIN}/geos-config \
--with-projdir=${_POSTGRESQL_ROOT} \
--with-gdalconfig=${_POSTGRESQL_BIN}/gdal-config \
--prefix=%{_postgres_build_loc}/awips2/postgresql
if [ $? -ne 0 ]; then
exit 1
fi
# disable doc since it attempts to download files from
# the internet
echo "#Do Nothing" > doc/Makefile.in
echo "docs:" > doc/Makefile
echo "" >> doc/Makefile
echo "docs-install:" >> doc/Makefile
echo "" >> doc/Makefile
echo "docs-uninstall:" >> doc/Makefile
echo "" >> doc/Makefile
echo "comments-install:" >> doc/Makefile
echo "" >> doc/Makefile
echo "comments-uninstall:" >> doc/Makefile
echo "" >> doc/Makefile
echo "clean:" >> doc/Makefile
echo "" >> doc/Makefile
make
# run make twice - the first time may fail due to doc
make
if [ $? -ne 0 ]; then
exit 1
fi
make install
if [ $? -ne 0 ]; then
exit 1
fi
# Create The PostgreSQL Data Directory
mkdir -p ${RPM_BUILD_ROOT}/awips2/data
/bin/cp -Rf %{_postgres_build_loc}/awips2/postgresql/* %{_build_root}/awips2/postgresql
if [ $? -ne 0 ]; then
exit 1
fi
STARTUP_SCRIPTS_TO_INCLUDE=('start_developer_postgres.sh' 'start_postgres.sh')
PATH_TO_STARTUP_SCRIPTS="rpms/awips2.core/Installer.postgres/scripts"
STARTUP_SCRIPT_DESTINATION="awips2/postgresql/bin"
# Copy The Startup Scripts
for script in ${STARTUP_SCRIPTS_TO_INCLUDE[*]};
do
cp -r %{_baseline_workspace}/${PATH_TO_STARTUP_SCRIPTS}/${script} \
${RPM_BUILD_ROOT}/${STARTUP_SCRIPT_DESTINATION}
done
copyLegal "awips2/postgresql"
mkdir -p %{_build_root}/etc/profile.d
mkdir -p %{_build_root}/etc/ld.so.conf.d
mkdir -p %{_build_root}/etc/init.d
touch %{_build_root}/etc/ld.so.conf.d/awips2-postgresql-%{_build_arch}.conf
echo "/awips2/postgresql/lib" >> %{_build_root}/etc/ld.so.conf.d/awips2-postgresql-%{_build_arch}.conf
PROFILE_D_DIR="rpms/awips2.core/Installer.postgres/scripts/profile.d"
cp %{_baseline_workspace}/${PROFILE_D_DIR}/* %{_build_root}/etc/profile.d
# Include the postgresql service script
cp %{_baseline_workspace}/rpms/awips2.core/Installer.postgres/scripts/init.d/edex_postgres \
%{_build_root}/etc/init.d
%pre
%post
# Run ldconfig
/sbin/ldconfig
%preun
if [ "${1}" = "1" ]; then
exit 0
fi
if [ -f /etc/init.d/edex_postgres ]; then
/sbin/chkconfig --del edex_postgres
fi
%postun
%clean
rm -rf ${RPM_BUILD_ROOT}
rm -rf %{_postgres_build_loc}
%package -n awips2-psql
Summary: AWIPS II PSQL Distribution
Group: AWIPSII
provides: awips2-psql
%description -n awips2-psql
AWIPS II PSQL Distribution - Contains the AWIPS II PSQL Distribution.
This is just the postgresql application. There is a separate rpm that will initialize
and populate the AWIPS II databases.
%files
%defattr(644,awips,fxalpha,755)
%attr(755,root,root) /etc/profile.d/awips2Postgres.csh
%attr(755,root,root) /etc/profile.d/awips2Postgres.sh
%attr(755,root,root) /etc/ld.so.conf.d/awips2-postgresql-%{_build_arch}.conf
%attr(744,root,root) /etc/init.d/edex_postgres
%attr(700,awips,fxalpha) /awips2/data
%dir /awips2/postgresql
%dir /awips2/postgresql/include
/awips2/postgresql/include/*
%dir /awips2/postgresql/lib
/awips2/postgresql/lib/*
%docdir /awips2/postgresql/licenses
%dir /awips2/postgresql/licenses
/awips2/postgresql/licenses/*
%dir /awips2/postgresql/share
/awips2/postgresql/share/*
%defattr(755,awips,fxalpha,755)
%dir /awips2/postgresql/bin
/awips2/postgresql/bin/*
%files -n awips2-psql
%defattr(755,awips,fxalpha,755)
%attr(755,root,root) /etc/profile.d/awips2PSQL.csh
%attr(755,root,root) /etc/profile.d/awips2PSQL.sh
%dir /awips2
%dir /awips2/psql
%dir /awips2/psql/bin
/awips2/psql/bin/*
%defattr(644,awips,fxalpha,755)
%dir /awips2/psql/lib
/awips2/psql/lib/*

View file

@ -1,89 +0,0 @@
#!/bin/bash
#
# edex_postgres This shell script takes care of starting and stopping
# the AWIPS EDEX postgreSQL instance.
#
# chkconfig: - 99 10
# description: PostgreSQL database, which is the instance \
# used by AWIPS EDEX.
# processname: postmaster
# config: %database_files_home/postgresql.conf
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
RETVAL=0
prog="postmaster"
# Installation prefix
# We will no longer be using hard-coded paths that need to be replaced.
# Use rpm to find the paths that we need.
JAVA_INSTALL="/awips2/java"
PYTHON_INSTALL="/awips2/python"
PSQL_INSTALL="/awips2/psql"
POSTGRESQL_INSTALL_ROOT="/awips2"
POSTGRESQL_INSTALL="${POSTGRESQL_INSTALL_ROOT}/postgresql"
PGDATA_DIR="${POSTGRESQL_INSTALL_ROOT}/data"
# Data directory
PGDATA="${PGDATA_DIR}"
# Who to run the postmaster as, usually "postgres". (NOT "root")
PGUSER=awips
# Where to keep a log file
PGLOG="$PGDATA/serverlog"
# The path that is to be used for the script
PATH=${JAVA_INSTALL}/bin:${PYTHON_INSTALL}/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
export LD_LIBRARY_PATH=${JAVA_INSTALL}/lib:${PYTHON_INSTALL}/lib:${PSQL_INSTALL}/lib
# What to use to start up the postmaster (we do NOT use pg_ctl for this,
# as it adds no value and can cause the postmaster to misrecognize a stale
# lock file)
DAEMON="${POSTGRESQL_INSTALL}/bin/postmaster"
# What to use to shut down the postmaster
PGCTL="${POSTGRESQL_INSTALL}/bin/pg_ctl"
[ -x $DAEMON ] || exit 0
[ -x $PGCTL ] || exit 0
# See how we were called.
case $1 in
start)
echo -n "Starting EDEX PostgreSQL: "
su $PGUSER -c "$DAEMON -D '$PGDATA' &" >>$PGLOG 2>&1
echo
RETVAL=$?
;;
stop)
echo -n "Stopping EDEX PostgreSQL: "
su $PGUSER -c "$PGCTL stop -D '$PGDATA' -s -m fast"
echo
RETVAL=$?
;;
restart)
echo -n "Restarting EDEX PostgreSQL: "
su $PGUSER -c "$PGCTL stop -D '$PGDATA' -s -m fast -w"
su $PGUSER -c "$DAEMON -D '$PGDATA' &" >>$PGLOG 2>&1
RETVAL=$?
;;
reload)
echo -n "Reload EDEX PostgreSQL: "
su $PGUSER -c "$PGCTL reload -D '$PGDATA' -s"
RETVAL=$?
;;
status)
su $PGUSER -c "$PGCTL status -D '$PGDATA'"
;;
*)
# Print help
echo "Usage: $0 {start|stop|restart|reload|status}" 1>&2
exit 1
;;
esac
exit $RETVAL

View file

@ -1,16 +0,0 @@
#!/bin/csh
# Determine where psql has been installed.
set PSQL_INSTALL="/awips2/psql"
if $?LD_LIBRARY_PATH then
setenv LD_LIBRARY_PATH ${PSQL_INSTALL}/lib:$LD_LIBRARY_PATH
else
setenv LD_LIBRARY_PATH ${PSQL_INSTALL}/lib
endif
if $?PATH then
setenv PATH ${PSQL_INSTALL}/bin:$PATH
else
setenv PATH ${PSQL_INSTALL}/bin
endif

View file

@ -1,21 +0,0 @@
#!/bin/bash
if [ -d /awips2/psql ]; then
# Determine Where awips2-psql Has Been Installed.
PSQL_INSTALL="/awips2/psql"
# Update The Environment.
# Determine if awips2-psql is Already On LD_LIBRARY_PATH
CHECK_PATH=`echo ${LD_LIBRARY_PATH} | grep ${PSQL_INSTALL}`
if [ "${CHECK_PATH}" = "" ]; then
# awips2-psql Is Not On LD_LIBRARY_PATH; Add It.
export LD_LIBRARY_PATH=${PSQL_INSTALL}/lib:${LD_LIBRARY_PATH}
fi
# Determine If awips2-psql Is Already Part Of The Path.
CHECK_PATH=`echo ${PATH} | grep ${PSQL_INSTALL}`
if [ "${CHECK_PATH}" = "" ]; then
# awips2-psql Is Not In The Path; Add It To The Path.
export PATH=${PSQL_INSTALL}/bin:${PATH}
fi
fi

View file

@ -1,16 +0,0 @@
#!/bin/csh
# Determine where postgres has been installed.
set POSTGRES_INSTALL="/awips2/postgresql"
if $?LD_LIBRARY_PATH then
setenv LD_LIBRARY_PATH ${POSTGRES_INSTALL}/lib:$LD_LIBRARY_PATH
else
setenv LD_LIBRARY_PATH ${POSTGRES_INSTALL}/lib
endif
if $?PATH then
setenv PATH ${POSTGRES_INSTALL}/bin:$PATH
else
setenv PATH ${POSTGRES_INSTALL}/bin
endif

View file

@ -1,24 +0,0 @@
#!/bin/bash
if [ -d /awips2/postgresql ]; then
# Determine Where awips2-postgresql Has Been Installed.
POSTGRESQL_INSTALL="/awips2/postgresql"
if [ "${POSTGRESQL_INSTALL}" = "" ]; then
return
fi
# Update The Environment.
# Determine if awips2-postgresql is Already On LD_LIBRARY_PATH
CHECK_PATH=`echo ${LD_LIBRARY_PATH} | grep ${POSTGRESQL_INSTALL}`
if [ "${CHECK_PATH}" = "" ]; then
# awips2-postgresql Is Not On LD_LIBRARY_PATH; Add It.
export LD_LIBRARY_PATH=${POSTGRESQL_INSTALL}/lib:${LD_LIBRARY_PATH}
fi
# Determine if awips2-postgresql Is Already Part Of The Path.
CHECK_PATH=`echo ${PATH} | grep ${POSTGRESQL_INSTALL}`
if [ "${CHECK_PATH}" = "" ]; then
# awips2-postgresql Is Not In The Path; Add It To The Path.
export PATH=${POSTGRESQL_INSTALL}/bin:${PATH}
fi
fi

View file

@ -1,44 +0,0 @@
#!/bin/sh
## EDIT FROM HERE
# Use rpm to find installation locations / directory paths.
POSTGRESQL_INSTALL="/awips2"
# Installation prefix
prefix="${POSTGRESQL_INSTALL}/postgresql"
# Data Directory
PGDATA="${POSTGRESQL_INSTALL}/data"
# Where to keep a log file
PGLOG="$PGDATA/serverlog"
USER=`whoami`
## STOP EDITING HERE
# The path that is to be used for the script
PATH=${prefix}/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
export LD_LIBRARY_PATH=${prefix}/lib
# What to use to start up the postmaster (we do NOT use pg_ctl for this,
# as it adds no value and can cause the postmaster to misrecognize a stale
# lock file)
DAEMON="$prefix/bin/postmaster"
# What to use to shut down the postmaster
PGCTL="$prefix/bin/pg_ctl"
set -e
# Only start if we can find the postmaster.
test -x $DAEMON || exit 0
echo -n "Starting PostgreSQL: "
$DAEMON -D $PGDATA
exit 0

View file

@ -1,44 +0,0 @@
#!/bin/sh
## EDIT FROM HERE
# Use rpm to find installation locations / directory paths.
POSTGRESQL_INSTALL="/awips2"
# Installation prefix
prefix="${POSTGRESQL_INSTALL}/postgresql"
# Data Directory
PGDATA="${POSTGRESQL_INSTALL}/data"
# Where to keep a log file
PGLOG="$PGDATA/serverlog"
USER=`whoami`
## STOP EDITING HERE
# The path that is to be used for the script
PATH=${POSTGRESQL_INSTALL}/postgresql/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
export LD_LIBRARY_PATH=${POSTGRESQL_INSTALL}/postgresql/lib
# What to use to start up the postmaster (we do NOT use pg_ctl for this,
# as it adds no value and can cause the postmaster to misrecognize a stale
# lock file)
DAEMON="$prefix/bin/postmaster"
# What to use to shut down the postmaster
PGCTL="$prefix/bin/pg_ctl"
set -e
# Only start if we can find the postmaster.
test -x $DAEMON || exit 0
echo -n "Starting PostgreSQL: "
$DAEMON -D $PGDATA
exit 0

View file

@ -252,7 +252,7 @@ function lookupRPM()
return 0
fi
if [ "${1}" = "awips2-postgres" ]; then
export RPM_SPECIFICATION="${awips2_core_dir}/Installer.postgres"
export RPM_SPECIFICATION="${installer_dir}/postgresql-9.3.9"
return 0
fi
if [ "${1}" = "awips2-pgadmin3" ]; then