Skip to content

Instantly share code, notes, and snippets.

@BlackLotus
Created January 10, 2017 17:15
Show Gist options
  • Save BlackLotus/e76c20cc77f46923c8d49615d757cbda to your computer and use it in GitHub Desktop.
Save BlackLotus/e76c20cc77f46923c8d49615d757cbda to your computer and use it in GitHub Desktop.
#!/bin/bash
log=/var/log/dnsmasq-pxe.log
image="/srv/tftp/images/initrd.img"
template=/srv/tftp/pxelinux.cfg/localboot
if [ "$1" == "old" ];then
echo "$3 $2" >> $log
elif [ "$1" == "tftp" ] && [ "$4" == "$image" ];then
filename=01-$(grep "^$3" $log|tail -n 1|awk {'print $2'}|sed 's/:/-/g')
install -o nobody -g nobody $template /srv/tftp/pxelinux.cfg/$filename
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment