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

时间:2014-04-09 09:14:50

标签: couchdb travis-ci apt-get

我正在尝试在couchdb上运行特定版本的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] ? 

这会导致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

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

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

1 个答案:

答案 0 :(得分:12)

你好我的Frind很容易 我相信这个命令会起作用

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

sudo DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confnew" install couchdb

软弱的工作方式

export DEBIAN_FRONTEND=noninteractive
apt-get -o Dpkg::Options::="--force-confnew" install -y 

正确的方式

在shell或代码中执行

export DEBIAN_FRONTEND=noninteractive

然后

sudo apt-get -q -y install couchdb

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

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

期望脚本方法

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

To keep your existing password, leave this blank.

Password for SYSDBA: 

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

#!/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

您案例的工作示例是

- /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"