fad*_*bee 31 apt keyboard-layout debootstrap chroot
我正在编写一个脚本,使用 debootstrap(在 Ubuntu 16.04 服务器机器上)将 Ubuntu 16.04 服务器安装到 chroot jail 中。
在设置keyboard-configuration包的过程中,它会询问键盘类型:
Setting up keyboard-configuration (1.108ubuntu15) ...
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
Configuring keyboard-configuration
----------------------------------
The layout of keyboards varies per country, with some countries having multiple
common layouts. Please select the country of origin for the keyboard of this
computer.
1. Afghani 48. Irish
2. Albanian 49. Italian
...
28. English (UK) 75. Slovak
29. English (US) 76. Slovenian
...
45. Icelandic 92. Vietnamese
46. Indian 93. Wolof
47. Iraqi
Country of origin for the keyboard:
Run Code Online (Sandbox Code Playgroud)
我想自动执行此操作,以便它不会询问,然后继续安装。
我怎样才能做到这一点?
小智 35
来自一个类似的StackOverflow 问题:
如果在DEBIAN_FRONTEND=noninteractive运行时设置了 ENV 变量apt-get install keyboard-configuration,则不会提示任何交互。所以你可以简单地运行:
DEBIAN_FRONTEND=noninteractive apt-get install keyboard-configuration
Run Code Online (Sandbox Code Playgroud)
小智 5
这很容易实现自动化,您只需为此包设置正确的 debconf 配置即可。
首次安装debconf-utils:
sudo apt install debconf-utils
Run Code Online (Sandbox Code Playgroud)
如果您已经配置了该包,则可以使用以下命令读取 debconf 配置:
debconf-get-selections | grep keyboard-configuration
Run Code Online (Sandbox Code Playgroud)
如果您尚未配置该包或想要更改您的选择,您可以通过以下方式执行此操作:
dpkg-reconfigure keyboard-configuration
Run Code Online (Sandbox Code Playgroud)
将您的选择导出到文件
debconf-get-selections | grep keyboard-configuration > selections.conf
Run Code Online (Sandbox Code Playgroud)
复制selections.conf到目标机器并设置选择:
debconf-set-selections < selections.conf
Run Code Online (Sandbox Code Playgroud)
当您安装或重新配置软件包时,现在将自动选择您的选择。
dpkg-reconfigure keyboard-configuration -f noninteractive
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
17707 次 |
| 最近记录: |