Script scp from folder to file script


I'm using a script to sysupgrade my build and I wondered if it would be possible to have another script to copy the image sysupgrade to that script or something like that?
here what I have:

  • the last sysupgrade in my buildroot folder / /run/media/james/D/WRT_build/master/bin/targets/mvebu/cortexa9/wrt3200acm-squashfs-sysupgrade.bin

and my script to sysupgrade is :

# master linksys_wrt3200acm
scp -O /james/D/WRT_build/master/bin/targets/mvebu/cortexa9/wrt3200acm-squashfs-sysupgrade.bin root@
# ssh cd/ tmp & upgrade
ssh root@ "cd /tmp; sysupgrade -v /tmp/*.bin"

I think that way it is impossible but maybe another option?


I would say to use cp

cp -v /james/D/WRT_build/master/bin/targets/mvebu/cortexa9/*bin /to somewhere

You are building on your computer, not via online imagebuilder, right? Then you are able to change the versioning of the file and create a script that chooses the sysupgrade file with the highest available version to copy to your device and execute it.

After using make menuconfig you'll find an entry seperate/custom version configuration (not at my laptop atm, don't have the exact wording memorized) which you can enable and then customize. You can end up with something like JamesOpenWrt-*-sysupgrade.bin


make menuconfig or nconfig/Image configuration/Version configuration options

1 Like

I know but how to enable automatic sysupgrade from my buildroot bin folder? Is it what you are talking about?


Sorry - BF.

You need to generate an ssh key pair on your build host and router to use SCP in a script. ssh-keygen.

1 Like

Yes, that's the options. So you mean an automation after image build has finished? I don't know about that. You would need a script running parallel to build process that checks the folder every X minutes - like a cronjob.

I don't see the use case though. Because usually you "attend" build process and check folder once it has finished, which is when you can execute scp-script manually, or, if you build when away from PC, you would still want to be around when sysupgrade gets executed in case of failure/issues after reboot, right?