安装samba时跳过提示

Ati*_*ris 6 samba apt shell-script software-installation raspberry-pi

我想创建一个脚本来在我的树莓派上安装所有东西(重新安装后或在另一个 pi 上,但这通常是 linux 问题)。我将命令一个一个地写到我的脚本中,但是当我安装 samba 时sudo apt-get install samba -y,会出现以下问题并等待答案:

Samba server and utilities

If your computer gets IP address information from a DHCP server on the network,
the DHCP server may also provide information about WINS servers
("NetBIOS name servers") present on the network.
This requires a change to your smb.conf file so that DHCP-provided WINS settings
will automatically be read from /var/lib/samba/dhcp.conf.

The dhcp-client package must be installed to take advantage of this feature.
Modify smb.conf to use WINS settings from DHCP?

<Yes>   <No>
Run Code Online (Sandbox Code Playgroud)

我怎样才能跳过这个问题?我希望安装自动进行,但这个问题正在等待用户输入。在运行安装之前,是否还有其他参数可以避免此问题或设置答案?

Ati*_*ris 7

在这个线程中找到了 apt-get 的答案(对于 apt-get 不是一般的 samba 安装)。

debconf-set-selections命令帮助我在安装开始之前设置了答案。
如果要回答“是”,可以使用以下命令:

echo "samba-common samba-common/workgroup string  WORKGROUP" | sudo debconf-set-selections
echo "samba-common samba-common/dhcp boolean true" | sudo debconf-set-selections
echo "samba-common samba-common/do_debconf boolean true" | sudo debconf-set-selections
sudo apt-get install samba -y
Run Code Online (Sandbox Code Playgroud)