#!/usr/bin/expectk -f proc sput { str } { .l configure -text "$str" exp_send "$str\r" expect ">>>" } proc CheckPrompt { } { set timeout 1 exp_send "\03" set r 1 expect { timeout { .l configure -text "Machine not responding ($r)"; set r [expr $r + 1] exp_send "\03"; exp_continue;} ">>>" } set timeout -1 expect -re ".*" } proc GetMAC { } { exp_send "sh dev ewa0\r" # catching command echo expect "\r" # catching MAC expect -re ".* .* (.*)\r" .l configure -text "$expect_out(1,string)" puts stderr "$expect_out(1,string)" expect ">>>" } proc ConfigureSystem { } { .l configure -text "*** dedecting machine ***" CheckPrompt .l configure -text "*** starting configuration proccess ***" sput "set oem_string \"Another Quant-X Beowulf Cluster\"" sput "set console serial" sput "set ewa0_protocols bootp" # sput "set ewa0_mode FastFD" sput "set ewa0_mode Fast" sput "set ewa0_bootp_tries 9999" sput "set ewa0_tftp_tries 9999" sput "set bootdef_dev ewa0" sput "set boot_osflags \"root=/dev/nfs console=ttyS0 rw\"" sput "set auto_action RESTART" GetMAC .l configure -text "*** Fertig ***" } proc ConfigureUndo { } { .l configure -text "*** dedecting machine ***" CheckPrompt .l configure -text "*** starting configuration proccess ***" sput "set oem_string \"\"" sput "set ewa0_protocols \"\"" sput "set ewa0_mode \"auto\"" sput "set ewa0_bootp_tries 3" sput "set ewa0_tftp_tries 3" sput "set bootdef_dev \"\"" sput "set boot_osflags \"\"" sput "set auto_action HALT" sput "set console graphics" .l configure -text "*** Fertig ***" } proc main {} { button .r -text "Configure for remote boot" -command ConfigureSystem button .u -text "Configure for normal bootup" -command ConfigureUndo button .b -text "... und tschüß" -command exit label .l -text "--- uninitialized ---" -width 80 pack .r .u .b .l } main