add wrt and fai server setup scripts
[automated-distro-installer] / pxe-server
1 #!/bin/bash -x
2
3 # usage: $0 [TYPE]
4 # default distro is the base debian/fedora type. others are fai & arch
5
6 set -eE -o pipefail
7 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?"' ERR
8
9 action=${1:-default}
10
11 arch() {
12 default
13 cat <<'EOF'
14 dhcp-option-force=209,boot/syslinux/archiso.cfg
15 dhcp-option-force=210,/arch/
16 dhcp-boot=/arch/boot/syslinux/lpxelinux.0
17 EOF
18 }
19
20 default() {
21 cat <<'EOF'
22 enable-tftp
23 tftp-root=/mnt/usb/tftpboot
24 dhcp-boot=pxelinux.0
25 EOF
26 }
27
28 fai() {
29 cat <<'EOF'
30 dhcp-boot=fai/pxelinux.0,faiserver.lan,faiserver.lan
31 EOF
32 }
33
34
35 $action | ssh wrt "cedit pxe-server /etc/dnsmasq.conf || /etc/init.d/dnsmasq restart
36 if [[ $action == arch ]]; then arch-pxe-mount; fi"