LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File jasper_init_db of Package jasperreports (Project home:snagview)

#!/bin/sh

jasperhome="/srv/tomcat6/webapps/jasperserver"

echo "Please enter mysql user"
read input_variable
dbuser=$input_variable

echo "Please enter mysql password"
read input_variable
dbpass=$input_variable

mysql -u root -psector jasperserver -e exit &>/dev/null
if [ $? -eq 0 ]; then
	echo "Database jasperserver already exists!"
	answer="not given yet"
	while [ "$answer" != "i know this will delete all data" ]; do
		echo "Type 'i know this will delete all data' to continue"
		read input_variable
		answer=$input_variable
	done
	echo "dropping old jasperserver database and creating a new one"
	mysql -u ${dbuser} -p${dbpass} < $jasperhome/scripts/jasperserver.sql
else
	echo "creating jasperserver database"	
	mysql -u ${dbuser} -p${dbpass} < $jasperhome/scripts/jasperserver.sql
fi