Charles Sprickman <sp...@bway.net> wrote:

> > On Aug 10, 2025, at 4:47 AM, Don Lewis <truck...@freebsd.org> wrote:
> > 
> > On  8 Aug, Jamie Landeg-Jones wrote:
> >> all the ports, and then BATCH rebuild them from a list of previously
> >> installed ports.
> >> 
> > 
> > It looks like you are making extra work for youself.  When you
> > "pkg delete -af", you are erasing all the data about which ports you
> > carefully chosen to install and whether they were manually our
> > automatically installed.  You need to record this info somewhere before
> > you "pkg delete".
>
> I don't think he stated that he doesn't have a list of ports/pkgs that are 
> wanted.

Yep! As I even wrote! :-) , I batch rebuild them from a list - rather, I have
a script that parses a pkg list, and creates a script to install the ports
fresh. (I build from ports not packages) The script does hard code a priority
install order of ports if necessary - i.e. on machines I use the ports version
of openssl, that's the port the script installs first. I think if openssh from
ports was installed, that is next, and a few other similar examples.

I don't do this process for all upgrades, just the times I want to do a
complete rebuild, usually after a major release upgrade.

After doing a pkg delete -af I then check /usr/local for orphaned files
etc. and make it clean before running the script.

The script first runs through all the ports to check for config option changes
(I still have the previous settings in /var/db/ports) and then when they are
done, it runs through the install in BATCH=YES mode.

> Deleting everything, and then just adding the 4 or 5 things you want (which 
> would end up with many more than 4-5 pkgs installed) is a pretty foolproof 
> way to clean up a bunch of cruft. Unless of course your base OS also goes 
> away. 

Exactly! After cleaning the system, before running the script, I prune the
list of ports I know I don't want, or are just dependencies. Any that are
only there as dependencies will get built again anyway. It's a nice, and
as you say, pretty foolproof way of cleaning things up. It's also quite
a fast operation - well, the actual ports install takes a while, but that
happens without me needing to be around.

Finally, any errors/failed installs are highlighted at the end of the script
for manual selection.

I like to use pkg delete -af because I want to catch orphaned files, but 
bluntly,
I could just save /usr/local/etc and nuke the rest of /usr/local and /var/db/pkg

Thanks for the reply, cheers, Jamie

>

Reply via email to