X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=pxe-server;h=ec299e47b734a14cf56752247f439700305a299c;hb=81e0e0b826ebffdee7d809ee4dff1338af7692e1;hp=2e8b2a40c267dcb6cdd8e79390b625e423a03583;hpb=a43d3eec943c5f0491b300214a3c744d31a6e542;p=automated-distro-installer diff --git a/pxe-server b/pxe-server index 2e8b2a4..ec299e4 100755 --- a/pxe-server +++ b/pxe-server @@ -1,15 +1,22 @@ #!/bin/bash -x -# usage: $0 [TYPE] -# default distro is the base debian/fedora type. others are fai & arch +# Setup dhcp server to point to tftp server, +# and depending on the type, setup the tftp server. + +# usage: $0 TYPE +# default distro is the base debian/fedora type. others are fai & arch. +# for no pxe server, use a no-op like : or true. set -eE -o pipefail -trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?"' ERR +trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR -action=${1:-default} +if [[ ! $1 ]]; then + echo "$0: error: exptected 1 argument of type" +fi +action=$1 arch() { - default + plain-tftp cat <<'EOF' dhcp-option-force=209,boot/syslinux/archiso.cfg dhcp-option-force=210,/arch/ @@ -17,7 +24,9 @@ dhcp-boot=/arch/boot/syslinux/lpxelinux.0 EOF } -default() { +plain-tftp() { + # if arch was used before, this additionally needs + # the tftp link in /mnt/usb to be changed. cat <<'EOF' enable-tftp tftp-root=/mnt/usb/tftpboot