Skip to content

Commit 827286c

Browse files
committed
Update for VirtualBox 5.0
1 parent 16f917e commit 827286c

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

ievms.sh

+19-17
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ set -o pipefail
99
# ## Global Variables
1010

1111
# The ievms version.
12-
ievms_version="0.2.1"
12+
ievms_version="0.3.0"
1313

1414
# Options passed to each `curl` command.
1515
curl_opts=${CURL_OPTS:-""}
@@ -257,22 +257,20 @@ start_vm() {
257257
VBoxManage startvm "${1}" --type headless
258258
}
259259

260-
# Copy a file to the virtual machine. An optional password will be used
261-
# if given.
260+
# Copy a file to the virtual machine from the ievms home folder.
262261
copy_to_vm() {
263262
log "Copying ${2} to ${3}"
264-
VBoxManage guestcontrol "${1}" cp "${ievms_home}/${2}" "${3}" \
265-
--username "${guest_user}" --password "${guest_pass}"
263+
guest_control_exec "${1}" cmd.exe /c copy "E:\\${2}" "${3}"
266264
}
267265

268266
# Execute a command with arguments on a virtual machine.
269267
guest_control_exec() {
270268
local vm="${1}"
271269
local image="${2}"
272-
shift; shift
273-
VBoxManage guestcontrol "${vm}" exec --image "${image}" \
270+
shift
271+
VBoxManage guestcontrol "${vm}" run \
274272
--username "${guest_user}" --password "${guest_pass}" \
275-
--wait-exit -- "$@"
273+
--exe "${image}" -- "$@"
276274
}
277275

278276
# Start an XP virtual machine and set the password for the guest user.
@@ -281,19 +279,19 @@ set_xp_password() {
281279
wait_for_guestcontrol "${1}"
282280

283281
log "Setting ${guest_user} password"
284-
VBoxManage guestcontrol "${1}" exec --image "net.exe" --username \
285-
Administrator --password "${guest_pass}" --wait-exit -- \
286-
user "${guest_user}" "${guest_pass}"
282+
VBoxManage guestcontrol "${1}" run --username Administrator \
283+
--password "${guest_pass}" --exe "net.exe" -- \
284+
net.exe user "${guest_user}" "${guest_pass}"
287285

288286
log "Setting auto logon password"
289-
VBoxManage guestcontrol "${1}" exec --image "reg.exe" --username \
290-
Administrator --password "${guest_pass}" --wait-exit -- add \
287+
VBoxManage guestcontrol "${1}" run --username Administrator \
288+
--password "${guest_pass}" --exe "reg.exe" -- reg.exe add \
291289
"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon" \
292290
/f /v DefaultPassword /t REG_SZ /d "${guest_pass}"
293291

294292
log "Enabling auto admin logon"
295-
VBoxManage guestcontrol "${1}" exec --image "reg.exe" --username \
296-
Administrator --password "${guest_pass}" --wait-exit -- add \
293+
VBoxManage guestcontrol "${1}" run --username Administrator \
294+
--password "${guest_pass}" --exe "reg.exe" -- reg.exe add \
297295
"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon" \
298296
/f /v AutoAdminLogon /t REG_SZ /d 1
299297
}
@@ -309,7 +307,7 @@ shutdown_xp() {
309307
# installer, copies it to the vm, then runs it before shutting down.
310308
install_ie_xp() { # vm url md5
311309
local src=`basename "${2}"`
312-
local dest="/Documents and Settings/${guest_user}/Desktop/${src}"
310+
local dest="C:\\Documents and Settings\\${guest_user}\\Desktop\\${src}"
313311

314312
download "${src}" "${2}" "${src}" "${3}"
315313
copy_to_vm "${1}" "${src}" "${dest}"
@@ -324,7 +322,7 @@ install_ie_xp() { # vm url md5
324322
# installer, copies it to the vm, then runs it before shutting down.
325323
install_ie_win7() { # vm url md5
326324
local src=`basename "${2}"`
327-
local dest="/Users/${guest_user}/Desktop/${src}"
325+
local dest="C:\\Users\\${guest_user}\\Desktop\\${src}"
328326

329327
download "${src}" "${2}" "${src}" "${3}"
330328
start_vm "${1}"
@@ -404,6 +402,10 @@ build_ievm() {
404402
log "Creating ${vm} VM (disk: ${disk_path})"
405403
VBoxManage import "${ova}" --vsys 0 --vmname "${vm}" --unit "${unit}" --disk "${disk_path}"
406404

405+
log "Adding shared folder"
406+
VBoxManage sharedfolder add "${vm}" --automount --name ievms \
407+
--hostpath "${ievms_home}"
408+
407409
log "Building ${vm} VM"
408410
declare -F "build_ievm_ie${1}" && "build_ievm_ie${1}"
409411

0 commit comments

Comments
 (0)