kevin.shumaker
Posts: 12
Joined: Fri Sep 14, 2018 3:46 pm

Raspbian & pi-gen

Mon Sep 17, 2018 12:51 am

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?

DirkS
Posts: 10602
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Raspbian & pi-gen

Mon Sep 17, 2018 1:14 am

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.

kevin.shumaker
Posts: 12
Joined: Fri Sep 14, 2018 3:46 pm

Re: Raspbian & pi-gen

Mon Sep 17, 2018 2:21 am

Do I simply run a rm -rf on the folders, or can I actually run the apt clean, autoclean, autoremove -y comands?

DirkS
Posts: 10602
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Raspbian & pi-gen

Mon Sep 17, 2018 8:40 am

kevin.shumaker wrote:
Mon Sep 17, 2018 2:21 am
Do I simply run a rm -rf on the folders, or can I actually run the apt clean, autoclean, autoremove -y comands?
My preferred method would be to use the normal commands.
BTW: I doubt if you need them all. AFACT autoremove would only be useful if you actually uninstall / purge packages during image creation.

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
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

Mon Sep 17, 2018 8:54 am


kevin.shumaker
Posts: 12
Joined: Fri Sep 14, 2018 3:46 pm

Re: Raspbian & pi-gen

Tue Sep 18, 2018 2:44 am

Thanks, it is working as expected now. I appreciate the assistance!

Return to “Raspberry Pi OS”