static usb ethnet addresses
[automated-distro-installer] / archlike-pxe
index ba39c456d4d4a18bb5c1fbd26f22df27be3cd7d1..db05bf9178a789fbac79bacabdef39dda0bb5548 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash -l
+#!/bin/bash
 # Copyright (C) 2016 Ian Kelling
 
 # This program is free software; you can redistribute it and/or
@@ -17,9 +17,7 @@
 
 # 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
@@ -59,22 +57,22 @@ 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"
@@ -90,4 +88,4 @@ ssh wrt "cd /mnt/usb && rm -f tftpboot && ln -s $idir tftpboot"
 # complicated, so fuck it, we use nfs cuz it's easy
 
 rm -rf $idir
-s rm -rf squashfs-root
+sudo rm -rf squashfs-root