如何为aptitude或apt-get提供dpkg配置参数?


8

安装gitolite时,我发现:

# aptitude install gitolite
The following NEW packages will be installed:
  gitolite 
0 packages upgraded, 1 newly installed, 0 to remove and 29 not upgraded.
Need to get 114 kB of archives. After unpacking 348 kB will be used.
Get:1 http://security.debian.org/ squeeze/updates/main gitolite all 1.5.4-2+squeeze1 [114 kB]
Fetched 114 kB in 0s (202 kB/s)
Preconfiguring packages ...
Selecting previously deselected package gitolite.
(Reading database ... 30593 files and directories currently installed.)
Unpacking gitolite (from .../gitolite_1.5.4-2+squeeze1_all.deb) ...
Setting up gitolite (1.5.4-2+squeeze1) ...
No adminkey given - not initializing gitolite in /var/lib/gitolite.

最后一行是我感兴趣的。如果运行,dpkg-reconfigure -plow gitolite将显示一个对话框,可以修改:

  • gitolite的系统用户名,
  • 凹凸棒石储存库的位置和
  • 提供管理员pubkey。

我更喜欢使用git系统用户并在安装时提供admin pubkey,例如:

# aptitude install gitolite --user git --admin-pubkey 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDAc7kCAi2WkvqpAL1fK1sIw6xjpatJ+Ms2nrwLJPhdovEY3MPZF7mtH+rv1CHFDn66fLGiWevOFp...'

那当然是行不通的。可以做类似的事情吗?如何提前确定配置参数?例如,当通过木偶或厨师自动安装gitolite时,这将非常有用。

Answers:


14

我尚未对此进行测试,但是我相信dpkg-reconfigure在示例计算机上运行之后,您可以运行debconf-get-selections | egrep "^gitolite\s"以获取设置的内容。(debconf-utils如果没有,则在包装中)。

然后在CLI上debconf-set-selections $FILENAME运行apt之前。

然后,使用木偶将是这样的:

file {
  "/var/cache/debconf/gitolite.preseed":
     source => '...'; # someplace with that output
}
package {
  "gitolite":
    require      => File["/var/cache/debconf/gitolite.preseed"],
    responsefile => "/var/cache/debconf/gitolite.preseed";
}

在puppet网站上的更多信息:

我怀疑Chef具有类似的机制来指定响应文件或预置文件或类似的文件,但我不是Chef用户。


By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.