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

Add support for persistent Linux config files #35

Merged
merged 5 commits into from
Jul 25, 2023

Conversation

wizzomafizzo
Copy link
Contributor

This is a proof of concept as discussed. I've been pretty liberal adding TODO comments that would need to be clarified before it's considered.

The basic idea is:

  • User keeps a copy of certain config files they have customised in the linux folder on the SD card
  • During linux update, downloader checks if these files exist
  • If they exist, after the linux.img file has been copied over and update is finalised, mount the .img and copy the user files into it

Simple enough.

I've picked out these files:

  • /etc/hostname
  • /etc/hosts
  • /etc/network/interfaces
  • /etc/resolv.conf
  • /etc/dhcpd.conf
  • /etc/fstab

I think the risk here is very low, as it's purely opt in. There's a question of whether or not to handle official updates to these files. Notify the user? Attempt to merge? Ignore it? I'm leaning with ignore it personally, as the other options add a lot of complexity. I can't imagine these files will change much anyway.

I don't know how this change might affect your PC downloader app if at all.

@wizzomafizzo
Copy link
Contributor Author

Feedback is now incorporated. I'll give it a spin tomorrow and make sure it actually works :)

@wizzomafizzo wizzomafizzo marked this pull request as ready for review July 6, 2023 00:55
@theypsilon
Copy link
Member

@wizzomafizzo I've tested your changes, and everything worked as expected!

I'd want to introduce a small change on top of this. I think is a bit more safe mounting the Linux image when it's at /media/fat/linux.update/files/linux/linux.img and aborting the linux update altogether if there was any error on the _restore_user_files while using the linux.update folder (_restore_user_files now should return a bool for checking this). What do you think?

@wizzomafizzo
Copy link
Contributor Author

I'd want to introduce a small change on top of this. I think is a bit more safe mounting the Linux image when it's at /media/fat/linux.update/files/linux/linux.img and aborting the linux update altogether if there was any error on the _restore_user_files while using the linux.update folder (_restore_user_files now should return a bool for checking this). What do you think?

Makes sense to me, I agree. Do you think the method should be called just before the "Hold your breath" print?

@theypsilon
Copy link
Member

Yes, right there, it's the best place.

@wizzomafizzo
Copy link
Contributor Author

I haven't tested yet but I think that should do it :)

Seems pretty tight to me now. Every step of the process is error checked and aborts the process now except creating the temp dir which I assume will make the mount fail anyway.

@theypsilon theypsilon merged commit 2c1511b into MiSTer-devel:main Jul 25, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants