On 10/15/22 13:20, Chuck Hast wrote:
Folks,
I have some WiFi devices that I am loading code into to convert
them to something called AREDN, Amateur Radio Emergency
Data Network. Most of them use tftp to upload the new image
into the device. After doing several of them I tried to figure out
how to write a small script to do the tftp uploads. The steps are
as follows
kp4djt@kp4djt64:~$ tftp 192.168.1.1
tftp> bin    (set binary transfer)
tftp> trace on   (set trace on)
Packet tracing on.    (response)
tftp> put /tftp/file.bin   (file to send to device)

At this point it will either start showing blocks being
sent or will time out
I would like to write a script that just runs that, I would
have 2 versions one for devices which default to 192.168.1.1
and those who use .1.20, then it runs and all I have to do
is either edit it and put the upload file in or have it stop
and I paste/type the file name in and turn it loose.

Of course as soon as you invoke tftp it jumps into it's own
interface, I googled for writing scripts to control tftp, I saw
some that embed it in a bash script but appears that you
i have to make the tftp entries by hand with those scripts.

Anyone have any idea of how to write a script to invoke
tftp and insert commands to tftp?



I believe you want to explore the use of an "expect" script. This allows you to receive input from the system being connected to and acting when specific prompts are encountered.

It's been two decades since I have messed with this language, but I am certain that it will do what you want to accomplish, even if not a simple task to learn.

dafr

Reply via email to