如何回答Travis-CI上的apt-get配置更改提示,在本例中为couchdb 1.5.0

Vic*_*ory 11 couchdb apt-get travis-ci

我正在尝试运行特定版本的couchdbon travis-ci我这样做是通过遵循官方的apt-get指示couchdb

部分安装是提示如何处理旧配置文件.请参阅以下内容:

  Installing new version of config file /etc/logrotate.d/couchdb ...
  Configuration file `/etc/couchdb/local.ini'
   ==> Deleted (by you or by a script) since installation.
   ==> Package distributor has shipped an updated version.
     What would you like to do about it ?  Your options are:
      Y or I  : install the package maintainer's version
      N or O  : keep your currently-installed version
        D     : show the differences between the versions
        Z     : start a shell to examine the situation
   The default action is to keep your current version.
  *** local.ini (Y/I/N/O/D/Z) [default=N] ? 
Run Code Online (Sandbox Code Playgroud)

这会导致travis-ci挂起并且构建失败.

这是travis-ci我尝试过和没有sudo rm和少数其他人.

 language: python

 php:
   - 2.7

 install: "pip install -r requirements.txt"

 before_install:
   - "export DISPLAY=:99.0"
   - "sh -e /etc/init.d/xvfb start"
   - sudo apt-get install python-software-properties -y
   - sudo add-apt-repository ppa:couchdb/stable -y
   - sudo apt-get update -yq
   - sudo apt-get remove couchdb couchdb-bin couchdb-common -yf
   - sudo rm /etc/couchdb/local.ini
   - sudo apt-get install -Vy couchdb
   - sudo service couchdb start

 before_script:
   - curl -X PUT localhost:5984/njb_tests

 script: python run-tests.py
Run Code Online (Sandbox Code Playgroud)

您可以通过查看我的提交历史记录来查看我尝试的不同内容:

https://github.com/Victory/notice-javascript-bugs/commits/master/.travis.yml

fra*_*eed 14

你好我的Frind非常容易我相信这个命令可以解决问题

100%的工作方式没有借口没有任何怜悯!

sudo DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confnew" install couchdb
Run Code Online (Sandbox Code Playgroud)

更软的方式工作

export DEBIAN_FRONTEND=noninteractive
apt-get -o Dpkg::Options::="--force-confnew" install -y 
Run Code Online (Sandbox Code Playgroud)

正确的方式

在shell或代码中

export DEBIAN_FRONTEND=noninteractive
Run Code Online (Sandbox Code Playgroud)

然后

sudo apt-get -q -y install couchdb
Run Code Online (Sandbox Code Playgroud)

对所有事情都假设"是"(并且安静地做)

你需要注意Debconf是该工具的名称.该页面应该可以帮助您了解您想知道的一切.debconf手册页

期望脚本方法

你会被要求提供软件包维护者或你应该在apt-get上设置的密码这里是一个简单的例子,来自要求在apt-get install上设置密码的服务器

To keep your existing password, leave this blank.

Password for SYSDBA: 
Run Code Online (Sandbox Code Playgroud)

然后你用下面这个脚本运行它来做输入

#!/usr/bin/expect

spawn dpkg-reconfigure firebird2.5-superclassic -freadline
expect "Enable Firebird server?"
send "Y\r"

expect "Password for SYSDBA:"
send "newpwd\r"

# done
expect eof
Run Code Online (Sandbox Code Playgroud)

您的案例的工作示例是

- /usr/bin/expect 'spawn sudo apt-get install -Vy couchdb \n expect "*** local.ini (Y/I/N/O/D/Z) [default=N] ?" \n send "Y\r"
Run Code Online (Sandbox Code Playgroud)