You've already forked mariadb-columnstore-engine
							
							
				mirror of
				https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
				synced 2025-11-03 17:13:17 +03:00 
			
		
		
		
	
		
			
				
	
	
		
			125 lines
		
	
	
		
			3.5 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			125 lines
		
	
	
		
			3.5 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/bin/bash
 | 
						|
#
 | 
						|
# $Id: post-mysql-install 3661 2013-06-25 22:04:33Z dhill $
 | 
						|
#
 | 
						|
# Post-install steps for calpont-mysql install
 | 
						|
 | 
						|
# check log for error
 | 
						|
checkForError() {
 | 
						|
	# check for password error
 | 
						|
	grep "ERROR 1045" /tmp/mysql_install.log > /tmp/error.check
 | 
						|
	if [ `cat /tmp/error.check | wc -c` -ne 0 ]; then
 | 
						|
		password=`$installdir/bin/getMySQLpw`
 | 
						|
		if [ $? -ne 0 ]; then
 | 
						|
			echo "MySQL Password missing or incorrect"
 | 
						|
			rm -f /tmp/error.check
 | 
						|
			$installdir/mysql/mysql-Columnstore stop
 | 
						|
			sleep 2
 | 
						|
			exit 2;
 | 
						|
		fi
 | 
						|
		rm -f /tmp/error.check
 | 
						|
		return 1;
 | 
						|
	fi
 | 
						|
 | 
						|
	rm -f /tmp/error.check
 | 
						|
 | 
						|
        #---------------------------------------------------------------------------
 | 
						|
        # See if engine infinidb exist
 | 
						|
        #---------------------------------------------------------------------------
 | 
						|
        echo "checking for engine infinidb..."
 | 
						|
        $installdir/mysql/bin/mysql \
 | 
						|
                --defaults-file=$installdir/mysql/my.cnf \
 | 
						|
                --user=root $pwprompt \
 | 
						|
                --execute='show engines;' \
 | 
						|
                calpontsys | grep -i infinidb
 | 
						|
 | 
						|
        #
 | 
						|
        # Add compressiontype column to SYSCOLUMN if applicable
 | 
						|
        #
 | 
						|
        if [ $? -ne 0 ]; then
 | 
						|
                echo "infinidb doesn't exist"
 | 
						|
                return 1
 | 
						|
        fi
 | 
						|
 | 
						|
        echo "infinidb exist"
 | 
						|
 | 
						|
	return 0;
 | 
						|
}
 | 
						|
 | 
						|
prefix=/usr/local
 | 
						|
installdir=$prefix/MariaDB/Columnstore
 | 
						|
rpmmode=install
 | 
						|
password=
 | 
						|
 | 
						|
for arg in "$@"; do
 | 
						|
	if [ $(expr -- "$arg" : '--prefix=') -eq 9 ]; then
 | 
						|
		prefix="$(echo $arg | awk -F= '{print $2}')"
 | 
						|
		installdir=$prefix/MariaDB/Columnstore
 | 
						|
	elif [ $(expr -- "$arg" : '--rpmmode=') -eq 10 ]; then
 | 
						|
		rpmmode="$(echo $arg | awk -F= '{print $2}')"
 | 
						|
	elif [ $(expr -- "$arg" : '--password=') -eq 11 ]; then
 | 
						|
		password="$(echo $arg | awk -F= '{print $2}')"
 | 
						|
	elif [ $(expr -- "$arg" : '--installdir=') -eq 13 ]; then
 | 
						|
		installdir="$(echo $arg | awk -F= '{print $2}')"
 | 
						|
		prefix=$(dirname $installdir)
 | 
						|
	else
 | 
						|
		echo "ignoring unknown argument: $arg" 1>&2
 | 
						|
	fi
 | 
						|
done
 | 
						|
 | 
						|
if [ $installdir != "/usr/local/MariaDB/Columnstore" ]; then
 | 
						|
	export INFINIDB_INSTALL_DIR=$installdir
 | 
						|
	export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$INFINIDB_INSTALL_DIR/lib:$INFINIDB_INSTALL_DIR/mysql/lib/mysql
 | 
						|
fi
 | 
						|
 | 
						|
if [ -f $installdir/lib/libcalmysql.so.1.0.0 ]; then
 | 
						|
	libcalmysql=$installdir/lib/libcalmysql.so.1.0.0
 | 
						|
	libudfsdk=$installdir/lib/libudf_mysql.so.1.0.0
 | 
						|
elif [ -f $installdir/lib/libcalmysql.so.1 ]; then
 | 
						|
	libcalmysql=$installdir/lib/libcalmysql.so.1
 | 
						|
	libudfsdk=$installdir/lib/libudf_mysql.so.1
 | 
						|
else
 | 
						|
	libcalmysql=
 | 
						|
fi
 | 
						|
 | 
						|
if [ -d $installdir/mysql/lib64/mysql/plugin -a -n "$libcalmysql" ]; then
 | 
						|
	cd $installdir/mysql/lib64/mysql/plugin
 | 
						|
	ln -sf $libcalmysql libcalmysql.so
 | 
						|
        ln -sf $libcalmysql libcalmysqlent.so
 | 
						|
	ln -sf $libudfsdk libudf_mysql.so
 | 
						|
fi
 | 
						|
 | 
						|
if [ $installdir != "/usr/local/MariaDB/Columnstore" ]; then
 | 
						|
	sed -i -e s@/usr/local/MariaDB/Columnstore@$installdir@g $installdir/mysql/my.cnf
 | 
						|
fi
 | 
						|
 | 
						|
if [ -x $installdir/mysql/mysql-Columnstore ]; then
 | 
						|
 | 
						|
	# Restart in the same way that mysqld will be started normally.
 | 
						|
	$installdir/mysql/mysql-Columnstore stop >/dev/null 2>&1
 | 
						|
	sleep 2
 | 
						|
	$installdir/mysql/mysql-Columnstore start
 | 
						|
 | 
						|
	sleep 5
 | 
						|
 | 
						|
	# Install various Calpont stuff...
 | 
						|
	$installdir/mysql/install_calpont_mysql.sh --password=$password --installdir=$installdir
 | 
						|
	checkForError
 | 
						|
	if [ $? -ne 0 ]; then
 | 
						|
	# retry
 | 
						|
		$installdir/mysql/install_calpont_mysql.sh --password=$password --installdir=$installdir
 | 
						|
		checkForError
 | 
						|
		if [ $? -ne 0 ]; then
 | 
						|
			echo "ERROR: missing or invalid password, or InfiniDB plugin install missing"
 | 
						|
			$installdir/mysql/mysql-Columnstore stop
 | 
						|
			sleep 2
 | 
						|
			exit 1;
 | 
						|
		fi
 | 
						|
	fi
 | 
						|
 | 
						|
	$installdir/mysql/mysql-Columnstore stop
 | 
						|
fi
 | 
						|
 | 
						|
exit 0
 | 
						|
 |