因此,当我创建一个 debian 包时,我能够编写一个运行良好的安装后 shell 脚本。目前我的配置为
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
这适用于 Ubuntu。但是,我似乎无法让用户输入使用 Fedora 的 RPM。有没有接受用户输入的好方法?据我了解,RPM 旨在不允许交互式安装。但是我看不到更好的方法来做到这一点..
有没有办法在不询问用户的情况下自动查找本地 MySQL 设置?否则,询问用户输入的最佳方式是什么?