* Addon fixes: * Provide custom addon template according to our needs, instead of relying on the default one being present in grml-live.git/templates * Install memtest86+ as addon for BIOS usage * Install netboot.xyz.lkrn for BIOS usage and netboot.xyz.efi for EFI usage * Install ipxe.lkrn for BIOS usage and ipxe.efi for EFI usage * Stick grml-live version to v0.34.3, instead of relying on some random git master version * Stick grml2usb version to v0.17.0, instead of relying on the grml2usb version available on the host system (being 0.14.14 on Debian/stretch as present on our current build hosts). For arbitrary addon file names we need grml2iso (which uses grml2usb underneath) from grml2usb >=0.17.0. FTR, grml2iso and grml2usb can be executed from within the git repository, assuming all relevant tools are present * No longer invoke isohybrid on the resulting ISO, instead rely on grml2iso behaviour (which also checks for EFI support and enables according switches as needed) * Fix usage instructions in t/Dockerfile: * it's "deployment-iso-buster" and not "lua-ngcp-kamailio-buster" * refer to working directory instead of "deployment-iso.git", which very probably isn't named as such on any of our systems, while the $(pwd) approach works for c/p * Fix docker build usage in grml_build/Dockerfile (for building we need to provide a PATH (being current working directory for us) * Provide testing tools in grml-build-buster docker environment * Provide new testing script t/iso-tester to compare generated ISO against pre-defined screenshot (only testing memtest feature using ./t/screenshots/01-memtest.jpg for now) Change-Id: I67e3f85bbe86bd1b3ee709161504b5250ca5d7fechanges/18/34818/10
parent
ed8097151c
commit
c3d753562d
@ -0,0 +1,101 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu -o pipefail
|
||||
|
||||
usage_information() {
|
||||
local PN
|
||||
PN="$(basename "$0")"
|
||||
|
||||
echo "${PN}: tool to boot an ISO, generate a screenshot of the system,"
|
||||
echo "and optionally compare the screenshot against a reference image"
|
||||
echo
|
||||
echo "Usage: ${PN} <filename.iso> <screenshot.jpg> [<screenshot_compare.jpg>]" >&2
|
||||
echo
|
||||
echo "Usage examples:
|
||||
|
||||
${PN} ./sip_provider_mr7.5.1.iso /tmp/screenshot.jpg
|
||||
|
||||
${PN} ./sip_provider_mr7.5.1.iso /tmp/memtest.jpg ./t/screenshots/01-memtest.jpg
|
||||
"
|
||||
}
|
||||
|
||||
if [ $# -lt 2 ] ; then
|
||||
usage_information >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ISO="$1"
|
||||
SCREENSHOT="$2"
|
||||
|
||||
if [ -n "${3:-}" ] ; then
|
||||
SCREENSHOT_COMPARE="$3"
|
||||
fi
|
||||
|
||||
QEMU_MONITOR=$(mktemp)
|
||||
SCREENDUMP=$(mktemp)
|
||||
|
||||
send_command() {
|
||||
echo "$*" | socat - UNIX-CONNECT:"${QEMU_MONITOR}"
|
||||
# this is necessary to give the system some time to execute it before receiving the next command
|
||||
sleep 0.1
|
||||
}
|
||||
|
||||
if [[ ! -x "$(which qemu-system-x86_64)" ]] || [[ ! -x "$(which socat)" ]] || [[ ! -x "$(which convert)" ]]; then
|
||||
# only install tools automatically inside docker environment
|
||||
if [ -e /.dockerinit ] || [ -e /.dockerenv ] ; then
|
||||
apt-get update
|
||||
apt-get install --assume-yes --no-install-recommends socat qemu-system-x86 imagemagick
|
||||
else
|
||||
echo "Please make sure to have socat qemu-system-x86 imagemagick available, not automatically installing them." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
qemu-system-x86_64 -display none -monitor unix:"${QEMU_MONITOR}",server,nowait -boot order=d -m 128 -cdrom "${ISO}" &
|
||||
PID=$!
|
||||
echo "qemu process running as PID $PID"
|
||||
|
||||
# ensure the qemu process is ready for receiving commands
|
||||
sleep 1
|
||||
|
||||
send_command "sendkey down"
|
||||
send_command "sendkey down"
|
||||
send_command "sendkey down"
|
||||
send_command "sendkey down"
|
||||
send_command "sendkey down"
|
||||
send_command "sendkey down"
|
||||
send_command "sendkey ret"
|
||||
send_command "sendkey down"
|
||||
send_command "sendkey ret"
|
||||
send_command "screendump ${SCREENDUMP}"
|
||||
send_command "quit"
|
||||
|
||||
rm -f "${QEMU_MONITOR}"
|
||||
|
||||
if ! [ -f "${SCREENDUMP}" ] ; then
|
||||
echo "Failed to generated screenshot file, bailing out." >&2
|
||||
kill "$PID" || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
convert "${SCREENDUMP}" "${SCREENSHOT}"
|
||||
echo "Generated screenshot file ${SCREENSHOT}"
|
||||
rm -f "${SCREENDUMP}"
|
||||
|
||||
if ! [ -x ./screenshot-compare ] ; then
|
||||
wget -O ./screenshot-compare https://deb.sipwise.com/files/screenshot-compare
|
||||
chmod 755 ./screenshot-compare
|
||||
fi
|
||||
|
||||
mkdir -p reports
|
||||
if [ -n "${SCREENSHOT_COMPARE:-}" ] ; then
|
||||
echo "Comparing ${SCREENSHOT} against ${SCREENSHOT_COMPARE}"
|
||||
if ./screenshot-compare "${SCREENSHOT}" "${SCREENSHOT_COMPARE}" ; then
|
||||
echo "Looks like ${SCREENSHOT} and ${SCREENSHOT_COMPARE} are looking similar enough."
|
||||
echo "1..0" > ./reports/screenshot.tap
|
||||
else
|
||||
echo "Looks like ${SCREENSHOT} and ${SCREENSHOT_COMPARE} are NOT looking similar enough."
|
||||
echo "1..1" > ./reports/screenshot.tap
|
||||
echo "not ok 1 ${SCREENSHOT} and ${SCREENSHOT_COMPARE} don't look similar enough" >> ./reports/screenshot.tap
|
||||
fi
|
||||
fi
|
After Width: | Height: | Size: 80 KiB |
@ -0,0 +1,25 @@
|
||||
submenu "Addons ->" --class=submenu {
|
||||
menuentry "iPXE - boot via network/PXE" {
|
||||
if [ "${grub_platform}" == "efi" ] ; then
|
||||
chainloader /boot/addons/ipxe.efi
|
||||
else
|
||||
insmod linux16
|
||||
linux16 /boot/addons/ipxe.lkrn
|
||||
fi
|
||||
}
|
||||
|
||||
menuentry "Netboot.xyz" {
|
||||
if [ "${grub_platform}" == "efi" ] ; then
|
||||
chainloader /boot/addons/netboot.xyz.efi
|
||||
else
|
||||
insmod linux16
|
||||
linux16 /boot/addons/netboot.xyz.lkrn
|
||||
fi
|
||||
}
|
||||
|
||||
menuentry "Boot OS of first partition on first disk" {
|
||||
set root=(hd0,1)
|
||||
chainloader +1
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in new issue