安装 samba 时跳过提示

安装 samba 时跳过提示

我想创建一个脚本来安装所有内容在我的树莓派上(重新安装后或在另一个树莓派上,但这通常是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>

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

答案1

我找到了答案(对于 apt-get 通常不适用于 samba 安装)在这个线程中 apt-get

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

相关内容