Skip to content

Commit

Permalink
Merge pull request #99 from st-h/MD5-support
Browse files Browse the repository at this point in the history
support for MD5 checksum
  • Loading branch information
carmstrong committed Dec 19, 2013
2 parents 069c4ad + b98851b commit e43e80d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions providers/ark.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,13 @@ def parse_app_dir_name url
def oracle_downloaded?(download_path, new_resource)
if ::File.exists? download_path
require 'digest'
downloaded_sha = Digest::SHA256.file(download_path).hexdigest
downloaded_sha == new_resource.checksum
if new_resource.checksum =~ /^[0-9a-f]{32}$/
downloaded_sha = Digest::MD5.file(download_path).hexdigest
downloaded_sha == new_resource.md5
else
downloaded_sha = Digest::SHA256.file(download_path).hexdigest
downloaded_sha == new_resource.checksum
end
else
return false
end
Expand Down
2 changes: 1 addition & 1 deletion resources/ark.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

attribute :url, :regex => /^(file|https?):\/\/.*(tar.gz|tgz|bin|zip)$/, :default => nil
attribute :mirrorlist, :kind_of => Array, :default => nil
attribute :checksum, :regex => /^[a-zA-Z0-9]{40,64}$/, :default => nil
attribute :checksum, :regex => /^[0-9a-f]{32}$|^[a-zA-Z0-9]{40,64}$/, :default => nil
attribute :app_home, :kind_of => String, :default => nil
attribute :app_home_mode, :kind_of => Integer, :default => 0755
attribute :bin_cmds, :kind_of => Array, :default => nil
Expand Down

0 comments on commit e43e80d

Please sign in to comment.