# 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/."