Shell-Script
安裝 samba 時跳過提示
我想創建一個腳本來在我的樹莓派上安裝所有東西(重新安裝後或在另一個 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>
**我怎樣才能跳過這個問題?**我希望安裝自動進行,但這個問題正在等待使用者輸入。在執行安裝之前是否有任何其他參數可以避免這個問題或設置答案?
我在這個執行緒中找到了 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