Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
xdissent committed Feb 3, 2013
2 parents 8de047f + 8519eb5 commit a33f44d
Show file tree
Hide file tree
Showing 11 changed files with 2,008 additions and 28 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@
.rvmrc
.vagrant
5 changes: 5 additions & 0 deletions Gemfile
@@ -0,0 +1,5 @@
# coding: utf-8

source :rubygems

gem "vagrant"
29 changes: 29 additions & 0 deletions Gemfile.lock
@@ -0,0 +1,29 @@
GEM
remote: http://rubygems.org/
specs:
archive-tar-minitar (0.5.2)
childprocess (0.3.7)
ffi (~> 1.0, >= 1.0.6)
erubis (2.7.0)
ffi (1.3.1)
i18n (0.6.1)
json (1.5.4)
log4r (1.1.10)
net-scp (1.0.4)
net-ssh (>= 1.99.1)
net-ssh (2.2.2)
vagrant (1.0.6)
archive-tar-minitar (= 0.5.2)
childprocess (~> 0.3.1)
erubis (~> 2.7.0)
i18n (~> 0.6.0)
json (~> 1.5.1)
log4r (~> 1.1.9)
net-scp (~> 1.0.4)
net-ssh (~> 2.2.2)

PLATFORMS
ruby

DEPENDENCIES
vagrant
56 changes: 51 additions & 5 deletions README.md
Expand Up @@ -51,11 +51,11 @@ to start the install and then go catch a movie, or maybe dinner, or both.
Recovering from a failed installation
-------------------------------------

Each version is installed into a subdirectory of `~/.ievms/ova/`. If the installation fails
for any reason (corrupted download, for instance), delete the version-specific subdirectory
Each version is installed into `~/.ievms/` (or `INSTALL_PATH`). If the installation fails
for any reason (corrupted download, for instance), delete the appropriate ZIP/ova file
and rerun the install.

If nothing else, you can delete `~/.ievms` and rerun the install.
If nothing else, you can delete `~/.ievms` (or `INSTALL_PATH`) and rerun the install.


Specifying the install path
Expand Down Expand Up @@ -91,10 +91,56 @@ initial state.
Resuming Downloads
------------------

If one of the comically large files fails to download, the `curl`
command used will automatically attempt to resume where it left off.
~~If one of the comically large files fails to download, the `curl`
command used will automatically attempt to resume where it left off.~~
Unfortunately, the modern.IE download servers do not support resume.


Reusing XP VMs
--------------

IE7 and IE8 ship from MS on Vista and Win7 respectively. Both of these
images are far larger than the IE6 XP image, which also technically supports
IE7 and IE8. To save bandwidth, space and time, ievms will will reuse
(duplicate) the IE6 XP VM image for both. Virtualbox guest control is used
to run the appropriate IE installer within the VM. The `clean` snapshot
includes the updated browser version.

**NOTE:** If you'd like to disable XP VM reuse for IE7 and IE8, set the
environment variable `REUSE_XP` to anything other than `yes`:

curl -s https://raw.github.com/xdissent/ievms/master/ievms.sh | REUSE_XP="no" bash


Control ISO
-----------

