出现对话时自动输入值(Shell)

Automatically entering value when Dialogue Appears (Shell)

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

在安装过程中,会出现一个dialog。 我可以从脚本中自动输入字段的值并模拟 ENTER 以便我可以在没有任何人工交互的情况下安装吗?

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

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

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

具体在jitsi-meet的情况下,可以借助debconf设置值。 安装 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 在安装时避免交互式输入屏幕。 :)