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 better detection of existing /etc/rc.local changes #258

Open
Drewsif opened this issue Feb 14, 2023 · 1 comment
Open

Add better detection of existing /etc/rc.local changes #258

Drewsif opened this issue Feb 14, 2023 · 1 comment

Comments

@Drewsif
Copy link
Owner

Drewsif commented Feb 14, 2023

Currently PiShrink uses md5sum to detect if we have already changed /etc/rc.local. This is extremely fragile and not the best choice.

The new method should:

  1. Allow for the expansion script to be edited without having to update anything else in the script.
  2. Detect if a PiShrink expansion script is already present in the image and overwrite it with it's own version.
    • In this case the backup made of /etc/rc.local should not be touched

My initial idea for a new method is to put a unique string into the expansion script which we key on.

@Sniffleupagus
Copy link

Sniffleupagus commented Oct 25, 2023

How about "if /etc/rc.local.bak already exists, don't overwrite it". Overwrite rc.local all you want, but keep the original backup to be eventually restored. that's what I did to keep a multistage build (where I use a shrunken image as the input to the next phase, then shrink again) from ending up with an rc.local-loop. It works in my case because I know pishrink is the only thing messing with /etc/rc.local.

When would you have a case where you edit the expansion script and need to retain those changes? Why not just put them in the backup, which gets run at the end of the expansion?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants