回答提示使用vagrant文​​件? [英] Answering prompt using vagrant file?

查看:170
本文介绍了回答提示使用vagrant文​​件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以向适用于提示的Vagrantfile添加脚本。我正在为docker提供一个ubuntu框

Is it possible to add a script to a Vagrantfile that answers a prompt. I am provisioning a ubuntu box for docker

config.vm.box = "ubuntu"

config.vm.provision :shell, :inline => "sudo apt-get update"

config.vm.provision :shell, :inline => "sudo apt-get install linux-image-generic-lts-raring linux-headers-generic-lts-raring"

运行最后一个命令后,有一个提示要求

After running the last command, there is a prompt that asks

Do you want to continue [Y/n]?


推荐答案

更简单的解决方案是使用 -y 选项 apt-get

An easier solution would be to use the -y option of apt-get:

config.vm.provision :shell, :inline => "sudo apt-get -y install linux-image-generic-lts-raring linux-headers-generic-lts-raring"

请参阅手册


-y,--yes,--assume-yes自动提示。假设是作为所有提示的答案,并以非交互方式运行。如果发生不需要的
情况,例如更改持有的包或删除基本的
包,则apt-get将中止。

-y, --yes, --assume-yes Automatic yes to prompts. Assume "yes" as answer to all prompts and run non-interactively. If an undesirable situation, such as changing a held package or removing an essential package, occurs then apt-get will abort.

这篇关于回答提示使用vagrant文​​件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