pimod icon indicating copy to clipboard operation
pimod copied to clipboard

Feat: A `SHRINK` command

Open she11sh0cked opened this issue 2 years ago • 2 comments

SHRINK [SIZE]

SHRINK decreases the size of the image to the minimum possible. Optionally, you can specify the amount to decrease (suffixes K, M, G are allowed).

Example:

PUMP 10G # Increase the size of the image by 10G
[...] # Do some stuff
SHRINK # Decrease the size of the image to the minimum possible

she11sh0cked avatar May 10 '22 09:05 she11sh0cked

Isn't there already PiShrink to do exactly this job? It is currently even linked in pimod's README.

I would see the benefit of including PiShrink into pimod as a SHRINK command which reduces the size to the minimum. However, I don't see any advantage of letting the user specify the size to be shrinked.

If you, or anyone else, wants to address this in a Pull Request, I'd be happy to merge it. Currently I don't have the time to do this by myself.

oxzi avatar May 10 '22 22:05 oxzi

It looks like this feature request is mostly a matter of making it more convenient to use pishrink's functionality in workflows involving Pimod. I'm building custom Raspberry Pi OS images exclusively in CI, and I found this feature request while exploring my options for running pishrink more easily on GitHub Actions, since I was using Pimod anyways. To simplify that use-case in a way that was easy for me to implement, I've now made a GitHub action (ethanjli/pishrink-action) which is a slightly-nicer wrapper around pishrink.sh, e.g. as in this example for running pishrink on the output of Pimod: https://github.com/ethanjli/pishrink-action?tab=readme-ov-file#pimod-usage-example .

(At least for now I'm not the right person to make a PR to add a SHRINK command, because I'm currently not relying on Pimod for my projects: my projects need to build images which require a fully-booted OS because the setup process involves doing some stuff with the Docker daemon in the image, and it was simpler for me to just use a combination of systemd-nspawn for unbooted setup steps with a QEMU VM for booted setup steps. Regardless, I think Pimod is really cool, and if/when I do use Pimod for another project then I will think about PR'ing a SHRINK command!)

ethanjli avatar May 28 '24 00:05 ethanjli