A Ruby understanding of APT repositories. Builds custom install disks!
Ruby
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
data/captain
features
lib
test
.gitignore
CHANGELOG.rdoc
Gemfile
Gemfile.lock
README.rdoc
Rakefile
TODO.rdoc
captain.gemspec
cucumber.yml

README.rdoc

Captain

Captain provides Ruby-based understading of APT repositories, so that you can do interesting things with them, even from non-Linux platforms.

For example, captain includes a Rake task to build an Ubuntu installation CD just as you like it. This Rake task gathers packages from any number of repositories, preseeds almost all of the installer questions, and runs on any platform with mkisofs (including OSX).

Behold

With the following Rakefile:

require 'captain'
Captain::Rake::ISO.new

Captain builds an i386 Lucid CD:

$ rake captain
...
$ ls
ubuntu-10.04-captain-i386.iso
$

Install

Captain uses mkisofs to burn the final image.

On OSX, you can get this with

$ brew install dvdrtools

or

$ port install dvdrtools

And then you're good to go:

$ gem install captain

Configure

An instance of Captain::Configuration is yielded to the rake task definition:

Captain::Rake::ISO.new do |task|
  task.architecture = 'amd64'

  task.repositories = [
    'http://us.archive.ubuntu.com/ubuntu karmic main universe',
    'http://apt.opscode.com/ubuntu karmic universe'
  ]

  task.include_packages = [
    'chef',
    'git-core',
    'ruby-full'
  ]

  task.install_packages = [
    'openssh-server'
  ]
end

There are a couple of things you'll need to be careful with, for now:

repositories

By convention, the installation system and udeb packages will be pulled from the first repository in the list. So you'll want to make sure the first repository is a full-fledged Ubuntu repository.

version

Could be determined automatically from, say, the Release file in the first repository. But it isn't yet, so beware of the duplication.

See hcts/bootstrap for an example project.

Preseeding

See preseed.seed.erb. There may be a couple of controversial decisions in there that could use some configuring: there's just one monolithic disk partition, and no http mirrors included in /etc/apt/sources.list.

Other than the disk partitioning, I suppose most of these things could be handled post-install, though I'm glad to accept patches / suggestions adding the configuration options you need.

Alternatively, you may supply your own preseeding template. Just drop it in config/captain/templates/preseed.seed.erb. The template will be evaluated in the context of a Captain::Configuration.

Network Cache

Captain caches everything it downloads from the network in $HOME/.captain.

VMware

A second rake task, Captain::Rake::VMware, is provided to help you play around with your ISO image:

require 'captain'

Captain::Rake::ISO.new do |task|
  # your configuration here...

  Captain::Rake::VMware.new do |vm|
    vm.iso_image = task.iso_image_path
  end
end

This will give you rake vmware, which will create vm.vmware in the current directory. You can then open vm.vmwarevm to launch the virtual machine.

Note this rake task assumes vmware-vdiskmanager is on your PATH. On OSX with VMware Fusion, the proper directory is /Library/Application Support/VMware Fusion.