Skip to content

Commit

Permalink
GA for all
Browse files Browse the repository at this point in the history
  • Loading branch information
xdissent committed Jun 12, 2013
1 parent ae363e0 commit 4bb7cd5
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 33 deletions.
3 changes: 3 additions & 0 deletions control/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ copy_scripts() {
log "Copying scripts"
cp "/vagrant/control/stage2" "${initrd}/scripts/"
cp "/vagrant/control/ievms.reg" "${initrd}/scripts/"
cp "/vagrant/control/deuac.reg" "${initrd}/scripts/"
cp "/vagrant/control/reuac.reg" "${initrd}/scripts/"
cp "/vagrant/control/vboxga.bat" "${initrd}/scripts/"
cp "/vagrant/control/isolinux.cfg" "${remaster_iso}/isolinux.cfg"
cp "/vagrant/control/isolinux.cfg" "${remaster_iso}/syslinux.cfg"
cp "${kernel}" "${remaster_iso}/"
Expand Down
5 changes: 5 additions & 0 deletions control/deuac.reg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System]
"EnableLUA"=dword:00000000
"ConsentPromptBehaviorAdmin"=dword:00000000
Binary file added control/reuac.reg
Binary file not shown.
17 changes: 15 additions & 2 deletions control/stage2
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,20 @@ mkdir /tmp /disk
chmod 777 /tmp
sh /scripts/prepdriver.sh
mdev -s
ntfs-3g /dev/sda1 /disk -o rw,noatime
reged -IC /disk/WINDOWS/system32/config/system HKEY_LOCAL_MACHINE\\SYSTEM /scripts/ievms.reg
if [ -b /dev/sda2 ]
then
ntfs-3g /dev/sda2 /disk -o rw,noatime
reged -IC /disk/Windows/System32/config/SOFTWARE HKEY_LOCAL_MACHINE\\SOFTWARE /scripts/deuac.reg
if [ -d /disk/ProgramData/Microsoft/Windows/Start\ Menu/Programs/Startup ]
then
cp /scripts/vboxga.bat /disk/ProgramData/Microsoft/Windows/Start\ Menu/Programs/Startup/
else
cp /scripts/vboxga.bat /disk/ProgramData/Microsoft/Windows/Start\ Menu/Programs/StartUp/
fi
cp /scripts/reuac.reg /disk/reuac.reg
else
ntfs-3g /dev/sda1 /disk -o rw,noatime
reged -IC /disk/WINDOWS/system32/config/system HKEY_LOCAL_MACHINE\\SYSTEM /scripts/ievms.reg
fi
umount /disk 2>/dev/null
poweroff
8 changes: 8 additions & 0 deletions control/vboxga.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cd /d D:\
cd \cert
VBoxCertUtil.exe add-trusted-publisher oracle-vbox.cer --root oracle-vbox.cer
cd \
VBoxWindowsAdditions.exe /S
regedit.exe /S C:\reuac.reg
shutdown.exe /s /t 00
del %0
98 changes: 67 additions & 31 deletions ievms.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ set -o pipefail

curl_opts=${CURL_OPTS:-""}
reuse_xp=${REUSE_XP:-"yes"}
sleep_wait="10"

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

Expand Down Expand Up @@ -174,18 +175,25 @@ build_ievm() {
fi
}

