【问题标题】:debconf-get-selections --installer output emptydebconf-get-selections --installer 输出为空
【发布时间】:2017-06-27 23:36:10
【问题描述】:

尝试为 postfix 无人值守安装收集预置条目。在 postfix 手动安装后,我使用如下 debconf-get-selections 但输出为零。知道这里出了什么问题吗?

root@pzi-ub-4:/var/tmp# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.10
Release:        16.10
Codename:       yakkety
root@pzi-ub-4:/var/tmp# debconf-get-selections --installer | grep postfix
root@pzi-ub-4:/var/tmp#

【问题讨论】:

    标签: ubuntu postfix


    【解决方案1】:

    虽然有动力让我的 Ubuntu kickstart 工作,但我找到了解决方案。 debconf-get-selection 的 --install 选项不起作用。您需要跳过它并仅使用裸 debconf-get-selection 来获取 debconf-set-selection 的列表。 在“apt install postfix”之后的全新安装中,我得到了这个列表:

    root@pzi-ub-1:~# debconf-get-selections | grep postfix
    postfix postfix/main_mailer_type        select  Internet with smarthost
    postfix postfix/recipient_delim string  +
    postfix postfix/relay_restrictions_warning      boolean
    postfix postfix/mydomain_warning        boolean
    postfix postfix/not_configured  error
    postfix postfix/retry_upgrade_warning   boolean
    postfix postfix/mailname        string  pzi-ub-1.foobar.com
    postfix postfix/chattr  boolean false
    postfix postfix/destinations    string  pzi-ub-1.foobar.com, $myhostname, pzi-ub-1, localhost.localdomain, localhost
    postfix postfix/relayhost       string  pzi-gw-1.foobar.com
    postfix postfix/procmail        boolean true
    postfix postfix/compat_conversion_warning       boolean true
    postfix postfix/mynetworks      string  127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
    postfix postfix/sqlite_warning  boolean
    postfix postfix/kernel_version_warning  boolean
    postfix postfix/tlsmgr_upgrade_warning  boolean
    postfix postfix/mailbox_limit   string  0
    postfix postfix/dynamicmaps_conversion_warning  boolean
    postfix postfix/rfc1035_violation       boolean false
    postfix postfix/protocols       select  all
    postfix postfix/main_cf_conversion_warning      boolean true
    postfix postfix/root_address    string
    postfix postfix/bad_recipient_delimiter error
    

    为了编译预种子列表,我修剪了没有值的选项(安装程序没有要求的选项)并创建了这个脚本,我从 kickstart 的 %post 部分调用:

    pzi@pzi-gw-1:~/Dropbox/notes/ks/post/ub$ cat mail
    set -x
    # x=mail; cd /var/tmp; wget http://gw/ks/post/ub/$x -O $x; sh ./$x
    #
    # ref: http://blog.delgurth.com/2009/01/19/pre-loading-debconf-values-for-easy-installation/
    
    d=`grep search /etc/resolv.conf | sed 's/search //'`
    hostname=`hostname`
    fqdn=$hostname.$d
    
    cat<<EOF | debconf-set-selections
    postfix postfix/main_mailer_type        select  Internet with smarthost
    postfix postfix/recipient_delim string  +
    postfix postfix/mailname        string  $fqdn
    postfix postfix/chattr  boolean false
    postfix postfix/destinations    string  $fqdn, \$myhostname, $hostname, localhost.localdomain, localhost
    postfix postfix/relayhost       string  mailhost.foobar.com
    postfix postfix/procmail        boolean true
    postfix postfix/compat_conversion_warning       boolean true
    postfix postfix/mynetworks      string  127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
    postfix postfix/mailbox_limit   string  0
    postfix postfix/rfc1035_violation       boolean false
    postfix postfix/protocols       select  all
    postfix postfix/main_cf_conversion_warning      boolean true
    postfix postfix/root_address    string
    EOF
    
    debconf-get-selections | grep postfix
    
    apt-get -qq -y install postfix
    

    这里是该邮件脚本的 kickstart 的 %post 部分:

    %post --interpreter=/bin/bash
    
    exec > /root/post.log 2>&1
    set -x
    scripts="
    autofs
    rootssh
    users
    sudo
    mail
    "
    for x in $scripts; do
    wget http://gw/ks/post/ub/$x -O $x; sh ./$x
    done
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-06-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-09
      • 1970-01-01
      • 2018-05-08
      • 2012-12-01
      相关资源
      最近更新 更多