【问题标题】:How to take user input during install如何在安装过程中获取用户输入
【发布时间】:2011-03-03 17:43:42
【问题描述】:

所以当我创建一个 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 设置?否则,询问用户输入的最佳方式是什么?

【问题讨论】:

  • 在 Debian 中,你应该使用 debconf 来配置你的包。
  • 感谢 el.pescado,我目前正在阅读 debconf-devel 的手册页。我意识到我为 ubuntu 做的有点不对,哈哈。那么,Fedora 有没有等价物?

标签: linux bash rpm rpmbuild


【解决方案1】:

好的,我在没有真正答案的情况下解决了这个问题——基本上据我所知,我有两个选择——一个是 Bind 或 CUPS 使用的包装脚本。虽然这不是很好的包装实践,但我仍然不确定如何去做。更好的方法是在 %POST 脚本中分配默认值,并创建一个 firstrun 标志。用户第一次启动软件时,会提示进行配置设置。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-06
    • 2022-07-06
    • 2010-11-10
    相关资源
    最近更新 更多