From 5a389d60f8c2f016a8db591bfa700c7d15af9e2a Mon Sep 17 00:00:00 2001 From: yep Date: Tue, 12 Jun 2012 16:14:29 +0200 Subject: [PATCH 1/8] removed even more refernces to ide bus. --- clean-vbox | 1 - 1 file changed, 1 deletion(-) diff --git a/clean-vbox b/clean-vbox index d85a665..3009a6f 100755 --- a/clean-vbox +++ b/clean-vbox @@ -8,7 +8,6 @@ ISO="$NICKNAME-ubuntu-$VERSION-$DISTRO-$ARCH.iso" VBOX="$NICKNAME-ubuntu-$VERSION-$DISTRO-$ARCH" VBoxManage controlvm "$VBOX" poweroff -VBoxManage storagectl "$VBOX" --name IDE --remove VBoxManage storagectl "$VBOX" --name SATA --remove VBoxManage unregistervm "$VBOX" VBoxManage closemedium dvd "$PWD/$ISO" From c08e6ba55b57f0d15d2ff0e33f0ade0a2a9c8f08 Mon Sep 17 00:00:00 2001 From: yep Date: Fri, 22 Jun 2012 23:02:16 +0200 Subject: [PATCH 2/8] Fixed infinite reboot loop. When installation finished, cdrom was not ejected and installation started over. Added option to shut down after installation. --- build-vbox | 25 ++++++++++++++++--------- unattended.seed.m4 | 1 + 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/build-vbox b/build-vbox index cc4c75c..1b7be89 100755 --- a/build-vbox +++ b/build-vbox @@ -54,21 +54,26 @@ VBoxManage storageattach "$VBOX" \ # Start the virtual machine and the OS installation. This will take -# a while so this time it gets a GUI. Spin slowly until SSH is usable. +# a while so this time it gets a GUI. Wait until installation finished +# and vm is powered off. VBoxManage startvm "$VBOX" --type gui echo "Waiting for installion to finish.." -until eval "$SSH exit" +until VBoxManage showvminfo "$VBOX" | grep "^State: *powered off" do - sleep 60 + sleep 10 done # Attach the VBoxGuestAdditions ISO, implicitly detaching the custom -# installation ISO in the process. Install the additions and empty -# the drive. +# installation ISO in the process. VBoxManage storageattach "$VBOX" \ --storagectl SATA \ --port 1 --device 0 \ --type dvddrive --medium "$VBOX_GUEST_ADDITIONS" + +# Power up vm again. +VBoxManage startvm "$VBOX" -- + +# Install guest additions. eval "$SSH \" set -e sudo apt-get -y install linux-headers-\\\$(uname -r) build-essential @@ -79,10 +84,6 @@ eval "$SSH \" sudo /media/cdrom/VBoxLinuxAdditions.run sudo umount /media/cdrom \"" -VBoxManage storageattach "$VBOX" \ - --storagectl SATA \ - --port 1 --device 0 \ - --type dvddrive --medium emptydrive # Shutdown the virtual machine. eval "$SSH \"sudo shutdown -h now\"" @@ -90,3 +91,9 @@ until VBoxManage showvminfo "$VBOX" | grep "^State: *powered off" do sleep 1 done + +# Remove guest additions cd. +VBoxManage storageattach "$VBOX" \ + --storagectl SATA \ + --port 1 --device 0 \ + --type dvddrive --medium emptydrive diff --git a/unattended.seed.m4 b/unattended.seed.m4 index 0474b04..3a3f862 100644 --- a/unattended.seed.m4 +++ b/unattended.seed.m4 @@ -48,6 +48,7 @@ d-i grub-installer/with_other_os boolean true d-i finish-install/reboot_in_progress note d-i cdrom-detect/eject boolean true d-i debian-installer/splash boolean false +d-i debian-installer/exit/poweroff boolean true # Everything else. d-i preseed/late_command string sh /cdrom/late_command.sh From e49d0de95031f225dd870662af3bedd3958a459d Mon Sep 17 00:00:00 2001 From: yep Date: Fri, 22 Jun 2012 23:10:41 +0200 Subject: [PATCH 3/8] clean-iso did not unmount device. this resulted in mount to fail on next run of build-iso. --- clean-iso | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/clean-iso b/clean-iso index 3491c59..eb0c118 100755 --- a/clean-iso +++ b/clean-iso @@ -5,3 +5,10 @@ set -e . "$(dirname $0)/config.sh" rm -f "$NICKNAME-ubuntu-$VERSION-$DISTRO-$ARCH.iso" +{ + sudo diskutil unmount "mount" + sudo /usr/libexec/vndevice detach /dev/vn0 +} || { + sudo umount "mount" + rm -rf "mount" +} From e64800c93ef3abff3f593355a480cd24fee87d1f Mon Sep 17 00:00:00 2001 From: yep Date: Fri, 22 Jun 2012 23:15:04 +0200 Subject: [PATCH 4/8] removed unnecessary comments and added success message. --- build-vagrant | 3 ++- clean-vbox | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/build-vagrant b/build-vagrant index 223a0ae..ba455c6 100755 --- a/build-vagrant +++ b/build-vagrant @@ -8,7 +8,6 @@ VBOX="$NICKNAME-ubuntu-$VERSION-$DISTRO-$ARCH" # Start the virtual machine. Spin slowly until SSH is usable. VBoxManage startvm "$VBOX" --type gui -#VBoxHeadless --startvm "$VBOX" --vrdp config until eval "$SSH exit" do sleep 1 @@ -34,5 +33,7 @@ vagrant package --base "$VBOX" mv "package.box" \ "$NICKNAME$([ "$ARCH" = "i386" ] && echo 32 || echo 64).box" +echo "Successfully built vagrant box!" + # Creating Vagrant boxes ruins the normal VM setup so get rid of them. eval "$(dirname $0)/clean-vbox" diff --git a/clean-vbox b/clean-vbox index 3009a6f..52f3e9c 100755 --- a/clean-vbox +++ b/clean-vbox @@ -1,7 +1,5 @@ #!/bin/sh -# set -e # Try our best to finish here. - . "$(dirname $0)/config.sh" ISO="$NICKNAME-ubuntu-$VERSION-$DISTRO-$ARCH.iso" From d544fe2231eed5c7f72f5105739c1235ff34a75f Mon Sep 17 00:00:00 2001 From: yep Date: Fri, 22 Jun 2012 23:15:40 +0200 Subject: [PATCH 5/8] Updated to current Ubuntu LTE version. --- config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.sh b/config.sh index 9e9dfa4..a9785e1 100644 --- a/config.sh +++ b/config.sh @@ -4,7 +4,7 @@ : ${NICKNAME:="vagrant"} # Arguments given to the download router. -: ${VERSION:="10.10"} +: ${VERSION:="12.04"} : ${DISTRO:="server"} : ${RELEASE:="latest"} From 431550e89bc3ebfd1c432a1dca8c7c755af15989 Mon Sep 17 00:00:00 2001 From: yep Date: Fri, 22 Jun 2012 23:17:18 +0200 Subject: [PATCH 6/8] Adding chef to base box by default again. --- build-vagrant | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/build-vagrant b/build-vagrant index ba455c6..7f39033 100755 --- a/build-vagrant +++ b/build-vagrant @@ -14,12 +14,12 @@ do done # Install Ruby, RubyGems, and Chef as Vagrant requires. -# eval "$SSH \" -# set -e -# sudo apt-get -y install build-essential ruby-dev rubygems -# sudo gem install --no-rdoc --no-ri chef -# echo 'PATH=\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/var/lib/gems/1.8/bin\"' | sudo tee /etc/environment >/dev/null -# \"" +eval "$SSH \" + set -e + sudo apt-get -y install build-essential ruby-dev rubygems + sudo gem install --no-rdoc --no-ri chef + echo 'PATH=\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/var/lib/gems/1.8/bin\"' | sudo tee /etc/environment >/dev/null + \"" # Shutdown the virtual machine. eval "$SSH \"sudo shutdown -h now\"" From 93ff5d40c29458b7b12c7e9fc277073f809ddb82 Mon Sep 17 00:00:00 2001 From: yep Date: Sat, 23 Jun 2012 00:00:29 +0200 Subject: [PATCH 7/8] Updated makefile. Removed old Ubuntu versions and added current one. --- Makefile | 96 +++++++++++--------------------------------------------- 1 file changed, 18 insertions(+), 78 deletions(-) diff --git a/Makefile b/Makefile index 21f6c98..215dfbf 100644 --- a/Makefile +++ b/Makefile @@ -1,85 +1,25 @@ all: -clean: clean-lynx32 clean-lynxx32 clean-lynx64 clean-lynxx64 clean-meerkat32 clean-meerkat64 clean-narwhal32 clean-narwhal64 +clean: clean-precise32 clean-precise64 -lynx32: - NICKNAME=lynx VERSION=10.04 ARCH=i386 ./build-iso - NICKNAME=lynx VERSION=10.04 ARCH=i386 ./build-vbox - NICKNAME=lynx VERSION=10.04 ARCH=i386 ./build-vagrant +precise32: + NICKNAME=precise VERSION=12.04 ARCH=i386 ./build-iso + NICKNAME=precise VERSION=12.04 ARCH=i386 ./build-vbox + NICKNAME=precise VERSION=12.04 ARCH=i386 ./build-vagrant -clean-lynx32: - NICKNAME=lynx VERSION=10.04 ARCH=i386 ./clean-iso - NICKNAME=lynx VERSION=10.04 ARCH=i386 ./clean-vbox || true - NICKNAME=lynx VERSION=10.04 ARCH=i386 ./clean-vagrant +clean-precise32: + NICKNAME=precise VERSION=12.04 ARCH=i386 ./clean-iso + NICKNAME=precise VERSION=12.04 ARCH=i386 ./clean-vbox || true + NICKNAME=precise VERSION=12.04 ARCH=i386 ./clean-vagrant -lynxx32: - NICKNAME=lynxx VERSION=10.04.2 ARCH=i386 ./build-iso - NICKNAME=lynxx VERSION=10.04.2 ARCH=i386 ./build-vbox - NICKNAME=lynxx VERSION=10.04.2 ARCH=i386 ./build-vagrant +precise64: + NICKNAME=precise VERSION=12.04 ARCH=amd64 ./build-iso + NICKNAME=precise VERSION=12.04 ARCH=amd64 ./build-vbox + NICKNAME=precise VERSION=12.04 ARCH=amd64 ./build-vagrant -clean-lynxx32: - NICKNAME=lynxx VERSION=10.04.2 ARCH=i386 ./clean-iso - NICKNAME=lynxx VERSION=10.04.2 ARCH=i386 ./clean-vbox || true - NICKNAME=lynxx VERSION=10.04.2 ARCH=i386 ./clean-vagrant +clean-precise64: + NICKNAME=precise VERSION=12.04 ARCH=amd64 ./clean-iso + NICKNAME=precise VERSION=12.04 ARCH=amd64 ./clean-vbox || true + NICKNAME=precise VERSION=12.04 ARCH=amd64 ./clean-vagrant -lynx64: - NICKNAME=lynx VERSION=10.04 ARCH=amd64 ./build-iso - NICKNAME=lynx VERSION=10.04 ARCH=amd64 ./build-vbox - NICKNAME=lynx VERSION=10.04 ARCH=amd64 ./build-vagrant - -clean-lynx64: - NICKNAME=lynx VERSION=10.04 ARCH=amd64 ./clean-iso - NICKNAME=lynx VERSION=10.04 ARCH=amd64 ./clean-vbox || true - NICKNAME=lynx VERSION=10.04 ARCH=amd64 ./clean-vagrant - -lynxx64: - NICKNAME=lynxx VERSION=10.04.2 ARCH=amd64 ./build-iso - NICKNAME=lynxx VERSION=10.04.2 ARCH=amd64 ./build-vbox - NICKNAME=lynxx VERSION=10.04.2 ARCH=amd64 ./build-vagrant - -clean-lynxx64: - NICKNAME=lynxx VERSION=10.04.2 ARCH=amd64 ./clean-iso - NICKNAME=lynxx VERSION=10.04.2 ARCH=amd64 ./clean-vbox || true - NICKNAME=lynxx VERSION=10.04.2 ARCH=amd64 ./clean-vagrant - -meerkat32: - NICKNAME=meerkat VERSION=10.10 ARCH=i386 ./build-iso - NICKNAME=meerkat VERSION=10.10 ARCH=i386 ./build-vbox - NICKNAME=meerkat VERSION=10.10 ARCH=i386 ./build-vagrant - -clean-meerkat32: - NICKNAME=meerkat VERSION=10.10 ARCH=i386 ./clean-iso - NICKNAME=meerkat VERSION=10.10 ARCH=i386 ./clean-vbox || true - NICKNAME=meerkat VERSION=10.10 ARCH=i386 ./clean-vagrant - -meerkat64: - NICKNAME=meerkat VERSION=10.10 ARCH=amd64 ./build-iso - NICKNAME=meerkat VERSION=10.10 ARCH=amd64 ./build-vbox - NICKNAME=meerkat VERSION=10.10 ARCH=amd64 ./build-vagrant - -clean-meerkat64: - NICKNAME=meerkat VERSION=10.10 ARCH=amd64 ./clean-iso - NICKNAME=meerkat VERSION=10.10 ARCH=amd64 ./clean-vbox || true - NICKNAME=meerkat VERSION=10.10 ARCH=amd64 ./clean-vagrant - -narwhal32: - NICKNAME=narwhal VERSION=11.04 ARCH=i386 ./build-iso - NICKNAME=narwhal VERSION=11.04 ARCH=i386 ./build-vbox - NICKNAME=narwhal VERSION=11.04 ARCH=i386 ./build-vagrant - -clean-narwhal32: - NICKNAME=narwhal VERSION=11.04 ARCH=i386 ./clean-iso - NICKNAME=narwhal VERSION=11.04 ARCH=i386 ./clean-vbox || true - NICKNAME=narwhal VERSION=11.04 ARCH=i386 ./clean-vagrant - -narwhal64: - NICKNAME=narwhal VERSION=11.04 ARCH=amd64 ./build-iso - NICKNAME=narwhal VERSION=11.04 ARCH=amd64 ./build-vbox - NICKNAME=narwhal VERSION=11.04 ARCH=amd64 ./build-vagrant - -clean-narwhal64: - NICKNAME=narwhal VERSION=11.04 ARCH=amd64 ./clean-iso - NICKNAME=narwhal VERSION=11.04 ARCH=amd64 ./clean-vbox || true - NICKNAME=narwhal VERSION=11.04 ARCH=amd64 ./clean-vagrant - -.PHONY: all lynx32 clean-lynx32 lynx64 clean-lynx64 meerkat32 clean-meerkat32 meerkat64 clean-meerkat64 clean-narwhal32 clean-narwhal64 +.PHONY: all clean-precise32 clean-precise64 From dec1fb0d91a76137a13da6d8d7bdb5079b4a0328 Mon Sep 17 00:00:00 2001 From: yep Date: Sat, 23 Jun 2012 00:28:58 +0200 Subject: [PATCH 8/8] Updated readme. hdiutil is not a dependency anymore. --- README.md | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 03347e0..f72d80d 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,13 @@ -Ubuntu for DevStructure -======================= +Ubuntu for Vagrant +================== -Build a custom Ubuntu ISO for Vagrant by downloading, extracting, +Build a custom Ubuntu base box for Vagrant by downloading, extracting, tweaking, and packaging the stock Ubuntu ISO. Build dependencies ------------------ * `curl`(1). -* `hdiutil`(1), and therefore Mac OS X. It may be possible to relax - this dependency but it has not been investigated. * `m4`(1). * `mkisofs`(1) from the `cdrtools` package available from MacPorts or Homebrew. @@ -36,10 +34,15 @@ Features in the ISO are all configurable. * OpenSSH server is installed. * VirtualBox Guest Additions are installed. +* Chef is installed. Building -------- +Edit configuration in + + config.sh + Building ISO images: ./build-iso @@ -52,7 +55,14 @@ Building Vagrant boxes: ./build-vagrant -There are matching `clean-{iso,vbox,vagrant}` programs that remove the +There are matching `clean-{iso,vbox,vagrant}` scripts that remove the products of their build counterparts. -The `Makefile` contains targets for common build tasks. +The `Makefile` contains targets for common build tasks. For Ubuntu 12.04 +(Precise Pangolin) 32-bit use + + make precise32 + +For Ubuntu 12.04 (Precise Pangolin) 64-bit use + + make precise64