提交 d02cb625 编写于 作者: T Tingfang Bao 提交者: Bradford D. Boyle

Update generate-greenplum-path.sh for upgrade package

Following the [Greenplum Server RPM Packaging Specification][0], we need
to update greenplum_path.sh file, and ensure many environment variables
set correct.

There are a few basic requirments for Greenplum Path Layer:

* greenplum-path.sh shall be installed to `${installation
  prefix}/greenplum-db-[package-version]/greenplum_path.sh`
* ${GPHOME} is set by given parameter, by default it should point to
  `%{installation prefix}/greenplum-db-devel`
* `${LD_LIBRARY_PATH}` shall be safely set to avoid a trailing colon
  (which will cause the linker to search the current directory when
  resolving shared objects)
* `${PYTHONHOME}` shall be set to `${GPHOME}/ext/python`
* `${PYTHONPATH}` shall be set to `${GPHOME}/lib/python`
* `${PATH}` shall be set to `${GPHOME}/bin:${PYTHONHOME}/bin:${PATH}`
* If the file `${GPHOME}/etc/openssl.cnf` exists then `${OPENSSL_CONF}`
  shall be set to `${GPHOME}/etc/openssl.cnf`
* The greenplum_path.sh file shall pass [ShellCheck][1]

[0]: https://github.com/greenplum-db/greenplum-database-release/blob/master/Greenplum-Server-RPM-Packaging-Specification.md#detailed-package-behavior
[1]: https://github.com/koalaman/shellcheckCo-authored-by: NTingfang Bao <bbao@pivotal.io>
Co-authored-by: NXin Zhang <zhxin@vmware.com>
Co-authored-by: NNing Wu <ningw@vmware.com>
Co-authored-by: NShaoqi Bai <bshaoqi@vmware.com>
上级 d3fcb525
#!/usr/bin/env bash
if [ x$1 != x ] ; then
GPHOME_PATH=$1
else
GPHOME_PATH="\`pwd\`"
if [ -z "$1" ]; then
printf "Must specify a value for GPHOME"
exit 1
fi
if [ "$2" = "ISO" ] ; then
cat <<-EOF
if [ "\${BASH_SOURCE:0:1}" == "/" ]
then
GPHOME=\`dirname "\$BASH_SOURCE"\`
else
GPHOME=\`pwd\`/\`dirname "\$BASH_SOURCE"\`
fi
EOF
else
cat <<-EOF
GPHOME=${GPHOME_PATH}
EOF
fi
GPHOME_PATH="$1"
cat <<EOF
GPHOME="${GPHOME_PATH}"
EOF
PLAT=`uname -s`
if [ $? -ne 0 ] ; then
......@@ -28,78 +17,28 @@ if [ $? -ne 0 ] ; then
exit 1
fi
cat << EOF
# Replace with symlink path if it is present and correct
if [ -h \${GPHOME}/../greenplum-db ]; then
GPHOME_BY_SYMLINK=\`(cd \${GPHOME}/../greenplum-db/ && pwd -P)\`
if [ x"\${GPHOME_BY_SYMLINK}" = x"\${GPHOME}" ]; then
GPHOME=\`(cd \${GPHOME}/../greenplum-db/ && pwd -L)\`/.
fi
unset GPHOME_BY_SYMLINK
fi
EOF
cat <<EOF
#setup PYTHONHOME
if [ -x \$GPHOME/ext/python/bin/python ]; then
PYTHONHOME="\$GPHOME/ext/python"
export PYTHONHOME
fi
EOF
#setup PYTHONPATH
if [ "x${PYTHONPATH}" == "x" ]; then
PYTHONPATH="\$GPHOME/lib/python"
else
PYTHONPATH="\$GPHOME/lib/python:${PYTHONPATH}"
fi
cat <<EOF
PYTHONPATH=${PYTHONPATH}
EOF
GP_BIN_PATH=\$GPHOME/bin
GP_LIB_PATH=\$GPHOME/lib
if [ -n "$PYTHONHOME" ]; then
GP_BIN_PATH=${GP_BIN_PATH}:\$PYTHONHOME/bin
GP_LIB_PATH=${GP_LIB_PATH}:\$PYTHONHOME/lib
fi
cat <<EOF
PATH=${GP_BIN_PATH}:\$PATH
EOF
cat <<EOF
LD_LIBRARY_PATH=${GP_LIB_PATH}:\${LD_LIBRARY_PATH-}
export LD_LIBRARY_PATH
EOF
# AIX uses yet another library path variable
# Also, Python on AIX requires special copies of some libraries. Hence, lib/pware.
if [ "${PLAT}" = "AIX" ]; then
cat <<EOF
PYTHONPATH=\${GPHOME}/ext/python/lib/python2.7:\${PYTHONPATH}
LIBPATH=\${GPHOME}/lib/pware:\${GPHOME}/lib:\${GPHOME}/ext/python/lib:/usr/lib/threads:\${LIBPATH}
cat <<"EOF"
PYTHONPATH="${GPHOME}/ext/python/lib/python2.7:${PYTHONPATH}"
LIBPATH="${GPHOME}/lib/pware:${GPHOME}/lib:${GPHOME}/ext/python/lib:/usr/lib/threads:${LIBPATH}"
export LIBPATH
GP_LIBPATH_FOR_PYTHON=\${GPHOME}/lib/pware
GP_LIBPATH_FOR_PYTHON="${GPHOME}/lib/pware"
export GP_LIBPATH_FOR_PYTHON
EOF
fi
# openssl configuration file path
cat <<EOF
if [ -e \$GPHOME/etc/openssl.cnf ]; then
OPENSSL_CONF=\$GPHOME/etc/openssl.cnf
export OPENSSL_CONF
cat <<"EOF"
if [ -e "$GPHOME/etc/openssl.cnf" ]; then
OPENSSL_CONF="$GPHOME/etc/openssl.cnf"
fi
EOF
cat <<EOF
export GPHOME
export PATH
EOF
cat <<EOF
export PYTHONHOME
export PYTHONPATH
export LD_LIBRARY_PATH
export OPENSSL_CONF
EOF
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册