PiShrink icon indicating copy to clipboard operation
PiShrink copied to clipboard

-c option to clean up image before shrinking

Open harbaum opened this issue 7 years ago • 6 comments

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.

harbaum avatar Feb 12 '18 09:02 harbaum

Doesn't the regenerate_ssh_host_keys.service file already exist on the system? Couldn't you use it instead?

dalmago avatar Jul 17 '18 13:07 dalmago

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.

harbaum avatar Jul 17 '18 13:07 harbaum

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.

dalmago avatar Jul 17 '18 14:07 dalmago

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.

harbaum avatar Jul 17 '18 16:07 harbaum

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. :)

graywolf336 avatar Aug 12 '19 23:08 graywolf336

I would like to see this option!

kindofausername avatar Aug 25 '19 14:08 kindofausername

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

Drewsif avatar Feb 14 '23 07:02 Drewsif