#!/bin/bash # # $Id: module_installer.sh 421 2007-04-05 15:46:55Z dhill $ # # Setup the Custom OS files during a System install on a module # # # append columnstore OS files to Linux OS file # # rpmmode=install user=`whoami 2>/dev/null` quiet=0 shiftcnt=0 password=" " for arg in "$@"; do if [ $(expr -- "$arg" : '--rpmmode=') -eq 10 ]; then rpmmode="$(echo $arg | awk -F= '{print $2}')" ((shiftcnt++)) elif [ $(expr -- "$arg" : '--user=') -eq 7 ]; then user="$(echo $arg | awk -F= '{print $2}')" ((shiftcnt++)) elif [ $(expr -- "$arg" : '--quiet') -eq 7 ]; then quiet=1 ((shiftcnt++)) elif [ $(expr -- "$arg" : '--port') -eq 6 ]; then mysqlPort="$(echo $arg | awk -F= '{print $2}')" ((shiftcnt++)) elif [ $(expr -- "$arg" : '--module') -eq 8 ]; then module="$(echo $arg | awk -F= '{print $2}')" ((shiftcnt++)) elif [ $(expr -- "$arg" : '--password') -eq 10 ]; then password="$(echo $arg | awk -F= '{print $2}')" ((shiftcnt++)) fi done shift $shiftcnt PMwithUM=`mcsGetConfig Installation PMwithUM` ServerTypeInstall=`mcsGetConfig Installation ServerTypeInstall` #get temp directory tmpDir=`mcsGetConfig SystemConfig SystemTempFileDir` cloud=`mcsGetConfig Installation Cloud` if [ $cloud = "amazon-ec2" ] || [ $cloud = "amazon-vpc" ]; then echo "Amazon setup on Module" cp /var/lib/columnstore/local/etc/credentials $HOME/.aws/. > /dev/null 2>&1 if [ $module = "pm" ]; then if test -f /var/lib/columnstore/local/etc/pm1/fstab ; then echo "Setup fstab on Module" SUDO="" if [ $user != "root" ]; then SUDO="sudo " fi touch /etc/fstab $SUDO chmod 666 /etc/fstab rm -f /etc/fstab.columnstoreSave cp /etc/fstab /etc/fstab.columnstoreSave cat /var/lib/columnstore/local/etc/pm1/fstab >> /etc/fstab fi fi fi . @ENGINE_SUPPORTDIR@/columnstore_functions mid=`module_id` #if um, cloud, separate system type, external um storage, then setup mount if [ $cloud = "amazon-ec2" ] || [ $cloud = "amazon-vpc" ]; then if [ $module = "um" ]; then systemtype=`mcsGetConfig Installation ServerTypeInstall` if [ $systemtype = "1" ]; then umstoragetype=`mcsGetConfig Installation UMStorageType` fi fi #setup rc.local for amazon RCFILE=/etc/rc.d/rc.local if [ $user != "root" ]; then echo "uncomment runuser in rc.local, amazon AMI" sudo sed -i -e 's/#runuser/runuser/g' /etc/rc.d/rc.local >/dev/null 2>&1 fi fi #if pm, create dbroot directories if [ $module = "pm" ]; then numdbroots=`mcsGetConfig SystemConfig DBRootCount` for (( id=1; id<$numdbroots+1; id++ )); do mkdir -p /var/lib/columnstore/data$id > /dev/null 2>&1 chmod 755 /var/lib/columnstore/data$id done fi # if mysqlrep is on and module has a my.cnf file, upgrade it MySQLRep=`mcsGetConfig Installation MySQLRep` if [ $MySQLRep = "y" ]; then if test -f @MARIADB_MYCNFDIR@/columnstore.cnf ; then echo "Run Upgrade on my.cnf on Module" mycnfUpgrade > ${tmpDir}/mycnfUpgrade.log 2>&1 fi fi if test -f @MARIADB_MYCNFDIR@/columnstore.cnf ; then mysqlPort=`mcsGetConfig Installation MySQLPort` echo "Run Mysql Port update on my.cnf on Module" mycnfUpgrade $mysqlPort > ${tmpDir}/mycnfUpgrade_port.log 2>&1 fi # if um, run mysql install scripts if [ $module = "um" ] || ( [ $module = "pm" ] && [ $PMwithUM = "y" ] ) || [ $ServerTypeInstall = "2" ]; then mysqlPassword=" " if [[ $password != " " ]]; then mysqlPassword="--password="$password fi echo "Run post-mysqld-install" post-mysqld-install $mysqlPassword --tmpdir=${tmpDir} > ${tmpDir}/post-mysqld-install.log 2>&1 if [ $? -ne 0 ]; then echo "ERROR: post-mysqld-install failed: check ${tmpDir}/post-mysqld-install.log" exit 1 fi echo "Run post-mysql-install" post-mysql-install --tmpdir=${tmpDir} > ${tmpDir}/post-mysql-install.log 2>&1 if [ $? -ne 0 ]; then echo "ERROR: post-mysql-install failed: check ${tmpDir}/post-mysql-install.log" exit 1 fi fi if [ $user == "root" ]; then columnstoreSyslogSetup.sh check > ${tmpDir}/syslogSetup-check.log 2>&1 if [ $? -ne 0 ]; then # try setup again columnstoreSyslogSetup.sh install > ${tmpDir}/syslogSetup-install.log 2>&1 if [ $? -ne 0 ]; then echo "WARNING: columnstoreSyslogSetup.sh check failed: check ${tmpDir}/syslogSetup-check.log" exit 2 fi fi fi echo "!!!Module Installation Successfully Completed!!!" exit 0