class PackerFiles::Debian::CD

Public Instance Methods

get_check_sum_pattern() click to toggle source

Override method for getting checksums

# File lib/PackerFiles/OS/Debian/CD.rb, line 22
def get_check_sum_pattern
   'MD5SUMS'
end
get_check_sum_type() click to toggle source

Override method for checksum type

# File lib/PackerFiles/OS/Debian/CD.rb, line 27
def get_check_sum_type
   'md5'
end
get_iso_name_pattern() click to toggle source

Override method for getting the ISO name

# File lib/PackerFiles/OS/Debian/CD.rb, line 17
def get_iso_name_pattern
   'debian-@release@-@arch@-CD-1.iso'
end
index_urls() click to toggle source

Override method for getting index URLs.

# File lib/PackerFiles/OS/Debian/CD.rb, line 32
def index_urls
   master_index_urls + mirror_index_urls
end

Private Instance Methods

master_index_urls() click to toggle source

The Index URLs from the main debian CD Image server.

# File lib/PackerFiles/OS/Debian/CD.rb, line 38
def master_index_urls
%w[
  http://cdimage.debian.org/debian-cd/@release@/@arch@/iso-cd/
  http://cdimage.debian.org/mirror/cdimage/archive/@release@/@arch@/iso-cd/
]
end
mirror_index_urls() click to toggle source

The Index URLs from other debian CD mirrors. The CD Mirrors only support CD images and not DVD Images.

# File lib/PackerFiles/OS/Debian/CD.rb, line 48
def mirror_index_urls
   
   # Use nokogiri to parse the index page, to get all the URLs that contain
   # country name [as detected by AutoZone]. Unfortunately this code can only
   # be understood if HTML structure is visually inspected first. In short,
   # debian mirrors for all the countries in the index file, looks like
   # <li> "Country" <a rel="nofollow" href="http://debian.xfree.com.ar/debian-cd/"> </li>
   page    = Nokogiri::HTML(open(@@index))
   country = Utils::AutoZone.new.JSON['country']
   nodes   = page.css('li').select {|node| node.text.include?(country)}
   arefs   = nodes.map {|node| node.css('a')}.flatten
   mirrors = arefs.map {|aref| aref.attribute('href').value}
   mirrors.map! {|m| URI::join(m, '@release@/@arch@/iso-cd/').to_s}
end