Rename backup archive to be board specific?

When you are dealing with multiple devices and backup's it is a little confusing which one is from where, can we append the board name or some more unique name or something to differentiate them when creating a backup?

I just do it on the host end:

#!/bin/sh

routers="router1 router2 router3 router4"
stamp=$(date +'%FT%H%M')
for router in $routers; do
    ssh "$router" sysupgrade -b - > "backup-$router-$stamp.tgz"
done

Which produces

backup-router1-2024-06-02T1337.tgz
backup-router2-2024-06-02T1337.tgz
backup-router3-2024-06-02T1337.tgz
backup-router4-2024-06-02T1337.tgz

board name example:

. /lib/functions.sh

BOARDNAME=$(board_name)

The downloaded backup file name already includes the host name of the OpenWrt device:[1]

backup-<hostname>-<ISO date>.tar.gz

Go to System menu→System page in LuCI and change Hostname to something other than "OpenWrt". It will be reflected in the backup name and the backup contents.


  1. If you're curious where this is defined, it's in the main_backup function from the cgi-io package. ↩︎

2 Likes

Ok I did not know that was associated with the backup name that will be ok as a solution, but it would be nice if it was identifiable by something than a user set value.