PiShrink
PiShrink copied to clipboard
-c option to clean up image before shrinking
The -c option is intended to remove private information as well as cached data from the image. It's intended to be used when using the image on a different pi or when distributing the image.
Doesn't the regenerate_ssh_host_keys.service file already exist on the system? Couldn't you use it instead?
It exists after installation but is deleted once it has been run to prevent it from running again. Thus i don't need any extra magic to run my script. Once i restore it it's run automatically by the system on next boot.
My system still has the script under /lib/systemd/system/ even though it was run already.
When I enable it with systemctl, Raspbian creates a symbolic link to /etc/systemd/system/multi-user.target.wants/. After the script ran, it calls systemctl disable to delete the symlink, but the script remains on disk.
Hmm. Maybe that changed one day. If it was the link that was missing then my approach wouldn't work at all. Bit it did ... so i guess i should check for the script and the link and should restore whatever is missing.
Just to add my two cents, I just verified that the regenerate_ssh_host_keys.service does not exist on the Raspbian 10 (buster). So, this would be a nice addition to the script. :)
I would like to see this option!
Im going to consider this out of scope. Any attempts to clean up images has resulted in unintended errors for users. See #256 for more details