# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# 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
+usage() {
+ cat <<EOF
+Usage: ${0##*/}
+Setup arch pxe boot server from the base image
+
+Requires manually downloading image. Image path is hardcoded below to
+/a/opt/image_name. Run pxe-server HOST|default arch to enable it.
+
+-h|--help Print help and exit.
+EOF
+ exit $1
+}
+
+case $1 in
+ -h|--help) usage ;;
+esac
+
+
x="$(readlink -f "$BASH_SOURCE")"
script_dir="${x%/*}"
cd /a/opt
-iso="archlinux-2016.05.01-dual"
+iso="archlinux-2017.02.01-dual"
sfs=$iso/arch/x86_64/airootfs.sfs
rm -rf $iso
ex $iso.iso
s mksquashfs squashfs-root $sfs -comp xz
# file transfer to wrt is slow, so remove some useless files
rm $iso/arch/i686/airootfs.sfs $iso/arch/boot/i686/archiso.img
-c $(dirname $sfs); md5sum ${sfs##*/} > airootfs.md5; b
+pushd $(dirname $sfs); md5sum ${sfs##*/} > airootfs.md5; popd
# seems if you've done a pxe boot, mounted the nfs,
# then shutdown, it's still busy.
# The default settings in the installer expect to find the NFS at /run/archiso/bootmnt
-pxe-server default 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
+# background: great documentation at
+# https://wiki.archlinux.org/index.php/PXE
+# 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