Microsoft's XP image uses a blank password for the `IEUser`, which disallows
control via Virtualbox's guest control by default. Changing a value in the
Windows registry enables guest control, but requires accessing the VM's hard
drive. A solution is to boot the VM with a special boot CD image which attaches
the hard disk and edits the registry. A custom linux build has been created
based on [the ntpasswd bootdisk](http://pogostick.net/~pnh/ntpasswd/) which
makes the required registry edits and simply powers off the machine. The ievms
script may then use Virtualbox guest controls to manage the VM.

The control ISO is built within a [Vagrant](http://vagrantup.com) Ubuntu VM.
If you'd like to build it yourself, clone the ievms repository, install
Vagrant and run `vagrant up`. The base ntpasswd boot disk will be downloaded,
unpacked and customized within the Vagrant VM. A custom linux kernel is
cross-compiled for the image as well.


Acknowledgements
================

* [modern.IE](http://modern.ie) - Provider of IE VM images.
* [ntpasswd](http://pogostick.net/~pnh/ntpasswd/) - Boot disk starting point
and registry editor.
* [regit-config](https://github.com/regit/regit-config) - Minimal Virtualbox
kernel config reference.
* [uck](http://sourceforge.net/projects/uck/) - Used to (re)master control ISO.

License
=======

Expand Down
7 changes: 7 additions & 0 deletions Vagrantfile
@@ -0,0 +1,7 @@
# coding: utf-8

Vagrant::Config.run do |config|
config.vm.box = "precise32"
config.vm.box_url = "http://files.vagrantup.com/precise32.box"
config.vm.provision :shell, :path => "control/build.sh"
end
162 changes: 162 additions & 0 deletions control/build.sh
@@ -0,0 +1,162 @@
#!/usr/bin/env bash

# Caution is a virtue
set -o nounset
set -o errtrace
set -o errexit
set -o pipefail

log() { printf "$*\n" ; return $? ; }

fail() { log "\nERROR: $*\n" ; exit 1 ; }

create_home() {
ievms_home="${HOME}/ievms"
mkdir -p "${ievms_home}"
cd "${ievms_home}"
}

install_packages() {
apt-get install -y uck curl unzip
}

download_cross_compiler() {
url="http://landley.net/aboriginal/downloads/binaries/cross-compiler-i686.tar.bz2"
archive=`basename "${url}"`
log "Downloading cross compiler archive from ${url} to ${ievms_home}/${archive}"
if [[ ! -e "${archive}" ]] && ! curl -L "${url}" -o "${archive}"
then
fail "Failed to download ${url} to ${ievms_home}/${archive} using 'curl', error code ($?)"
fi
}

extract_cross_compiler() {
cross_compiler=`basename "${archive}" .tar.bz2`
log "Extracting cross compiler archive from ${archive} to ${ievms_home}/${cross_compiler}"
if [[ ! -e "${cross_compiler}" ]] && ! tar -jxf "${archive}"
then
fail "Failed to extract ${archive} to ${ievms_home}/${cross_compiler} using 'tar', error code ($?)"
fi
}

download_kernel() {
url="http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.5.tar.bz2"
archive=`basename "${url}"`
log "Downloading kernel archive from ${url} to ${ievms_home}/${archive}"
if [[ ! -e "${archive}" ]] && ! curl -L "${url}" -o "${archive}"
then
fail "Failed to download ${url} to ${ievms_home}/${archive} using 'curl', error code ($?)"
fi
}

extract_kernel() {
kernel_src=`basename "${archive}" .tar.bz2`
log "Extracting kernel archive from ${archive} to ${ievms_home}/${kernel_src}"
if [[ ! -e "${kernel_src}" ]] && ! tar -jxf "${archive}"
then
fail "Failed to extract ${archive} to ${ievms_home}/${kernel_src} using 'tar', error code ($?)"
fi
}

configure_kernel() {
kernel_config="/vagrant/control/kernel.config"
log "Configuring kernel from ${kernel_config} to ${ievms_home}/${kernel_src}/.config"
cp "${kernel_config}" "${kernel_src}/.config"
}

build_kernel() {
kernel="${ievms_home}/${kernel_src}/arch/x86/boot/bzImage"
cd "${kernel_src}"
log "Building kernel in ${ievms_home}/${kernel_src} to ${kernel}"
if [[ ! -e "${kernel}" ]] && ! make
then
fail "Failed to build kernel in ${ievms_home}/${kernel_src} using 'make', error code ($?)"
fi
cd -
}

download_iso() {
url="http://pogostick.net/~pnh/ntpasswd/cd110511.zip"
archive=`basename "${url}"`
log "Downloading ntpasswd ISO archive from ${url} to ${ievms_home}/${archive}"
if [[ ! -e "${archive}" ]] && ! curl -L "${url}" -o "${archive}"
then
fail "Failed to download ${url} to ${ievms_home}/${archive} using 'curl', error code ($?)"
fi
}

extract_iso() {
iso=`basename "${archive}" .zip`.iso
log "Extracting ntpasswd ISO archive from ${archive} to ${ievms_home}/${iso}"
if [[ ! -e "${iso}" ]] && ! unzip "${archive}"
then
fail "Failed to extract ${archive} to ${ievms_home}/${iso} using 'unzip', error code ($?)"
fi
}

unpack_iso() {
remaster_iso="${HOME}/tmp/remaster-iso"
log "Unpacking ntpasswd ISO from ${iso} to ${remaster_iso}"
if [[ ! -e "${remaster_iso}" ]] && ! uck-remaster-unpack-iso "${iso}"
then
fail "Failed to unpack ${iso} to ${remaster_iso} using 'uck-remaster-unpack-iso', error code ($?)"
fi
}

extract_initrd() {
initrd="${ievms_home}/initrd"
initrd_cgz="${remaster_iso}/initrd.cgz"
mkdir -p "${initrd}"
cd "${initrd}"
log "Extracting initrd from ${initrd_cgz} to ${initrd}"
if ! gzip -cd "${initrd_cgz}" | cpio -i -d -H newc --no-absolute-filenames
then
fail "Failed to extract ${initrd_cgz} to ${initrd} using 'gzip | cpio', error code ($?)"
fi
}

copy_scripts() {
log "Copying scripts"
cp "/vagrant/control/stage2" "${initrd}/scripts/"
cp "/vagrant/control/ievms.reg" "${initrd}/scripts/"
cp "/vagrant/control/isolinux.cfg" "${remaster_iso}/isolinux.cfg"
cp "/vagrant/control/isolinux.cfg" "${remaster_iso}/syslinux.cfg"
cp "${kernel}" "${remaster_iso}/"
chmod 755 "${remaster_iso}/bzImage"
rm -f "${remaster_iso}/vmlinuz" "${remaster_iso}/scsi.cgz" "${remaster_iso}/readme.txt"
}

compress_initrd() {
cd "${initrd}"
log "Compressing initrd from ${initrd} to ${initrd_cgz}"
if ! find . | cpio -o -H newc | gzip > "${initrd_cgz}"
then
fail "Failed to compress ${initrd} to ${initrd_cgz} using 'cpio | gzip', error code ($?)"
fi
}

pack_iso() {
iso_out="/vagrant/ievms-control.iso"
log "Packing ievms ISO from ${remaster_iso} to ${iso_out}"
if ! genisoimage -o "${iso_out}" -b isolinux.bin -c boot.cat -p "ievms" -no-emul-boot -boot-load-size 4 -boot-info-table -V "IEVMS" -cache-inodes -r -J -l -joliet-long "${remaster_iso}"
then
fail "Failed to pack ${remaster_iso} to ${iso_out} using 'genisoimage', error code ($?)"
fi
}

create_home
install_packages
download_cross_compiler
extract_cross_compiler
export PATH="${ievms_home}/${cross_compiler}/bin:$PATH"
download_kernel
extract_kernel
configure_kernel
build_kernel
download_iso
extract_iso
unpack_iso
extract_initrd
copy_scripts
compress_initrd
pack_iso
Binary file added control/ievms.reg
Binary file not shown.
8 changes: 8 additions & 0 deletions control/isolinux.cfg
@@ -0,0 +1,8 @@
default boot
display boot.msg
timeout 0
prompt 0
label boot
kernel bzImage

append rw vga=1 initrd=initrd.cgz

0 comments on commit a33f44d

Please sign in to comment.