class DockerTools::Debootstrap

Attributes

archive[RW]

Public Class Methods

new(name, distro, tmpdir='/tmp') click to toggle source
# File lib/docker_tools/debootstrap.rb, line 5
def initialize(name, distro, tmpdir='/tmp')
  @name = name
  @distro = distro
  @tmpdir = tmpdir
  @archive = "#{@tmpdir}/#{@name}.tar"
end

Public Instance Methods

cleanup() click to toggle source
# File lib/docker_tools/debootstrap.rb, line 21
def cleanup
  `rm -rf #{@tmpdir}/#{@name}*`
end
run() click to toggle source
# File lib/docker_tools/debootstrap.rb, line 12
def run
  output = `debootstrap --download-only #{@distro} #{@tmpdir}/#{@name}`
  unless $?.to_i == 0
    puts output
    throw "Could not run debootstrap"
  end
  `cd #{@tmpdir}/#{@name} && tar -cvf ../#{@name}.tar .`
end