Created
January 31, 2017 11:37
-
-
Save DanHam/4af37c1d488a3a8933a2ac7bdac5945e to your computer and use it in GitHub Desktop.
Demonstrate Virtualbox issue #16063 for Packer issue #4432
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dd bs=512 count=2880 if=/dev/zero of=floppy.vfd |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
echo "Creating VM..." | |
VBoxManage createvm --name "foo" --ostype "Windows2012_64" --register | |
echo "Attaching floppy controller..." | |
VBoxManage storagectl "foo" --name "Floppy Controller" --add "floppy" | |
echo "Attaching floppy drive to controller..." | |
VBoxManage storageattach "foo" --storagectl "Floppy Controller" \ | |
--port "0" --device "0" --type fdd --medium floppy.vfd | |
echo "Starting the VM..." | |
# We must run in GUI mode to encounter the error | |
VBoxManage startvm "foo" --type "gui" | |
echo "Allowing VM to run for 5 seconds..." | |
sleep 5 | |
echo "Powering machine off" | |
VBoxManage controlvm "foo" "poweroff" | |
# Immediately removing the floppy and floppy controller will result in an | |
# error | |
echo "Detaching floppy from floppy controller..." | |
VBoxManage storageattach "foo" --storagectl "Floppy Controller" \ | |
--port "0" --device "0" --medium "none" | |
echo "Removing the floppy controller..." | |
VBoxManage storagectl "foo" --name "Floppy Controller" --remove | |
echo "Pausing for 2 secs..." | |
sleep 2 | |
echo "Deleting the VM..." | |
VBoxManage unregistervm "foo" --delete |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
echo "Creating VM..." | |
VBoxManage createvm --name "foo" --ostype "Windows2012_64" --register | |
echo "Attaching floppy controller..." | |
VBoxManage storagectl "foo" --name "Floppy Controller" --add "floppy" | |
echo "Attaching floppy drive to controller..." | |
VBoxManage storageattach "foo" --storagectl "Floppy Controller" \ | |
--port "0" --device "0" --type fdd --medium floppy.vfd | |
echo "Starting the VM..." | |
# The floppy and controller will be detached successfully because we are | |
# running headless | |
VBoxManage startvm "foo" --type "headless" | |
echo "Allowing VM to run for 5 seconds..." | |
sleep 5 | |
echo "Powering machine off" | |
VBoxManage controlvm "foo" "poweroff" | |
echo "Detaching floppy from floppy controller..." | |
VBoxManage storageattach "foo" --storagectl "Floppy Controller" \ | |
--port "0" --device "0" --medium "none" | |
echo "Removing the floppy controller..." | |
VBoxManage storagectl "foo" --name "Floppy Controller" --remove | |
echo "Pausing for 2 secs..." | |
sleep 2 | |
echo "Deleting the VM..." | |
VBoxManage unregistervm "foo" --delete |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
echo "Creating VM..." | |
VBoxManage createvm --name "foo" --ostype "Windows2012_64" --register | |
echo "Attaching floppy controller..." | |
VBoxManage storagectl "foo" --name "Floppy Controller" --add "floppy" | |
echo "Attaching floppy drive to controller..." | |
VBoxManage storageattach "foo" --storagectl "Floppy Controller" \ | |
--port "0" --device "0" --type fdd --medium floppy.vfd | |
echo "Starting the VM..." | |
VBoxManage startvm "foo" --type "gui" | |
echo "Allowing VM to run for 5 seconds..." | |
sleep 5 | |
echo "Powering machine off" | |
VBoxManage controlvm "foo" "poweroff" | |
# Pausing for just a second after machine poweroff allows the removal of | |
# floppy and floppy controller to complete successfully | |
echo "Pausing for 1 second..." | |
sleep 1 | |
echo "Detaching floppy from floppy controller..." | |
VBoxManage storageattach "foo" --storagectl "Floppy Controller" \ | |
--port "0" --device "0" --medium "none" | |
echo "Removing the floppy controller..." | |
VBoxManage storagectl "foo" --name "Floppy Controller" --remove | |
echo "Pausing for 2 secs..." | |
sleep 2 | |
echo "Deleting the VM..." | |
VBoxManage unregistervm "foo" --delete |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
echo "Creating VM..." | |
VBoxManage createvm --name "foo" --ostype "Windows2012_64" --register | |
echo "Attaching floppy controller..." | |
VBoxManage storagectl "foo" --name "Floppy Controller" --add "floppy" | |
echo "Attaching floppy drive to controller..." | |
VBoxManage storageattach "foo" --storagectl "Floppy Controller" \ | |
--port "0" --device "0" --type fdd --medium floppy.vfd | |
echo "Starting the VM..." | |
VBoxManage startvm "foo" --type "gui" | |
echo "Allowing VM to run for 5 seconds..." | |
sleep 5 | |
echo "Powering machine off" | |
VBoxManage controlvm "foo" "poweroff" | |
echo "Detaching floppy from floppy controller..." | |
VBoxManage storageattach "foo" --storagectl "Floppy Controller" \ | |
--port "0" --device "0" --medium "none" | |
# Pausing for just a second after the first VBoxManage command allows | |
# the next to complete successfully | |
echo "Pausing for 1 second..." | |
sleep 1 | |
echo "Removing the floppy controller..." | |
VBoxManage storagectl "foo" --name "Floppy Controller" --remove | |
echo "Pausing for 2 secs..." | |
sleep 2 | |
echo "Deleting the VM..." | |
VBoxManage unregistervm "foo" --delete |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment