#!/usr/bin/env expect -f # build-boot-disk.exp # This script is necessary for initial interaction with the virtual # machine, as the other route is to dissect the ISO image, stitch in # a script, and suture it shut (that is the method used with the TBox # hardware boot image). # # Notes: # - Only call this script from the Makefile # - Don't attach the ISO drive as readonly, because pfSense panics # - All bridge interfaces must have STP enabled, otherwise qemu freezes # # Copyright (C) 2019 Stack41, LLC. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see set timeout -1 set mgmt_bridge [lindex $argv 0] set mgmt_mac [lindex $argv 1] set sync_bridge [lindex $argv 2] set sync_mac [lindex $argv 3] set lan_bridge [lindex $argv 4] set lan_mac [lindex $argv 5] set wan_bridge [lindex $argv 6] set wan_mac [lindex $argv 7] set isodisk [lindex $argv 8] set bootdisk [lindex $argv 9] spawn qemu-system-x86_64 \ -enable-kvm \ -cpu host \ -smp 4 \ -m 512 \ -net nic,model=virtio,macaddr=$wan_mac -net bridge,br=$wan_bridge \ -net nic,model=virtio,macaddr=$lan_mac -net bridge,br=$lan_bridge \ -net nic,model=virtio,macaddr=$mgmt_mac -net bridge,br=$mgmt_bridge \ -net nic,model=virtio,macaddr=$sync_mac -net bridge,br=$sync_bridge \ -display none -serial stdio \ -drive file=$isodisk,if=virtio \ -drive file=$bootdisk,if=virtio expect "Console type" send "ansi\r"; # Ansi term expect "" send "\r" # Welcome expect "< OK >"; # Install send "\r" # Keymap Selection expect "