#!/bin/bash -lx # Setup arch pxe boot server from the base image. # Requires manually downloading image to /a/opt, and set it's name below. set -eE -o pipefail trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR x="$(readlink -f "$BASH_SOURCE")" script_dir="${x%/*}" cd /a/opt iso="archlinux-2016.05.01-dual" sfs=$iso/arch/x86_64/airootfs.sfs rm -rf $iso ex $iso.iso sed -i -f - $iso/arch/boot/syslinux/archiso_pxe64.cfg < airootfs.md5; b # seems if you've done a pxe boot, mounted the nfs, # then shutdown, it's still busy. ssh wrt "/etc/init.d/nfsd stop; \ { ! mount | grep /run/archiso/bootmnt || umount /run/archiso/bootmnt; } && \ rm -rf /mnt/usb/$iso" scp -r $iso wrt:/mnt/usb ssh wrt "cd /mnt/usb && rm -f tftpboot && ln -s $iso tftpboot" # The default settings in the installer expect to find the NFS at /run/archiso/bootmnt pxe-server arch # background: # great documentation at https://wiki.archlinux.org/index.php/PXE # background: arch can do netboot like ubuntu etc, but the docs look a little complicated, so fuck it, # we use nfs cuz it's easy rm -rf $iso s rm -rf squashfs-root