Permalink
Browse files

debian: Add gpg support to debian_aptline definition

  • Loading branch information...
1 parent c1dd788 commit 55631803f278139d1a7c0defb9f5e3953062db81 @nabeken committed Apr 12, 2012
Showing with 19 additions and 1 deletion.
  1. +19 −1 debian/definitions/default.rb
@@ -1,4 +1,22 @@
-define :debian_aptline, :url => nil, :path => nil, :repo => nil, :release => nil do
+define :debian_aptline, :url => nil,
+ :path => nil,
+ :repo => nil,
+ :release => nil,
+ :gpg_key_id => nil,
+ :gpg_key_url => nil do
+ # registering gpg key
+ if !params[:gpg_key_id].nil? && !params[:gpg_key_url].nil?
+ bash "debian-apt-key-add" do
+ code <<-EOC
+wget -O- #{params[:gpg_key_url]} | apt-key add -
+EOC
+ only_if do
+ `apt-key list | grep #{params[:gpg_key_id]} | wc -l`.strip == "0"
+ end
+ notifies :run, "execute[apt-get-update]", :immediately
+ end
+ end
+
t = nil
file = "sources.list.d/#{params[:name]}.list"

0 comments on commit 5563180

Please sign in to comment.