├── sudoers ├── .gitignore ├── clean-iso ├── clean-vagrant ├── vagrant.pub ├── late_command.sh.m4 ├── isolinux.cfg ├── clean-vbox ├── config.sh ├── vagrant ├── README.md ├── unattended.seed.m4 └── Makefile /sudoers: -------------------------------------------------------------------------------- 1 | Defaults !env_reset 2 | Defaults !secure_path 3 | 4 | ALL ALL=(ALL) NOPASSWD: ALL 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | *.iso 3 | mount 4 | ubuntu-*-server-* 5 | *-ubuntu-*-server-* 6 | *.box 7 | test* 8 | -------------------------------------------------------------------------------- /clean-iso: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | . "$(dirname $0)/config.sh" 6 | 7 | rm -f "$NICKNAME-ubuntu-$VERSION-$DISTRO-$ARCH.iso" 8 | -------------------------------------------------------------------------------- /clean-vagrant: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | . "$(dirname $0)/config.sh" 6 | 7 | rm -f "$NICKNAME$([ "$ARCH" = "i386" ] && echo 32 || echo 64).box" 8 | -------------------------------------------------------------------------------- /vagrant.pub: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== Vagrant insecure public key 2 | -------------------------------------------------------------------------------- /late_command.sh.m4: -------------------------------------------------------------------------------- 1 | set -e 2 | 3 | mkdir /target/home/__USERNAME__/.ssh 4 | cat /cdrom/__PUBLIC_KEY__ >/target/home/__USERNAME__/.ssh/authorized_keys 5 | chmod 700 /target/home/__USERNAME__/.ssh 6 | chown 1000:1000 \ 7 | /target/home/__USERNAME__/.ssh \ 8 | /target/home/__USERNAME__/.ssh/authorized_keys 9 | 10 | cp /cdrom/sudoers /target/etc/ 11 | chmod 440 /target/etc/sudoers 12 | chown 0:0 /target/etc/sudoers 13 | -------------------------------------------------------------------------------- /isolinux.cfg: -------------------------------------------------------------------------------- 1 | default vagrant 2 | timeout 1 3 | label vagrant 4 | menu label ^Install Ubuntu Server for Vagrant 5 | kernel /install/vmlinuz 6 | append file=/cdrom/preseed/unattended.seed debian-installer/locale=en_US console-setup/layoutcode=us keyboard-configuration/layoutcode=us console-setup/ask_detect=false localechooser/translation/warn-light=true localechooser/translation/warn-severe=true initrd=/install/initrd.gz quiet -- 7 | -------------------------------------------------------------------------------- /clean-vbox: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # set -e # Try our best to finish here. 4 | 5 | . "$(dirname $0)/config.sh" 6 | 7 | ISO="$NICKNAME-ubuntu-$VERSION-$DISTRO-$ARCH.iso" 8 | VBOX="$NICKNAME-ubuntu-$VERSION-$DISTRO-$ARCH" 9 | 10 | VBoxManage controlvm "$VBOX" poweroff 11 | VBoxManage storagectl "$VBOX" --name IDE --remove 12 | VBoxManage storagectl "$VBOX" --name SATA --remove 13 | VBoxManage unregistervm "$VBOX" 14 | VBoxManage closemedium dvd "$PWD/$ISO" 15 | VBoxManage closemedium disk "$PWD/$VBOX/$VBOX.vmdk" 16 | rm -rf "$VBOX" 17 | -------------------------------------------------------------------------------- /config.sh: -------------------------------------------------------------------------------- 1 | # 2 | 3 | # The nickname of this ISO, VirtualBox image, and Vagrant box. 4 | : ${NICKNAME:="vagrant"} 5 | 6 | # Arguments given to the download router. 7 | : ${VERSION:="10.10"} 8 | : ${DISTRO:="server"} 9 | : ${RELEASE:="latest"} 10 | 11 | # Architecture being built (i386 or amd64). 12 | : ${ARCH:="i386"} 13 | 14 | # Hardcoded host information. 15 | : ${HOST:="vagrant"} 16 | : ${DOMAIN:="vagrantup.com"} 17 | : ${ROOT_PASSWORD:="vagrant"} 18 | : ${USERNAME:="vagrant"} 19 | : ${PASSWORD:="vagrant"} 20 | 21 | # SSH key to be authorized in virtual machines. 22 | : ${PRIVATE_KEY:="vagrant"} 23 | chmod 600 "$PRIVATE_KEY" 24 | : ${PUBLIC_KEY:="vagrant.pub"} 25 | 26 | # SSH command that will connect to the virtual machine. Add commands 27 | # onto the end to do other tricks. 28 | : ${SSH_PORT:="22222"} 29 | : ${SSH:="ssh \ 30 | -o UserKnownHostsFile=/dev/null \ 31 | -o StrictHostKeyChecking=no \ 32 | -l \"$USERNAME\" -i \"$PRIVATE_KEY\" -p \"$SSH_PORT\" localhost \ 33 | "} 34 | 35 | # Fully-qualified pathname of VBoxGuestAdditions.iso. 36 | : ${VBOX_GUEST_ADDITIONS:="/Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso"} 37 | -------------------------------------------------------------------------------- /vagrant: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEogIBAAKCAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzI 3 | w+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoP 4 | kcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2 5 | hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NO 6 | Td0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcW 7 | yLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQIBIwKCAQEA4iqWPJ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GH5JGqEJNQsz+xT2axM0/W/CRknmGaJ 24 | kda/AoGANWrLCz708y7VYgAtW2Uf1DPOIYMdvo6fxIB5i9ZfISgcJ/bbCUkFrhoH 25 | +vq/5CIWxCPp0f85R4qxxQ5ihxJ0YDQT9Jpx4TMss4PSavPaBH3RXow5Ohe+bYoQ 26 | NE5OgEXk2wVfZczCZpigBKbKZHNYcelXtTt/nP3rsCuGcM4h53s= 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Ubuntu for DevStructure 2 | ======================= 3 | 4 | Build a custom Ubuntu ISO for Vagrant by downloading, extracting, 5 | tweaking, and packaging the stock Ubuntu ISO. 6 | 7 | Build dependencies 8 | ------------------ 9 | 10 | * `curl`(1). 11 | * `hdiutil`(1), and therefore Mac OS X. It may be possible to relax 12 | this dependency but it has not been investigated. 13 | * `m4`(1). 14 | * `mkisofs`(1) from the `cdrtools` package available from MacPorts or 15 | Homebrew. 16 | 17 | Runtime dependencies 18 | -------------------- 19 | 20 | The results are bootable ISO images and so should run on any `i386` or 21 | `amd64` hardware. They are only tested in VirtualBox. 22 | 23 | Features in the ISO 24 | ------------------- 25 | 26 | * Network access is configured using sane default settings. WiFi is 27 | not supported. 28 | * The hostname is `vagrant`; the domain is `vagrantup.com`. These 29 | are configurable. 30 | * The system clock is set to UTC. 31 | * The entire disk is partitioned `ext4` without LVM. 32 | * The default kernel for the architecture is used. `linux-server` for 33 | `amd64` and `linux-generic-pae` for `i386`. 34 | * The `root` and `vagrant` users exist; both their password are `vagrant`. 35 | Vagrant's standard insecure SSH key is authorized for `vagrant`. These 36 | are all configurable. 37 | * OpenSSH server is installed. 38 | * VirtualBox Guest Additions are installed. 39 | 40 | Building 41 | -------- 42 | 43 | Building ISO images: 44 | 45 | ./build-iso 46 | 47 | Building virtual machines through VirtualBox: 48 | 49 | ./build-vbox 50 | 51 | Building Vagrant boxes: 52 | 53 | ./build-vagrant 54 | 55 | There are matching `clean-{iso,vbox,vagrant}` programs that remove the 56 | products of their build counterparts. 57 | 58 | The `Makefile` contains targets for common build tasks. 59 | -------------------------------------------------------------------------------- /unattended.seed.m4: -------------------------------------------------------------------------------- 1 | # Preseed Ubuntu for Vagrant. 2 | 3 | # Network. 4 | d-i netcfg/get_hostname string __HOST__ 5 | d-i netcfg/get_domain string __DOMAIN__ 6 | d-i netcfg/wireless_wep string 7 | 8 | # Clock. 9 | d-i clock-setup/utc boolean true 10 | d-i time/zone string UTC 11 | 12 | # Partitions. 13 | d-i partman-auto/disk string /dev/sda 14 | d-i partman-auto/method string regular 15 | d-i partman-lvm/device_remove_lvm boolean true 16 | d-i partman-md/device_remove_md boolean true 17 | d-i partman-auto/choose_recipe select atomic 18 | d-i partman/default_filesystem string ext4 19 | d-i partman/confirm_write_new_label boolean true 20 | d-i partman/choose_partition select finish 21 | d-i partman/confirm boolean true 22 | d-i partman/confirm_nooverwrite boolean true 23 | 24 | # Kernel. 25 | d-i base-installer/kernel/override-image string __KERNEL__ 26 | 27 | # Users. 28 | d-i passwd/root-password password __ROOT_PASSWORD__ 29 | d-i passwd/root-password-again password __ROOT_PASSWORD__ 30 | d-i passwd/user-uid string 1000 31 | d-i passwd/user-fullname string Vagrant 32 | d-i passwd/username string __USERNAME__ 33 | d-i passwd/user-password password __PASSWORD__ 34 | d-i passwd/user-password-again password __PASSWORD__ 35 | d-i user-setup/allow-password-weak boolean true 36 | d-i user-setup/encrypt-home boolean false 37 | 38 | # Packages and repositories. 39 | d-i mirror/http/proxy string 40 | tasksel tasksel/first multiselect 41 | d-i pkgsel/include string curl openssh-server 42 | d-i pkgsel/update-policy select none 43 | d-i pkgsel/install-language-support boolean false 44 | 45 | # Grub and reboot. 46 | d-i grub-installer/only_debian boolean true 47 | d-i grub-installer/with_other_os boolean true 48 | d-i finish-install/reboot_in_progress note 49 | d-i cdrom-detect/eject boolean true 50 | d-i debian-installer/splash boolean false 51 | 52 | # Everything else. 53 | d-i preseed/late_command string sh /cdrom/late_command.sh 54 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | 3 | clean: clean-lynx32 clean-lynxx32 clean-lynx64 clean-lynxx64 clean-meerkat32 clean-meerkat64 clean-narwhal32 clean-narwhal64 4 | 5 | lynx32: 6 | NICKNAME=lynx VERSION=10.04 ARCH=i386 ./build-iso 7 | NICKNAME=lynx VERSION=10.04 ARCH=i386 ./build-vbox 8 | NICKNAME=lynx VERSION=10.04 ARCH=i386 ./build-vagrant 9 | 10 | clean-lynx32: 11 | NICKNAME=lynx VERSION=10.04 ARCH=i386 ./clean-iso 12 | NICKNAME=lynx VERSION=10.04 ARCH=i386 ./clean-vbox || true 13 | NICKNAME=lynx VERSION=10.04 ARCH=i386 ./clean-vagrant 14 | 15 | lynxx32: 16 | NICKNAME=lynxx VERSION=10.04.2 ARCH=i386 ./build-iso 17 | NICKNAME=lynxx VERSION=10.04.2 ARCH=i386 ./build-vbox 18 | NICKNAME=lynxx VERSION=10.04.2 ARCH=i386 ./build-vagrant 19 | 20 | clean-lynxx32: 21 | NICKNAME=lynxx VERSION=10.04.2 ARCH=i386 ./clean-iso 22 | NICKNAME=lynxx VERSION=10.04.2 ARCH=i386 ./clean-vbox || true 23 | NICKNAME=lynxx VERSION=10.04.2 ARCH=i386 ./clean-vagrant 24 | 25 | lynx64: 26 | NICKNAME=lynx VERSION=10.04 ARCH=amd64 ./build-iso 27 | NICKNAME=lynx VERSION=10.04 ARCH=amd64 ./build-vbox 28 | NICKNAME=lynx VERSION=10.04 ARCH=amd64 ./build-vagrant 29 | 30 | clean-lynx64: 31 | NICKNAME=lynx VERSION=10.04 ARCH=amd64 ./clean-iso 32 | NICKNAME=lynx VERSION=10.04 ARCH=amd64 ./clean-vbox || true 33 | NICKNAME=lynx VERSION=10.04 ARCH=amd64 ./clean-vagrant 34 | 35 | lynxx64: 36 | NICKNAME=lynxx VERSION=10.04.2 ARCH=amd64 ./build-iso 37 | NICKNAME=lynxx VERSION=10.04.2 ARCH=amd64 ./build-vbox 38 | NICKNAME=lynxx VERSION=10.04.2 ARCH=amd64 ./build-vagrant 39 | 40 | clean-lynxx64: 41 | NICKNAME=lynxx VERSION=10.04.2 ARCH=amd64 ./clean-iso 42 | NICKNAME=lynxx VERSION=10.04.2 ARCH=amd64 ./clean-vbox || true 43 | NICKNAME=lynxx VERSION=10.04.2 ARCH=amd64 ./clean-vagrant 44 | 45 | meerkat32: 46 | NICKNAME=meerkat VERSION=10.10 ARCH=i386 ./build-iso 47 | NICKNAME=meerkat VERSION=10.10 ARCH=i386 ./build-vbox 48 | NICKNAME=meerkat VERSION=10.10 ARCH=i386 ./build-vagrant 49 | 50 | clean-meerkat32: 51 | NICKNAME=meerkat VERSION=10.10 ARCH=i386 ./clean-iso 52 | NICKNAME=meerkat VERSION=10.10 ARCH=i386 ./clean-vbox || true 53 | NICKNAME=meerkat VERSION=10.10 ARCH=i386 ./clean-vagrant 54 | 55 | meerkat64: 56 | NICKNAME=meerkat VERSION=10.10 ARCH=amd64 ./build-iso 57 | NICKNAME=meerkat VERSION=10.10 ARCH=amd64 ./build-vbox 58 | NICKNAME=meerkat VERSION=10.10 ARCH=amd64 ./build-vagrant 59 | 60 | clean-meerkat64: 61 | NICKNAME=meerkat VERSION=10.10 ARCH=amd64 ./clean-iso 62 | NICKNAME=meerkat VERSION=10.10 ARCH=amd64 ./clean-vbox || true 63 | NICKNAME=meerkat VERSION=10.10 ARCH=amd64 ./clean-vagrant 64 | 65 | narwhal32: 66 | NICKNAME=narwhal VERSION=11.04 ARCH=i386 ./build-iso 67 | NICKNAME=narwhal VERSION=11.04 ARCH=i386 ./build-vbox 68 | NICKNAME=narwhal VERSION=11.04 ARCH=i386 ./build-vagrant 69 | 70 | clean-narwhal32: 71 | NICKNAME=narwhal VERSION=11.04 ARCH=i386 ./clean-iso 72 | NICKNAME=narwhal VERSION=11.04 ARCH=i386 ./clean-vbox || true 73 | NICKNAME=narwhal VERSION=11.04 ARCH=i386 ./clean-vagrant 74 | 75 | narwhal64: 76 | NICKNAME=narwhal VERSION=11.04 ARCH=amd64 ./build-iso 77 | NICKNAME=narwhal VERSION=11.04 ARCH=amd64 ./build-vbox 78 | NICKNAME=narwhal VERSION=11.04 ARCH=amd64 ./build-vagrant 79 | 80 | clean-narwhal64: 81 | NICKNAME=narwhal VERSION=11.04 ARCH=amd64 ./clean-iso 82 | NICKNAME=narwhal VERSION=11.04 ARCH=amd64 ./clean-vbox || true 83 | NICKNAME=narwhal VERSION=11.04 ARCH=amd64 ./clean-vagrant 84 | 85 | .PHONY: all lynx32 clean-lynx32 lynx64 clean-lynx64 meerkat32 clean-meerkat32 meerkat64 clean-meerkat64 clean-narwhal32 clean-narwhal64 86 | --------------------------------------------------------------------------------