diff --git a/projects/autoinstall/Makefile b/projects/autoinstall/Makefile index 69273db..36e9e4c 100644 --- a/projects/autoinstall/Makefile +++ b/projects/autoinstall/Makefile @@ -4,23 +4,23 @@ default:minix.dev.8g.img # Download the isp # minix-dev.iso: - wget http://www.minix3.org/iso/minix3_2_1_ide_20120620_ace9a62.iso.bz2 - bunzip2 minix3_2_1_ide_20120620_ace9a62.iso.bz2 - mv minix3_2_1_ide_20120620_ace9a62.iso minix-dev.iso + wget http://www.minix3.org/iso/minix3_2_1_ide_20120621_f8c6b27.iso.bz2 + bunzip2 minix3_2_1_ide_20120621_f8c6b27.iso.bz2 + mv minix3_2_1_ide_20120621_f8c6b27.iso minix-dev.iso # # Perform installation to harddisk # minix.dev.8g.img:script/02_qemu_minix_base.install.expect minix-dev.iso - script/02_qemu_minix_base.install.expect -- --image $@ --cdrom minix-dev.iso + time script/02_qemu_minix_base.install.expect -- --image $@ --cdrom minix-dev.iso 2>&1 | tee $@.log # # Perform generic post installation # minix.dev-postinst.8g.img:minix.dev.8g.img cp $< $@ - post-install/02-setup.expect -- --image $@ - post-install/03-password.expect -- --image $@ + time post-install/02-setup.expect -- --image $@ 2>&1 | tee $@.log + post-install/03-password.expect -- --image $@ 2>&1 | tee -a $@.log #echo "now start the image using the startup.sh script" #echo "and scp and run post-install.sh to finish installation" diff --git a/projects/autoinstall/post-install/02-setup.expect b/projects/autoinstall/post-install/02-setup.expect index 823cac1..b2951df 100755 --- a/projects/autoinstall/post-install/02-setup.expect +++ b/projects/autoinstall/post-install/02-setup.expect @@ -19,6 +19,11 @@ if { $argc > 0 } { } } +proc last_chance {} { + puts "\nLast chance\n" + interact +} + spawn qemu-system-i386 -m 512 -hda $image -curses set timeout 5 @@ -55,7 +60,7 @@ for {} 1 {} { "dirty, performing fsck" {puts "resetting timeout as the file system in dirty" } timeout { puts "Failed to catch login command" - exit 1 + last_chance } } } @@ -71,7 +76,7 @@ expect -re $ # set send_human {.1 .3 1 .05 2} # the shell can't handle all this output at once so sending it as "human" -send -h "echo '#/bin/sh' > /tmp/runcmd.sh ; echo 'if $* ; then echo RESULT-OK ; else echo RESULT-FAIL ; fi' >> /tmp/runcmd.sh ; chmod +x /tmp/runcmd.sh\n" +send -h "echo '#!/bin/sh' > /tmp/runcmd.sh ; echo 'if $* ; then echo RESULT-OK ; else echo RESULT-FAIL ; fi' >> /tmp/runcmd.sh ; chmod +x /tmp/runcmd.sh\n" expect "#" @@ -90,8 +95,7 @@ expect { } timeout { puts "Failed to update pkg database" - interact - exit 1 + last_chance } } @@ -101,16 +105,14 @@ send "/tmp/runcmd.sh pkgin upgrade\n" expect { "RESULT-FAIL" { puts "Failed to upgrade packages" - interact - exit 1 + last_chance } "RESULT-OK" { puts "Updated the package upgraded" } timeout { puts "Failed to update pkg packages" - interact - exit 1 + last_chance } } @@ -123,16 +125,14 @@ send "/tmp/runcmd.sh pkgin -y install vim cscope openssh gcc44 scmgit\n" expect { "RESULT-FAIL" { puts "Failed to install needed packages" - interact - exit 1 + last_chance } "RESULT-OK" { puts "Updated the needed packages" } timeout { puts "Failed to install selected packages" - interact - exit 1 + last_chance } } set timeout 20 diff --git a/projects/autoinstall/post-install/03-password.expect b/projects/autoinstall/post-install/03-password.expect index 53a401a..5bc0a71 100755 --- a/projects/autoinstall/post-install/03-password.expect +++ b/projects/autoinstall/post-install/03-password.expect @@ -18,6 +18,11 @@ if { $argc > 0 } { } } +proc last_chance {} { + puts "\nLast chance\n" + interact +} + spawn qemu-system-i386 -m 512 -hda $image -curses set timeout 5 @@ -54,7 +59,7 @@ for {} 1 {} { "dirty, performing fsck" {puts "resetting timeout as the file system in dirty" } timeout { puts "Failed to catch login command" - exit 1 + last_chance } } } @@ -70,7 +75,7 @@ expect "#" set send_human {.1 .3 1 .05 2} expect -re $ # the shell can't handle all this output at once so sending it as "human" -send -h "echo '#/bin/sh' > /tmp/runcmd.sh ; echo 'if $* ; then echo RESULT-OK ; else echo RESULT-FAIL ; fi' >> /tmp/runcmd.sh ; chmod +x /tmp/runcmd.sh\n" +send -h "echo '#!/bin/sh' > /tmp/runcmd.sh ; echo 'if $* ; then echo RESULT-OK ; else echo RESULT-FAIL ; fi' >> /tmp/runcmd.sh ; chmod +x /tmp/runcmd.sh\n" expect "#" @@ -112,8 +117,7 @@ for {} 1 {} { } timeout { puts "Failed to set password" - interact - exit 1 + last_chance } } } diff --git a/projects/autoinstall/script/02_qemu_minix_base.install.expect b/projects/autoinstall/script/02_qemu_minix_base.install.expect index 31707d7..b1c5067 100755 --- a/projects/autoinstall/script/02_qemu_minix_base.install.expect +++ b/projects/autoinstall/script/02_qemu_minix_base.install.expect @@ -6,7 +6,7 @@ # required: qemu , expect and minix_R3.2.0-116fcea.iso in the current directory # sha1sum 127e79c76538b8066dbcf549b246be1f22a986e7 # -set timeout 30 +set timeout 60 set image minix.tmp.img set cdrom minix-cdrom.iso @@ -29,6 +29,11 @@ if { $argc > 0 } { } +proc last_chance {} { + puts "\nLast chance\n" + interact +} + # Remove the previous install exec rm -rf $image @@ -41,20 +46,22 @@ exec qemu-img create $image 8G spawn qemu-system-i386 -hda $image -cdrom $cdrom -boot d -curses #pass past the bootloader -expect "1. Regular MINIX 3" { - send "1\n" -} +expect { + "1. Regular MINIX 3" { send "1\n" } + timeout last_chance +} #wait for the kernel to be booted and a shell to be spawned -expect "minix login:" { - send "root\n" +expect { + "minix login:" { send "root\n" } + timeout last_chance } -expect "#" { - send "setup\n" +expect { + "#" { send "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. @@ -64,32 +71,40 @@ expect "#" { #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. -expect "Note 4: If you see a colon (:) then you should hit ENTER to continue." { - send "\n" +expect { + "Note 4: If you see a colon (:) then you should hit ENTER to continue." { send "\n" } + timeout last_chance } # Keyboard type? [us-std] # TODO Fix escape sequence . how does this work in TCL? -expect "Keyboard type? " { - send "\n" +expect { + "Keyboard type? " { send "\n" } + timeout last_chance } + # Press ENTER for automatic mode, or type 'expert': # TODO Fix escape sequence -expect "Press ENTER for automatic mode, or type " { - send "\n" +expect { + "Press ENTER for automatic mode, or type " { send "\n" } + timeout last_chance } + + # #expect "--- Substep 3.1: Select a disk to install MINIX 3 ---------------------" {} #Enter the disk number to use: [0] -expect "Enter the disk number to use" { - send "\n" +expect { + "Enter the disk number to use" { send "\n" } + timeout last_chance } #Enter the region number to use or type 'delete': [0] -expect "Enter the region number to use or type" { - send "\n" +expect { + "Enter the region number to use or type" { send "\n" } + timeout last_chance } #--- Substep 3.3: Confirm your choices --------------------------------- @@ -99,23 +114,34 @@ expect "Enter the region number to use or type" { #to use this selection to install MINIX 3. # #Are you sure you want to continue? Please enter 'yes' or 'no': -expect "Are you sure you want to continue" { - send "yes\n" +expect { + "Are you sure you want to continue" { send "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 "\n" +expect { + "How big do you want your /home to be" { send "\n" } + timeout last_chance } # 324 MB Ok? [Y] -expect "MB Ok?" { - send "\n" +expect { + "MB Ok?" { send "\n" } + timeout last_chance } #Block size in kilobytes? [4] -expect "Block size in kilobytes?" { - send "\n" +expect { + "Block size in kilobytes?" { send "\n" } + timeout last_chance } + set timeout 600 + +expect { + "Step 8" { puts "\nStep 8\n" } + timeout last_chance +} + # Ethernet card? #--- Step 8: Select your Ethernet chip --------------------------------- # @@ -136,8 +162,9 @@ set timeout 600 #11. Different Ethernet card (no networking) # #Ethernet card? [6] -expect "Ethernet card" { - send "\n" +expect { + "Ethernet card?" { send "\n"} + timeout last_chance } #Configure network using DHCP or manually? # @@ -145,8 +172,9 @@ expect "Ethernet card" { # 2. Manually # # Configure method? [1] -expect "Configure method?" { - send "\n" +expect { + "Configure method?" { send "\n" } + timeout last_chance } #Please type 'shutdown' to exit MINIX 3 and reboot. To boot into your new @@ -160,9 +188,12 @@ expect "Configure method?" { # # # -expect "with a password. Please consult the usage manual for more information." { - send "shutdown\n" +expect { + "with a password. Please consult the usage manual for more information." { send "shutdown\n" } + timeout last_chance } + + set timeout 30 expect { "Choose an option; RETURN for default; SPACE to stop countdown." { @@ -170,6 +201,6 @@ expect { } "Press Ctrl-B to configure iPXE" { puts "\nInstall worked\n" - } + timeout last_chance }