dhcp-netboot.xyz/run-demo.sh
Sam Mesterton-Gibbons ede18a1729 Move the demo Vagrantfile up to the top level
It's going to be repurposed to also contain a VM in environments we
can't run Docker.
2021-01-08 23:43:35 +00:00

27 lines
599 B
Bash
Executable file

#!/bin/bash
DHCP_RANGE_START=${1:-192.168.0.1}
# Start the netboot container and run it in the background
docker run --net=host --cap-add=NET_ADMIN -e DHCP_RANGE_START=${DHCP_RANGE_START} samdbmg/dhcp-netboot.xyz &
DOCKER_PROCESS=$!
# Catch ctrl-c and clean up
function cleanup() {
echo "Caught SIGINT, stopping VM"
vagrant destroy -f
echo "Waiting for Docker to stop"
wait ${DOCKER_PROCESS}
exit 0
}
trap cleanup INT
# Bring up the VM - this will fail because Vagrant can't SSH to it, but that's fine
vagrant up || true
# Wait for Ctrl-C
while true; do
sleep 10
done