I have gotten the system to create an image modified to what I need, however I have been unable to figure out how / where to clean the apt/cache folders and purge, prior to creating the IMG zip file. I'd like the equivalent of :
sudo apt clean
sudo apt autoclean
sudo apt autoremove -y
Then have the system create the IMG.zip file in deploy.
Google gives me a few sites that have enabled me to copy script files, set crontab, enable ssh, enable wifi, etc., but not clean up all the post install files, which are quite substantial.
Thoughts, or search pointers?
-
- Posts: 12
- Joined: Fri Sep 14, 2018 3:46 pm
Re: Raspbian & pi-gen
I would add a section at the last stage you run (which one that is depends of course on which image you want to create).
So you could e.g. add directory '01-cleanup' to stage5.
Then add script '00-run.sh' to that directory and use that to run your cleanup actions.
So you could e.g. add directory '01-cleanup' to stage5.
Then add script '00-run.sh' to that directory and use that to run your cleanup actions.
-
- Posts: 12
- Joined: Fri Sep 14, 2018 3:46 pm
Re: Raspbian & pi-gen
Do I simply run a rm -rf on the folders, or can I actually run the apt clean, autoclean, autoremove -y comands?
Re: Raspbian & pi-gen
My preferred method would be to use the normal commands.kevin.shumaker wrote: ↑Mon Sep 17, 2018 2:21 amDo I simply run a rm -rf on the folders, or can I actually run the apt clean, autoclean, autoremove -y comands?
BTW: I doubt if you need them all. AFACT autoremove would only be useful if you actually uninstall / purge packages during image creation.
-
- Raspberry Pi Engineer & Forum Moderator
- Posts: 6291
- Joined: Fri Jul 29, 2011 5:36 pm
- Location: The unfashionable end of the western spiral arm of the Galaxy
Re: Raspbian & pi-gen
That kind of stuff is already a part of the image export process:
https://github.com/RPi-Distro/pi-gen/bl ... /01-run.sh
https://github.com/RPi-Distro/pi-gen/bl ... /01-run.sh
https://github.com/RPi-Distro/pi-gen/bl ... /01-run.sh
https://github.com/RPi-Distro/pi-gen/bl ... /01-run.sh
-
- Posts: 12
- Joined: Fri Sep 14, 2018 3:46 pm
Re: Raspbian & pi-gen
Thanks, it is working as expected now. I appreciate the assistance!