Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to extract ISO file URL from a remote file #1020

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 33 additions & 21 deletions lib/veewee/provider/core/helper/iso.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,23 +116,10 @@ def verify_iso(options)
ui.info ""
ui.info "The isofile #{filename} already exists."
else
ui.info ""
ui.info "We did not find an isofile here : #{full_path}. \n\nThe definition provided the following download information:"
unless "#{self.iso_src}"==""
ui.info "- Download url: #{self.iso_src}"
end
ui.info "- Md5 Checksum: #{self.iso_md5}" if self.iso_md5
ui.info "- Sha1 Checksum: #{self.iso_sha1}" if self.iso_sha1
ui.info "- Sha256 Checksum: #{self.iso_sha256}" if self.iso_sha256
ui.info "#{self.iso_download_instructions}"
ui.info ""
info_source_and_checksums

if self.iso_src == ""
ui.info "Please follow the instructions above:"
ui.info "- to get the ISO"
ui.info" - put it in <currentdir>/iso"
ui.info "- then re-run the command"
ui.info ""
info_no_source
raise Veewee::Error, "No ISO src is available, can't download it automatically"
else
answer=nil
Expand All @@ -151,12 +138,7 @@ def verify_iso(options)
raise Veewee::Error, "There was an error downloading #{self.iso_src}:\n#{ex}"
end
else
ui.info "You have selected manual download: "
ui.info "curl -C - -L '#{self.iso_src}' -o '#{full_path}'"
ui.info "md5 '#{full_path}' " if self.iso_md5
ui.info "shasum '#{full_path}' " if self.iso_sha1
ui.info "shasum -a 256 '#{rel_path}' " if self.iso_sha256
ui.info ""
info_manual_download
exit
end

Expand All @@ -171,8 +153,38 @@ def verify_iso(options)
verify_sum(full_path,:md5) if options["checksum"] && !self.iso_md5.nil?
verify_sum(full_path,:sha1) if options["checksum"] && !self.iso_sha1.nil?
verify_sum(full_path,:sha256) if options["checksum"] && !self.iso_sha256.nil?
end

def info_source_and_checksums
ui.info ""
ui.info "We did not find an isofile here : #{full_path}. \n\nThe definition provided the following download information:"
unless "#{self.iso_src}"==""
ui.info "- Download url: #{self.iso_src}"
end
ui.info "- Md5 Checksum: #{self.iso_md5}" if self.iso_md5
ui.info "- Sha1 Checksum: #{self.iso_sha1}" if self.iso_sha1
ui.info "- Sha256 Checksum: #{self.iso_sha256}" if self.iso_sha256
ui.info "#{self.iso_download_instructions}"
ui.info ""
end

def info_no_source
ui.info "Please follow the instructions above:"
ui.info "- to get the ISO"
ui.info" - put it in <currentdir>/iso"
ui.info "- then re-run the command"
ui.info ""
end

def info_manual_download
ui.info "You have selected manual download: "
ui.info "curl -C - -L '#{self.iso_src}' -o '#{full_path}'"
ui.info "md5 '#{full_path}' " if self.iso_md5
ui.info "shasum '#{full_path}' " if self.iso_sha1
ui.info "shasum -a 256 '#{rel_path}' " if self.iso_sha256
ui.info ""
end

end #Module

end #Module
Expand Down