So when I create a debian package, I am able to write a post-installation shell script that runs just fine. Currently mine is configured to do
echo "Please enter your MySQL Database user (default root)"
read MYSQL_USER
echo "Please enter the MySQL Database user password (default root)"
read -s MYSQL_PASS
DBEXIST=0
CMD="create database lportal;use lportal;"
(mysql -u$MYSQL_USER -p$MYSQL_PASS -e "$CMD") || ((DBEXIST++))
if [ $DBEXIST -ne 0 ]; then
echo "Setup finished, but MySQL already has an lportal table. This could be from a previous installation of Liferay. If you want a fresh installation of this bundle, please remove the lportal table and reinstall this package."
fi
This works fine for Ubuntu. However, I can't seem to get user input to work with RPMs for Fedora. Is there a good way to take user input? From what I understand, RPMs were designed not to allow interactive installs. However I can't see a better way to do this..
Is there possibly a way to automatically find local MySQL settings without asking the user? Otherwise, what's the best way to ask for user input?