Skip to content

Instantly share code, notes, and snippets.

@matthewtodd
Created March 27, 2009 16:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthewtodd/86771 to your computer and use it in GitHub Desktop.
Save matthewtodd/86771 to your computer and use it in GitHub Desktop.
#### Contents of the preconfiguration file (for &releasename;)
### Localization
d-i debian-installer/locale string en_US
d-i console-setup/ask_detect boolean false
d-i console-setup/layoutcode string us
### Network configuration
d-i netcfg/choose_interface select auto
d-i netcfg/get_hostname string ubuntu
d-i netcfg/get_domain string
### Mirror settings
d-i mirror/country string manual
d-i mirror/http/hostname string 10.0.1.3:4001
d-i mirror/http/directory string /ubuntu
d-i mirror/http/proxy string
### Clock and time zone setup
d-i clock-setup/utc boolean true
d-i time/zone string Africa/Dar_es_Salaam
d-i clock-setup/ntp boolean false
### Partitioning
d-i partman-auto/init_automatically_partition select biggest_free
d-i partman-auto/method string regular
d-i partman-auto/choose_recipe select atomic
d-i partman/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
### Base system installation
### Account setup
d-i passwd/user-fullname string Developer
d-i passwd/username string developer
d-i passwd/user-password password secret
d-i passwd/user-password-again password secret
### Apt setup
d-i apt-setup/restricted boolean true
d-i apt-setup/universe boolean true
d-i apt-setup/backports boolean false
d-i apt-setup/use_mirror boolean false
d-i apt-setup/services-select multiselect security
d-i apt-setup/security_host string 10.0.1.3:4001
d-i apt-setup/security_path string /ubuntu
### Package selection
tasksel tasksel/first multiselect standard
d-i pkgsel/include string openssh-server
d-i pkgsel/update-policy select none
### Boot loader installation
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
### Finishing up the installation
d-i finish-install/reboot_in_progress note
# d-i debian-installer/exit/halt boolean true
### X configuration
### Preseeding other packages
user-setup-udeb user-setup/encrypted-private boolean false
#### Advanced options
### Running custom commands during the installation
menu hshift 13
menu width 49
menu margin 8
menu title Installer boot menu
default install
label install
menu label ^Install
kernel ubuntu-installer/i386/linux
append vga=normal initrd=ubuntu-installer/i386/initrd.gz auto url=http://10.0.1.3:4000/preseed.cfg locale=en_US console-setup/ask_detect=false console-setup/layoutcode=us netcfg/choose_interface=eth0 hostname=ubuntu -- quiet
prompt 0
timeout 0
QEMU_IMG = '/Applications/Q.app/Contents/MacOS/qemu-img'
QEMU = '/Applications/Q.app/Contents/MacOS/i386-softmmu.app/Contents/MacOS/i386-softmmu'
directory 'tmp'
file '/tmp/ubuntu-cdrom' do
sh 'hdiutil attach vendor/ubuntu-8.10-server-i386.iso -mountpoint /tmp/ubuntu-cdrom'
end
file 'tmp/netboot' => ['config/preseed.cfg', 'config/pxelinux.cfg', 'tmp', '/tmp/ubuntu-cdrom'] do
sh 'cp -r /tmp/ubuntu-cdrom/install/netboot tmp/'
sh 'chmod -R u+w tmp/netboot'
sh 'cp config/preseed.cfg tmp/netboot/'
sh 'cp config/pxelinux.cfg tmp/netboot/pxelinux.cfg/default'
end
directory 'vm'
def webrick(directory, port)
require 'webrick'
server = WEBrick::HTTPServer.new(:Port => port, :DocumentRoot => directory)
thread = Thread.new { server.start }
trap('INT') { server.shutdown }
end
file 'vm/base.img' => ['tmp/netboot', '/tmp/ubuntu-cdrom', 'vm'] do
webrick('config', 4000)
webrick('/tmp/ubuntu-cdrom', 4001)
sh "#{QEMU_IMG} create -f qcow2 vm/base.img 1G"
sh "#{QEMU} -m 256M -boot n -tftp tmp/netboot -bootp /pxelinux.0 -no-reboot vm/base.img "
end
file 'vm/system.img' do
sh 'cp vm/base.img vm/system.img'
end
# NOTE we can boot this without graphics and ssh into it!
task :boot => 'vm/system.img' do
sh "#{QEMU} -m 256M vm/system.img -redir tcp:2222::22"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment