-#!/bin/bash -l
+#!/bin/bash
# Copyright (C) 2016 Ian Kelling
# This program is free software; you can redistribute it and/or
# Setup arch pxe boot server from the base image.
#
-
-set -eE -o pipefail
-trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
+if [[ -s ~/.bashrc ]];then . ~/.bashrc;fi
usage() {
cat <<EOF
# based on https://blog.chendry.org/2015/02/06/automating-arch-linux-installation.html
# and https://wiki.archlinux.org/index.php/Remastering_the_Install_ISO
-s rm -rf squashfs-root # remove any existing folder
-s unsquashfs $sfs
-s mkdir -p squashfs-root/root/.ssh
-s chmod 755 squashfs-root/root/.ssh
-s cp ~/.ssh/home.pub squashfs-root/root/.ssh/authorized_keys
+sudo rm -rf squashfs-root # remove any existing folder
+sudo unsquashfs $sfs
+sudo mkdir -p squashfs-root/root/.ssh
+sudo chmod 755 squashfs-root/root/.ssh
+sudo cp ~/.ssh/home.pub squashfs-root/root/.ssh/authorized_keys
-s cp $script_dir/archlike-iso-init squashfs-root/root
-s rm $sfs
-s mksquashfs squashfs-root $sfs -comp xz
+sudo cp $script_dir/archlike-iso-init squashfs-root/root
+sudo rm $sfs
+sudo mksquashfs squashfs-root $sfs -comp xz
# file transfer to wrt is slow, so remove some useless files
rm -f $idir/$n/i686/airootfs.sfs $idir/$n/boot/i686/${n}iso.img
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.
-ssh wrt "/etc/init.d/nfsd stop; \
+ssh cmc "/etc/init.d/nfsd stop; \
umount /run/archiso/bootmnt; \
umount /run/parabolaiso/bootmnt; \
rm -rf /mnt/usb/$idir"
# complicated, so fuck it, we use nfs cuz it's easy
rm -rf $idir
-s rm -rf squashfs-root
+sudo rm -rf squashfs-root