From ef4fab84087ed993d22dc5a2b359b591152ea1e9 Mon Sep 17 00:00:00 2001 From: David Hill Date: Mon, 22 Oct 2018 13:23:00 -0500 Subject: [PATCH] MCOL-520 - remove use of /usr/default/columnstore --- dbcon/mysql/mysql-Columnstore | 27 ++++++++++++++++++++++++--- oam/install_scripts/columnstore | 26 +++++++++++++++++++++----- oam/install_scripts/startupTests.sh | 24 +++++++++++++++++++++--- oam/post/functions | 25 +++++++++++++++++++++++-- oam/post/test-001.sh | 25 +++++++++++++++++++++++-- oam/post/test-002.sh | 25 +++++++++++++++++++++++-- oam/post/test-003.sh | 25 +++++++++++++++++++++++-- oam/post/test-004.sh | 26 ++++++++++++++++++++++++-- 8 files changed, 182 insertions(+), 21 deletions(-) diff --git a/dbcon/mysql/mysql-Columnstore b/dbcon/mysql/mysql-Columnstore index 9f130d5dc..596cdb025 100755 --- a/dbcon/mysql/mysql-Columnstore +++ b/dbcon/mysql/mysql-Columnstore @@ -43,12 +43,33 @@ # If you change base dir, you must also change datadir. These may get # overwritten by settings in the MySQL configuration files. -if [ -z "$COLUMNSTORE_INSTALL_DIR" ]; then - test -f /etc/default/columnstore && . /etc/default/columnstore +prefix=/usr/local + +USER=`whoami 2>/dev/null` + +if [ $USER != "root" ]; then + prefix=$HOME +fi + +if [ $USER != "root" ]; then + if [ -f $prefix/.bash_profile ]; then + profileFile=$prefix/.bash_profile + elif [ -f $prefix/.profile ]; then + profileFile=$prefix/.profile + else + profileFile=$prefix/.bashrc + fi + + . .$profileFile +fi + +# Source function library. +if [ -f /etc/init.d/functions ]; then + . /etc/init.d/functions fi if [ -z "$COLUMNSTORE_INSTALL_DIR" ]; then - COLUMNSTORE_INSTALL_DIR=/usr/local/mariadb/columnstore + COLUMNSTORE_INSTALL_DIR=/usr/local/mariadb/columnstore fi export COLUMNSTORE_INSTALL_DIR=$COLUMNSTORE_INSTALL_DIR diff --git a/oam/install_scripts/columnstore b/oam/install_scripts/columnstore index c7adef015..409497e32 100644 --- a/oam/install_scripts/columnstore +++ b/oam/install_scripts/columnstore @@ -17,15 +17,31 @@ # Short-Description: Start/stop MariaDB Columnstore DW DBMS ### END INIT INFO +prefix=/usr/local + +USER=`whoami 2>/dev/null` + +if [ $USER != "root" ]; then + prefix=$HOME +fi + +if [ $USER != "root" ]; then + if [ -f $prefix/.bash_profile ]; then + profileFile=$prefix/.bash_profile + elif [ -f $prefix/.profile ]; then + profileFile=$prefix/.profile + else + profileFile=$prefix/.bashrc + fi + + . .$profileFile +fi + # Source function library. if [ -f /etc/init.d/functions ]; then . /etc/init.d/functions fi -if [ -z "$COLUMNSTORE_INSTALL_DIR" ]; then - test -f /etc/default/columnstore && . /etc/default/columnstore -fi - if [ -z "$COLUMNSTORE_INSTALL_DIR" ]; then COLUMNSTORE_INSTALL_DIR=/usr/local/mariadb/columnstore fi @@ -40,7 +56,7 @@ if [ $InstallDir != "/usr/local/mariadb/columnstore" ]; then fi #hadoop -plugin=`$COLUMNSTORE_INSTALL_DIR/bin/getConfig SystemConfig DataFilePlugin` +plugin=`$InstallDir/bin/getConfig SystemConfig DataFilePlugin` if [ -n "$plugin" ]; then setenv=`$InstallDir/bin/getConfig SystemConfig DataFileEnvFile` . $InstallDir/bin/$setenv >/dev/null 2>&1 diff --git a/oam/install_scripts/startupTests.sh b/oam/install_scripts/startupTests.sh index 00615518b..ac290df43 100755 --- a/oam/install_scripts/startupTests.sh +++ b/oam/install_scripts/startupTests.sh @@ -5,8 +5,27 @@ # startupTests - perform sanity testing on system DB at system startup time # called by Process-Monitor -if [ -z "$COLUMNSTORE_INSTALL_DIR" ]; then - test -f /etc/default/columnstore && . /etc/default/columnstore +USER=`whoami 2>/dev/null` + +if [ $USER != "root" ]; then + prefix=$HOME +fi + +if [ $USER != "root" ]; then + if [ -f $prefix/.bash_profile ]; then + profileFile=$prefix/.bash_profile + elif [ -f $prefix/.profile ]; then + profileFile=$prefix/.profile + else + profileFile=$prefix/.bashrc + fi + + . .$profileFile +fi + +# Source function library. +if [ -f /etc/init.d/functions ]; then + . /etc/init.d/functions fi if [ -z "$COLUMNSTORE_INSTALL_DIR" ]; then @@ -14,7 +33,6 @@ if [ -z "$COLUMNSTORE_INSTALL_DIR" ]; then fi export COLUMNSTORE_INSTALL_DIR=$COLUMNSTORE_INSTALL_DIR - test -f $COLUMNSTORE_INSTALL_DIR/post/functions && . $COLUMNSTORE_INSTALL_DIR/post/functions for testScript in $COLUMNSTORE_INSTALL_DIR/post/*.sh; do diff --git a/oam/post/functions b/oam/post/functions index 477b0d77a..e5cb8c3a4 100755 --- a/oam/post/functions +++ b/oam/post/functions @@ -2,8 +2,29 @@ # $Id: functions 2937 2012-05-30 18:17:09Z rdempsey $ # -if [ -z "$COLUMNSTORE_INSTALL_DIR" ]; then - test -f /etc/default/columnstore && . /etc/default/columnstore +prefix=/usr/local + +USER=`whoami 2>/dev/null` + +if [ $USER != "root" ]; then + prefix=$HOME +fi + +if [ $USER != "root" ]; then + if [ -f $prefix/.bash_profile ]; then + profileFile=$prefix/.bash_profile + elif [ -f $prefix/.profile ]; then + profileFile=$prefix/.profile + else + profileFile=$prefix/.bashrc + fi + + . .$profileFile +fi + +# Source function library. +if [ -f /etc/init.d/functions ]; then + . /etc/init.d/functions fi if [ -z "$COLUMNSTORE_INSTALL_DIR" ]; then diff --git a/oam/post/test-001.sh b/oam/post/test-001.sh index 030705ed2..47e18487f 100755 --- a/oam/post/test-001.sh +++ b/oam/post/test-001.sh @@ -2,8 +2,29 @@ # # $Id: test-001.sh 3704 2013-08-07 03:33:20Z bwilkinson $ -if [ -z "$COLUMNSTORE_INSTALL_DIR" ]; then - test -f /etc/default/columnstore && . /etc/default/columnstore +prefix=/usr/local + +USER=`whoami 2>/dev/null` + +if [ $USER != "root" ]; then + prefix=$HOME +fi + +if [ $USER != "root" ]; then + if [ -f $prefix/.bash_profile ]; then + profileFile=$prefix/.bash_profile + elif [ -f $prefix/.profile ]; then + profileFile=$prefix/.profile + else + profileFile=$prefix/.bashrc + fi + + . .$profileFile +fi + +# Source function library. +if [ -f /etc/init.d/functions ]; then + . /etc/init.d/functions fi if [ -z "$COLUMNSTORE_INSTALL_DIR" ]; then diff --git a/oam/post/test-002.sh b/oam/post/test-002.sh index ed0b6589f..42f52d3a8 100755 --- a/oam/post/test-002.sh +++ b/oam/post/test-002.sh @@ -2,8 +2,29 @@ # # $Id: test-002.sh 2937 2012-05-30 18:17:09Z rdempsey $ -if [ -z "$COLUMNSTORE_INSTALL_DIR" ]; then - test -f /etc/default/columnstore && . /etc/default/columnstore +prefix=/usr/local + +USER=`whoami 2>/dev/null` + +if [ $USER != "root" ]; then + prefix=$HOME +fi + +if [ $USER != "root" ]; then + if [ -f $prefix/.bash_profile ]; then + profileFile=$prefix/.bash_profile + elif [ -f $prefix/.profile ]; then + profileFile=$prefix/.profile + else + profileFile=$prefix/.bashrc + fi + + . .$profileFile +fi + +# Source function library. +if [ -f /etc/init.d/functions ]; then + . /etc/init.d/functions fi if [ -z "$COLUMNSTORE_INSTALL_DIR" ]; then diff --git a/oam/post/test-003.sh b/oam/post/test-003.sh index a01f3e933..c3dc2467c 100755 --- a/oam/post/test-003.sh +++ b/oam/post/test-003.sh @@ -2,8 +2,29 @@ # # $Id: test-003.sh 2937 2012-05-30 18:17:09Z rdempsey $ -if [ -z "$COLUMNSTORE_INSTALL_DIR" ]; then - test -f /etc/default/columnstore && . /etc/default/columnstore +prefix=/usr/local + +USER=`whoami 2>/dev/null` + +if [ $USER != "root" ]; then + prefix=$HOME +fi + +if [ $USER != "root" ]; then + if [ -f $prefix/.bash_profile ]; then + profileFile=$prefix/.bash_profile + elif [ -f $prefix/.profile ]; then + profileFile=$prefix/.profile + else + profileFile=$prefix/.bashrc + fi + + . .$profileFile +fi + +# Source function library. +if [ -f /etc/init.d/functions ]; then + . /etc/init.d/functions fi if [ -z "$COLUMNSTORE_INSTALL_DIR" ]; then diff --git a/oam/post/test-004.sh b/oam/post/test-004.sh index dcabcbfbb..6f6e009cb 100644 --- a/oam/post/test-004.sh +++ b/oam/post/test-004.sh @@ -6,14 +6,36 @@ # Validates that FilesPerColumnPartition setting is not set lower than existing extents. # -if [ -z "$COLUMNSTORE_INSTALL_DIR" ]; then - test -f /etc/default/columnstore && . /etc/default/columnstore +prefix=/usr/local + +USER=`whoami 2>/dev/null` + +if [ $USER != "root" ]; then + prefix=$HOME +fi + +if [ $USER != "root" ]; then + if [ -f $prefix/.bash_profile ]; then + profileFile=$prefix/.bash_profile + elif [ -f $prefix/.profile ]; then + profileFile=$prefix/.profile + else + profileFile=$prefix/.bashrc + fi + + . .$profileFile +fi + +# Source function library. +if [ -f /etc/init.d/functions ]; then + . /etc/init.d/functions fi if [ -z "$COLUMNSTORE_INSTALL_DIR" ]; then COLUMNSTORE_INSTALL_DIR=/usr/local/mariadb/columnstore fi +export COLUMNSTORE_INSTALL_DIR=$COLUMNSTORE_INSTALL_DIR export COLUMNSTORE_INSTALL_DIR=$COLUMNSTORE_INSTALL_DIR test -f $COLUMNSTORE_INSTALL_DIR/post/functions && . $COLUMNSTORE_INSTALL_DIR/post/functions