使用Chef安装Debian软件包的惯用方式是什么? [英] What is the idiomatic way to install a Debian package using Chef?
本文介绍了使用Chef安装Debian软件包的惯用方式是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面是我安装vcider的代码。我正在学习厨师,但是没有安装dpkg的任何东西。我想在脚本中使用版本。下面的代码有效。
Below my code for installing vcider. I am learning chef but have not seen anything for installing a dpkg. I would like to use version in the script. The code below works.
script "install_vcider" do
interpreter "bash"
user "root"
cwd "/tmp"
code <<-EOH
wget https://my.vcider.com/m/downloads/vcider_2.0.1b_amd64.deb
dpkg -i vcider__amd64.deb
EOH
end
即使使用上面的代码,我也可以替换2.0.1b #{version}?
属性文件->默认值[:vcider] [:version] 2.0.1b
Even with the code above can I replace 2.0.1b with #{version}? attribute file -> default[:vcider][:version] 2.0.1b
recipe file - > version = node[:vcider][:version]
推荐答案
正确的事情是使用内置的资源类型。假设您已正确设置版本
和 arch
变量:
The Right Thing is to use the built-in resource types. Presuming you've set the version
and arch
variables appropriately:
remote_file "/tmp/vcider_#{version}_#{arch}.deb" do
source "https://my.vcider.com/m/downloads/vcider_#{version}_#{arch}.deb"
mode 0644
checksum "" # PUT THE SHA256 CHECKSUM HERE
end
dpkg_package "vcider" do
source "/tmp/vcider_#{version}_#{arch}.deb"
action :install
end
这篇关于使用Chef安装Debian软件包的惯用方式是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文