From d02cb625d173e8aba5e1cfe63f2616725d93d15e Mon Sep 17 00:00:00 2001 From: Tingfang Bao Date: Fri, 19 Jun 2020 10:44:09 -0700 Subject: [PATCH] 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/shellcheck Co-authored-by: Tingfang Bao Co-authored-by: Xin Zhang Co-authored-by: Ning Wu Co-authored-by: Shaoqi Bai --- gpMgmt/bin/generate-greenplum-path.sh | 97 +++++---------------------- 1 file changed, 18 insertions(+), 79 deletions(-) diff --git a/gpMgmt/bin/generate-greenplum-path.sh b/gpMgmt/bin/generate-greenplum-path.sh index 0f47fd32eb..af022cd796 100755 --- a/gpMgmt/bin/generate-greenplum-path.sh +++ b/gpMgmt/bin/generate-greenplum-path.sh @@ -1,26 +1,15 @@ #!/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 <