#!/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 # # 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 bridge [lindex $argv 0] set isodisk [lindex $argv 1] set bootdisk [lindex $argv 2] set fatdisk [lindex $argv 3] spawn qemu-system-x86_64 \ -enable-kvm \ -smp 1 \ -m 256 \ -net nic -net bridge,br=$bridge \ -display none -serial stdio \ -drive file=$isodisk,media=cdrom,readonly \ -drive file=$bootdisk,if=virtio \ -drive file=fat:$fatdisk,if=virtio expect "localhost login: " send "root\n" expect "localhost:~# " send "mkdir -p /mnt/vdb1 && mount /dev/vdb1 /mnt/vdb1 && cd /mnt/vdb1 && ./install-base.sh\n" interact