出现对话框时自动输入值(外壳)

  • 本文关键字:外壳 对话框 shell jitsi
  • 更新时间 :
  • 英文 :


我正在尝试编写一个脚本来自动安装jitsi-meet

在安装过程中,将显示一个对话框。我可以自动输入脚本中的字段值并模拟ENTER以便无需任何人工交互即可安装吗?

在对这个主题进行更多研究后,我发现没有简单的脚本可以编写来自动输入值。

我找到的唯一可能的解决方案是:

  1. Debconf [谢谢你,Mark Setchell] 如果应用程序支持它,您可以简单地使用 debconf 预先设置值。
  2. 将值作为参数传递。如果应用程序支持,您可以在 CLI 中将值作为参数传递。

特别是在 jitsi-meet 的情况下,您可以在 debconf 的帮助下设置值。Install debconf-utils: sudo apt install debconf-utils

然后,使用 debconf-get-selections | grep jitsi 查看已设置的值并更改值(或设置新值(:

echo "jitsi-videobridge jitsi-videobridge/jvb-hostname string my-domain" | debconf-set-selections
echo "jitsi-meet jitsi-meet/cert-choice select Self-signed certificate will be generated" | debconf-set-selections
Or
echo "jitsi-meet jitsi-meet/cert-path-crt string /etc/ssl/my-domain.crt" | debconf-set-selections
echo "jitsi-meet jitsi-meet/cert-choice select A certificate is available and the files are uploaded on the server" | debconf-set-selections
echo "jitsi-meet jitsi-meet/cert-path-key string /etc/ssl/my-domain.key" | debconf-set-selections

您可以使用 sudo DEBIAN_FRONTEND=noninteractive apt-get -y install jitsi-meet安装时避免交互式输入屏幕。:)

最新更新