#!/bin/bash set -e IMAGE_NAME="zyxel-openwrt-builder" CONTAINER_NAME="openwrt-builder-container" FIRMWARE_PATH="/home/builder/openwrt/bin/brcm963xx/zyxel/ras.bin" echo "Building Docker image ${IMAGE_NAME}..." docker build -t ${IMAGE_NAME} . echo "Starting container..." docker run -it --name ${CONTAINER_NAME} \ -e TERM=vt100 \ ${IMAGE_NAME} \ /bin/bash -c "cd /home/builder/openwrt && bash" #TODO: copy config file to home docker cp ${CONTAINER_NAME}:${FIRMWARE_PATH} ./ras.bin 2>/dev/null || { echo "ERROR: Firmware not found at ${FIRMWARE_PATH}" echo "The build may have failed or the output path is not ${FIRMWARE_PATH}" echo "You can inspect the container manually: docker start -ai ${CONTAINER_NAME}" exit 1 } echo "Firmware copied to ./ras.bin"