build_ievm_xp() {
sleep_wait="10"
wait_for_shutdown() {
x="0" ; until [ "${x}" != "0" ]; do
log "Waiting for ${1} to shutdown..."
sleep "${sleep_wait}"
VBoxManage list runningvms | grep "${1}" >/dev/null && x=$? || x=$?
done
sleep "${sleep_wait}" # Extra sleep for good measure.
}

installer=`basename "${2}"`
installer_host="${ievms_home}/${installer}"
installer_guest="/Documents and Settings/IEUser/Desktop/Install IE${1}.exe"
log "Downloading IE${1} installer from ${2}"
if [[ ! -f "${installer}" ]] && ! curl ${curl_opts} -L "${2}" -o "${installer}"
then
fail "Failed to download ${url} to ${ievms_home}/${installer} using 'curl', error code ($?)"
fi
wait_for_guestcontrol() {
x="1" ; until [ "${x}" == "0" ]; do
log "Waiting for ${1} to be available for guestcontrol..."
sleep "${sleep_wait}"
VBoxManage guestcontrol "${1}" cp "/etc/passwd" "/" --username IEUser --dryrun && x=$? || x=$?
done
sleep "${sleep_wait}" # Extra sleep for good measure.
}

find_iso() {
iso_url="https://dl.dropbox.com/u/463624/ievms-control.iso"
dev_iso=`pwd`/ievms-control.iso # Use local iso if in ievms dev root
if [[ -f "${dev_iso}" ]]; then iso=$dev_iso; else iso="${ievms_home}/ievms-control.iso"; fi
Expand All @@ -194,32 +202,39 @@ build_ievm_xp() {
then
fail "Failed to download ${iso_url} to ${ievms_home}/${iso} using 'curl', error code ($?)"
fi
}

boot_ievms() {
find_iso
log "Attaching ievms.iso"
VBoxManage storageattach "${vm}" --storagectl "IDE Controller" --port 1 --device 0 --type dvddrive --medium "${iso}"
VBoxManage storageattach "${1}" --storagectl "IDE Controller" --port 1 --device 0 --type dvddrive --medium "${iso}"

log "Starting VM ${vm}"
VBoxManage startvm "${vm}" --type headless
log "Starting VM ${1}"
VBoxManage startvm "${1}" --type headless

log "Waiting for ${vm} to shutdown..."
x="0" ; until [ "${x}" != "0" ]; do
sleep "${sleep_wait}"
VBoxManage list runningvms | grep "${vm}" >/dev/null && x=$? || x=$?
done
wait_for_shutdown "${1}"

log "Ejecting ievms.iso"
VBoxManage modifyvm "${vm}" --dvd none
VBoxManage modifyvm "${1}" --dvd none
}

build_ievm_xp() {
installer=`basename "${2}"`
installer_host="${ievms_home}/${installer}"
installer_guest="/Documents and Settings/IEUser/Desktop/Install IE${1}.exe"
log "Downloading IE${1} installer from ${2}"
if [[ ! -f "${installer}" ]] && ! curl ${curl_opts} -L "${2}" -o "${installer}"
then
fail "Failed to download ${url} to ${ievms_home}/${installer} using 'curl', error code ($?)"
fi

boot_ievms "${vm}"

log "Starting VM ${vm}"
VBoxManage startvm "${vm}" --type headless

log "Waiting for ${vm} to be available for guestcontrol..."
x="1" ; until [ "${x}" == "0" ]; do
sleep "${sleep_wait}"
VBoxManage guestcontrol "${vm}" cp "${installer_host}" "${installer_guest}" --username IEUser --dryrun && x=$? || x=$?
done
wait_for_guestcontrol "${vm}"

sleep "${sleep_wait}" # Extra sleep for good measure.
log "Copying IE${1} installer to Desktop"
VBoxManage guestcontrol "${vm}" cp "${installer_host}" "${installer_guest}" --username IEUser

Expand All @@ -229,13 +244,11 @@ build_ievm_xp() {
log "Shutting down VM ${vm}"
VBoxManage guestcontrol "${vm}" exec --image "/WINDOWS/system32/shutdown.exe" --username IEUser --wait-exit -- -s -f -t 0

x="0" ; until [ "${x}" != "0" ]; do
sleep "${sleep_wait}"
log "Waiting for ${vm} to shutdown..."
VBoxManage list runningvms | grep "${vm}" >/dev/null && x=$? || x=$?
done
wait_for_shutdown "${vm}"
}

sleep "${sleep_wait}" # Extra sleep for good measure.
build_ievm_ie6() {
boot_ievms "IE6 - WinXP"
}

build_ievm_ie7() {
Expand All @@ -248,6 +261,29 @@ build_ievm_ie8() {
build_ievm_xp 8 "http://download.microsoft.com/download/C/C/0/CC0BD555-33DD-411E-936B-73AC6F95AE11/IE8-WindowsXP-x86-ENU.exe"
}

build_auto_ga() {
boot_ievms "${1}"

log "Attaching Guest Additions ISO"
VBoxManage storageattach "${1}" --storagectl "IDE Controller" --port 1 --device 0 --type dvddrive --medium additions

log "Starting VM ${1}"
VBoxManage startvm "${1}" --type headless

wait_for_shutdown "${1}"

log "Ejecting Guest Additions"
VBoxManage modifyvm "${1}" --dvd none
}

build_ievm_ie9() {
build_auto_ga "IE9 - Win7"
}

build_ievm_ie10() {
build_auto_ga "IE10 - Win8"
}

check_system
create_home
check_virtualbox
Expand Down

0 comments on commit 4bb7cd5

Please sign in to comment.