247 lines
6.3 KiB
Plaintext
Executable File
247 lines
6.3 KiB
Plaintext
Executable File
#!/usr/bin/expect -f
|
|
#
|
|
# Script to perform an unattended install of minix on qemu
|
|
#
|
|
set timeout 60
|
|
|
|
set image minix.tmp.img
|
|
set cdrom minix-cdrom.iso
|
|
set imgsize 8G
|
|
if { $argc > 0 } {
|
|
puts "Parsing arguments"
|
|
set counter 0
|
|
while {$counter < $argc} {
|
|
if { [lindex $argv $counter] == "--image" } {
|
|
set counter [expr {$counter +1}]
|
|
set image [lindex $argv $counter]
|
|
|
|
}
|
|
if { [lindex $argv $counter] == "--cdrom" } {
|
|
set counter [expr {$counter +1}]
|
|
set cdrom [lindex $argv $counter]
|
|
|
|
}
|
|
if { [lindex $argv $counter] == "--imgsize" } {
|
|
set counter [expr {$counter +1}]
|
|
set cdrom [lindex $argv $counter]
|
|
|
|
}
|
|
set counter [expr {$counter +1}]
|
|
}
|
|
}
|
|
|
|
set send_human {.1 .3 1 .05 2}
|
|
|
|
set step "initial"
|
|
|
|
proc last_chance {} {
|
|
global step
|
|
puts "\n(Step $step):Last chance\n"
|
|
interact
|
|
}
|
|
|
|
# Remove the previous install
|
|
exec rm -rf $image
|
|
|
|
# Create a new empty raw qemu image
|
|
exec qemu-img create $image $imgsize
|
|
|
|
|
|
# Spawn qemu using the curses front-end and start interacting with it
|
|
#spawn qemu -hda minix.tmp.img -cdrom minix_R3.2.0-116fcea.iso -boot d -curses
|
|
spawn qemu-system-i386 -hda $image -cdrom $cdrom -boot d -curses
|
|
|
|
#pass past the bootloader
|
|
set step "bootloader"
|
|
expect {
|
|
"1. Regular MINIX 3" { send -h "1\n" }
|
|
timeout last_chance
|
|
}
|
|
|
|
|
|
|
|
#wait for the kernel to be booted and a shell to be spawned
|
|
set step "login"
|
|
expect {
|
|
"minix login:" { send -h "root\n" }
|
|
timeout last_chance
|
|
}
|
|
|
|
set step "setup"
|
|
expect {
|
|
"#" { send -h "setup\n" }
|
|
timeout last_chance
|
|
}
|
|
|
|
#expect
|
|
#Welcome to the MINIX 3 setup script. This script will guide you in setting up
|
|
#MINIX on your machine. Please consult the manual for detailed instructions.
|
|
#
|
|
#Note 1: If the screen blanks, hit CTRL+F3 to select "software scrolling".
|
|
#Note 2: If things go wrong then hit CTRL+C to abort and start over.
|
|
#Note 3: Default answers, like [y], can simply be chosen by hitting ENTER.
|
|
#Note 4: If you see a colon (:) then you should hit ENTER to continue.
|
|
|
|
set step "start of setup"
|
|
expect {
|
|
"Note 4: If you see a colon (:) then you should hit ENTER to continue." { send -h "\n" }
|
|
timeout last_chance
|
|
}
|
|
|
|
# Keyboard type? [us-std]
|
|
# TODO Fix escape sequence . how does this work in TCL?
|
|
set step "setup keyboard slection"
|
|
expect {
|
|
"Keyboard type? " { send -h "\n" }
|
|
timeout last_chance
|
|
}
|
|
|
|
# Press ENTER for automatic mode, or type 'expert':
|
|
# TODO Fix escape sequence
|
|
set step "setup automatic selection"
|
|
expect {
|
|
"Press ENTER for automatic mode, or type " { send -h "\n" }
|
|
timeout last_chance
|
|
}
|
|
|
|
|
|
|
|
#
|
|
#expect "--- Substep 3.1: Select a disk to install MINIX 3 ---------------------" {}
|
|
|
|
set step "setup 3.2 disk selection"
|
|
#Enter the disk number to use: [0]
|
|
expect {
|
|
"Enter the disk number to use" { send -h "\n" }
|
|
timeout last_chance
|
|
}
|
|
|
|
#Enter the region number to use or type 'delete': [0]
|
|
expect {
|
|
"Enter the region number to use or type" { send -h "\n" }
|
|
timeout last_chance
|
|
}
|
|
|
|
#--- Substep 3.3: Confirm your choices ---------------------------------
|
|
#
|
|
#This is the point of no return. You have selected to install MINIX 3
|
|
#into region 0 of disk /dev/c0d0. Please confirm that you want
|
|
#to use this selection to install MINIX 3.
|
|
#
|
|
#Are you sure you want to continue? Please enter 'yes' or 'no':
|
|
set step "setup 3.3 confirm choices"
|
|
expect {
|
|
"Are you sure you want to continue" { send -h "yes\n" }
|
|
timeout last_chance
|
|
}
|
|
#How big do you want your /home to be in MB (0-1623) ? [324]
|
|
expect {
|
|
"How big do you want your /home to be" { send -h "\n" }
|
|
timeout last_chance
|
|
}
|
|
|
|
# 324 MB Ok? [Y]
|
|
expect {
|
|
"MB Ok?" { send -h "\n" }
|
|
timeout last_chance
|
|
}
|
|
expect {
|
|
"Step 6" { }
|
|
timeout last_chance
|
|
}
|
|
#Block size in kilobytes? [4]
|
|
expect {
|
|
"Block size in kilobytes?" { send -h "\n" }
|
|
timeout last_chance
|
|
}
|
|
|
|
set timeout 200
|
|
set step "formatting disk"
|
|
for {} 1 {} {
|
|
expect {
|
|
timeout last_chance
|
|
"Step 7" {
|
|
puts "Found step 7\n"
|
|
break
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
set timeout 600
|
|
set step "installing files"
|
|
for {} 1 {} {
|
|
expect {
|
|
timeout last_chance
|
|
"Step 8" {
|
|
puts "Exit for step 8\n"
|
|
break
|
|
}
|
|
}
|
|
}
|
|
|
|
puts "\nGrumble\n"
|
|
# Ethernet card?
|
|
#--- Step 8: Select your Ethernet chip ---------------------------------
|
|
#
|
|
#MINIX 3 currently supports the following Ethernet cards. PCI cards detected
|
|
#by MINIX are marked with *. Please choose:
|
|
#
|
|
#0. No Ethernet card (no networking)
|
|
#1. 3Com 501 or 3Com 509 based card
|
|
#2. Realtek 8029 based card (also emulated by Qemu)
|
|
#3. NE2000, 3com 503 or WD based card (also emulated by Bochs)
|
|
#4. Attansic/Atheros L2 FastEthernet
|
|
#5. DEC Tulip 21140A in VirtualPC
|
|
#6. * Intel PRO/1000 Gigabit
|
|
#7. Intel PRO/100
|
|
#8. AMD LANCE (also emulated by VMWare and VirtualBox)
|
|
#9. Realtek 8139 based card
|
|
#10. Realtek 8169 based card
|
|
#11. Different Ethernet card (no networking)
|
|
#
|
|
#Ethernet card? [6]
|
|
set step "step 8 ethernet card"
|
|
expect {
|
|
"Ethernet card?" { send -h "\n"}
|
|
timeout last_chance
|
|
}
|
|
#Configure network using DHCP or manually?
|
|
#
|
|
# 1. Automatically using DHCP
|
|
# 2. Manually
|
|
#
|
|
# Configure method? [1]
|
|
expect {
|
|
"Configure method?" { send -h "\n" }
|
|
timeout last_chance
|
|
}
|
|
|
|
#Please type 'shutdown' to exit MINIX 3 and reboot. To boot into your new
|
|
#system, you might have to remove installation media.
|
|
#
|
|
# This ends the MINIX 3 setup script. After booting your newly set up system,
|
|
# you can run the test suites as indicated in the setup manual. You also
|
|
# may want to take care of local configuration, such as securing your system
|
|
# with a password. Please consult the usage manual for more information.
|
|
#
|
|
#
|
|
#
|
|
set step "shutdown"
|
|
expect {
|
|
"with a password. Please consult the usage manual for more information." { send -h "\nshutdown\n" }
|
|
timeout last_chance
|
|
}
|
|
|
|
|
|
set timeout 30
|
|
expect {
|
|
"Choose an option; RETURN for default; SPACE to stop countdown." {
|
|
puts "\nInstall worked\n"
|
|
}
|
|
"Press Ctrl-B to configure iPXE" {
|
|
puts "\nInstall worked\n"
|
|
}
|
|
timeout last_chance
|
|
}
|