Files
everest-qemu/scripts/vm-testnet.sh
T
lw-everestlinuxandClaude Opus 5.5 f687558b66 Initial import: build and boot Everest Linux in QEMU
everest.sh builds Everest's signed packages in an Alpine container,
publishes the base, extra and extra-src repositories, installs the
system with glacier-bootstrap into an initramfs and boots it in QEMU.
The image carries glacier, a toolchain and the repositories, and builds
packages from source inside the VM.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 09:33:38 -04:00

31 lines
1.5 KiB
Bash

# vm-testnet.sh: run INSIDE an Everest VM started by `everest.sh boot`,
# which hands it over through QEMU's fw_cfg (never shipped):
#
# sh /sys/firmware/qemu_fw_cfg/by_name/opt/everest/testnet/raw
#
# Brings up QEMU's user network, points pkg.everestlinux.org at the
# host's local repository server (guest 10.0.2.100:443, relayed by
# QEMU) and appends the throwaway test CA to /etc/ssl/cert.pem (which
# makes that file admin-modified: ca-certificates won't update it).
# Also mounts the host's repo/ (shared by everest.sh boot) over the
# image's copy at /srv/everest, the file:// repositories repos.conf
# lists in the test image.
set -e
if [ -d /sys/bus/virtio/drivers/9pnet_virtio ] && ! grep -q ' /srv/everest 9p ' /proc/mounts; then
mount -t 9p -o trans=virtio,version=9p2000.L,ro everest-repo /srv/everest &&
echo "/srv/everest is this host's repo/ (live)."
fi
ip link set lo up
ip link set eth0 up
ip addr add 10.0.2.15/24 dev eth0 2>/dev/null || true
ip route add default via 10.0.2.2 2>/dev/null || true
# QEMU's DNS, for builds fetching their sources (syspkg -f from -src).
grep -q '^nameserver' /etc/resolv.conf 2>/dev/null ||
echo "nameserver 10.0.2.3" >> /etc/resolv.conf
grep -q pkg.everestlinux.org /etc/hosts 2>/dev/null ||
echo "10.0.2.100 pkg.everestlinux.org" >> /etc/hosts
ca=/sys/firmware/qemu_fw_cfg/by_name/opt/everest/testca/raw
grep -q "$(sed -n 2p "$ca")" /etc/ssl/cert.pem 2>/dev/null ||
cat "$ca" >> /etc/ssl/cert.pem
echo "Test network up: https://pkg.everestlinux.org is this host's repo/."