Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: luci-mod-system: Allow selective file restore from backups #7322

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

systemcrash
Copy link
Contributor

@systemcrash systemcrash commented Oct 10, 2024

This is useful when you're importing backups intended for different hardware, for example, where e.g. /etc/config/[network|wireless] are not suitable for the target platform, but everything else useful.

Current iteration caveats: subsequent extraction and compression steps happen on the target device, to then feed the selective_backup archive to sysupgrade. ( It's not impossible that a users /etc/sysupgrade.conf that created the original backup stashed gigs of stuff in there... but this is an extreme and unlikely edge case, in which case they're better off using just the original restore ).

Next version avoids this once openwrt/openwrt#16656 is merged

Feedback welcome.

The backup restore overview
Screenshot 2024-10-11 at 01 04 21

the selective dialogue
Screenshot 2024-10-11 at 01 21 16

In case nothing was chosen
Screenshot 2024-10-11 at 01 10 57

  • This PR is not from my main or master branch 💩, but a separate branch ✅
  • Each commit has a valid ✒️ Signed-off-by: <my@email.address> row (via git commit --signoff)
  • Each commit and PR title has a valid 📝 <package name>: title first line subject for packages
  • Tested on: 23.05.5
  • ( Preferred ) Mention: @jow- @Ansuel @hnyman
  • ( Preferred ) Screenshot or mp4 of changes:
  • Description: (describe the changes proposed in this PR)

@systemcrash
Copy link
Contributor Author

Better might be to simply amend the sysupgrade script to ingest the -T /tmp/filelist.txt and do a selective extraction from there, obviating the need for the two decompress/compress steps.

This is useful when you're importing backups intended for different
hardware, for example, where e.g. `/etc/config/[network|wireless]` are
not suitable for the target platform, but everything else useful.

Caveats: subsequent extraction and compression steps happen on the
target device, to then feed the selective_backup archive to sysupgrade.

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
@dannil
Copy link
Contributor

dannil commented Oct 17, 2024

I really like this idea. I assume you're waiting atm if openwrt/openwrt#16656 gets merged and if it does rewrite it to use the sysupgrade command instead of creating a new tarball?

@systemcrash
Copy link
Contributor Author

systemcrash commented Oct 17, 2024

Exactly that. I have a rewrite in my local repo. It avoids all the pitfalls and the change delta is way smaller. sysupgrade is basically a big fat front-end script to tar.

@systemcrash
Copy link
Contributor Author

If you like it, just jam a thumbs up on the other PR and make some noise there. It might not be the ideal way to do it, but it's the cleanest for this purpose. The busybox tar doesn't have many options to work with, so providing individual filenames at the command prompt isn't there yet, I think.

@systemcrash systemcrash added the depends on PR in other repo PR depends on PR in sister repo e.g. openwrt/packags label Oct 17, 2024
@systemcrash
Copy link
Contributor Author

Real case in the wild

@systemcrash
Copy link
Contributor Author

Note to self: convenience button for selection to exclude wireless and network from a foreign device backup.

@hnyman
Copy link
Contributor

hnyman commented Nov 23, 2024

convenience button for selection to exclude wireless and network

...and system
Almost as dangerous, at least the LED config etc.

All other config files that e.g. affect VPN, DNS can be difficult too, as the lan/wan port names in uci config may be quite different.

The selective restore from another device can be rather challenging.

@hnyman
Copy link
Contributor

hnyman commented Nov 23, 2024

I feel that more useful than "partial restore into the actual config" could be an easy "restore as reference material to /etc/oldconfig" or something similar. So that some SSH console diff/cp/mv work would be needed, but getting the files to the file system would be easy (and safe).

@systemcrash
Copy link
Contributor Author

I looked at that bit: luci loads every file in the /etc/config folder and differing files with synonymous entries would clash. So such a restore requires placement in a different folder. A bit more complicated.

@systemcrash
Copy link
Contributor Author

systemcrash commented Nov 23, 2024

@hnyman regarding LED config - what is your experience of things there? Potential of loading wrong kernel modules?

@hnyman
Copy link
Contributor

hnyman commented Nov 23, 2024

Not that dangerous, but network and usb LEDs might be defined wrongly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
depends on PR in other repo PR depends on PR in sister repo e.g. openwrt/packags
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants