Re: How to reinstall *ALL* pkgs

From: Edward Sanford Sutton, III <mirror176_at_hotmail.com>
Date: Tue, 17 Oct 2023 23:11:46 UTC
On 10/17/23 09:01, Dave Cottlehuber wrote:
> On Tue, 17 Oct 2023, at 04:14, paul beard wrote:
>> I have done something like this…
>> ls /var/db/pkg/ | sed -r 's/(.*)-[0-9]/\1\ /g' | cut -f1 -d" "
>>
>> and pass that to pkg or to a file to clean it up (the sqlite databases
>> are in there and don't need installing via pkg).
> 
> I use this to track only the leaf packages, what's explicitly been installed
> and the others will be pulled in automatically.
> 
> NB make sure you're in the root /bin/sh & a console, not an (x)term
> as this will remove *all* packages, including xorg window manager,
> preferred shell etc.
> 
> # pkg prime-origins | sort | uniq > /etc/packages.lst
> ### edit and amend as required

   For that list, removals should be only removing packages you no 
longer want or are no longer offered. Additions would be to add packages 
you want to guarantee you keep installed even if dependent packages no 
longer automatically pull it in.

   `pkg query -e '%a = 0' %o` is the more complete "I installed this" 
list and will maximize features like `pkg autoremove` until doing an 
uninstall/reinstall from *origins types of lists where that is no longer 
guaranteed true and requires manually modifying the automatic flag on 
each package back to what you want to represent packages you desired are 
guaranteed installed vs only included if needed as a dependency.

> ### force-delete all existing packages, rebootstrap & install
> # pkg delete -fy \*
> # pkg bootstrap -f
> # pkg install -r FreeBSD `cat /etc/packages.lst`
> 
> A+
> Dave
>