Skip to content

Instantly share code, notes, and snippets.

@lhw
Last active January 22, 2020 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lhw/e0e19003147e7af5314004a573eaead7 to your computer and use it in GitHub Desktop.
Save lhw/e0e19003147e7af5314004a573eaead7 to your computer and use it in GitHub Desktop.
CoreOS PXE VLAN install
#!/usr/bin/env make
# As per CoreOS/ContainerLinux suggestion
# https://coreos.com/os/docs/latest/booting-with-pxe.html#adding-a-custom-oem
ifndef VLAN
$(error VLAN is not set)
endif
all: oem.cpio.gz
@gzip --stdout --decompress oem.cpio.gz | cpio -it
@mv oem.cpio.gz ${VLAN}.cpio.gz
etc/systemd/network:
@mkdir -p $@
vlan.netdev vlan.network eth0.network: etc/systemd/network
@sed "s;{VLAN};${VLAN};" tpl/$@ > etc/systemd/network/00-$@
oem.cpio: vlan.netdev vlan.network eth0.network
@find etc | cpio -o -H newc -O oem.cpio
oem.cpio.gz: oem.cpio
@gzip -f oem.cpio
clean:
@rm -rf ${VLAN}.cpio.gz etc
[Match]
Name=eth0
[Network]
DHCP=no
VLAN=vlan
[NetDev]
Name=eth0.{VLAN}
Kind=vlan
[VLAN]
Id={VLAN}
[Match]
Name=eth0.{VLAN}
[Network]
DHCP=yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment