Nov 252016
 

A simple bash script to start/stop a TFTP server based on dnsmasq:

#/bin/bash
TFTPDIR=/tmp/tftpboot
INTERFACE=eth0
echo "Enabling TFTP on $INTERFACE in $TFTPDIR"
if [ ! -d $TFTPDIR ]; then
  mkdir -p $TFTPDIR;
fi
chmod 777 -R $TFTPDIR
dnsmasq --port=0 --enable-tftp --tftp-root=$TFTPDIR,$INTERFACE
read -p "Press any key to stop dnsmasq... " -n1
killall dnsmasq
exit 0