From ac7035e1cdc6bfee70145af8cfd1b641dd3cb82d Mon Sep 17 00:00:00 2001 From: David Hill Date: Thu, 1 Nov 2018 09:53:53 -0500 Subject: [PATCH] MCOL-520 - sudo for mount amazon --- oam/install_scripts/module_installer.sh | 4 ++-- oamapps/postConfigure/mycnfUpgrade.cpp | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/oam/install_scripts/module_installer.sh b/oam/install_scripts/module_installer.sh index ba810b15c..cfd52161d 100755 --- a/oam/install_scripts/module_installer.sh +++ b/oam/install_scripts/module_installer.sh @@ -93,8 +93,8 @@ if [ $module = "um" ]; then echo "Setup UM Volume Mount" device=`$COLUMNSTORE_INSTALL_DIR/bin/getConfig Installation UMVolumeDeviceName$mid` mkdir -p $COLUMNSTORE_INSTALL_DIR/mysql/db > /dev/null 2>&1 - mount $device $COLUMNSTORE_INSTALL_DIR/mysql/db -t ext2 -o noatime,nodiratime,noauto - chown mysql:mysql -R $COLUMNSTORE_INSTALL_DIR/mysql > /dev/null 2>&1 + sudo mount $device $COLUMNSTORE_INSTALL_DIR/mysql/db -t ext2 -o noatime,nodiratime,noauto,user + sudo chown $user:$user -R $COLUMNSTORE_INSTALL_DIR/mysql > /dev/null 2>&1 fi fi fi diff --git a/oamapps/postConfigure/mycnfUpgrade.cpp b/oamapps/postConfigure/mycnfUpgrade.cpp index afe59e742..6d2967a43 100644 --- a/oamapps/postConfigure/mycnfUpgrade.cpp +++ b/oamapps/postConfigure/mycnfUpgrade.cpp @@ -212,7 +212,14 @@ int main(int argc, char* argv[]) } } - string cmd = "chown mysql:mysql " + mycnfFile; + string USER = "mysql"; + + char* p = getenv("USER"); + + if (p && *p) + USER = p; + + string cmd = "chown " + USER + ":" + USER + " " + mycnfFile; system(cmd.c_str()); exit (0);