Recovering loss of /var/db/pkg ?

b. f. bf1783 at googlemail.com
Sat Aug 8 19:02:20 UTC 2009


On 8/8/09, Mel Flynn <mel.flynn+fbsd.questions at mailing.thruhere.net> wrote:
> On Saturday 08 August 2009 03:02:05 b. f. wrote:
>
>> 2) write a script to get the names of all files that belonged to ports
>> and swing through a ports tree, associating the files with ports via
>> the pkg-plist and PLIST_FILES variables; or
>
> This is quite complex, time consuming and prone to error the more ports tree
> and installed ports are out of sync. Either way, you will want to compare
> files against the generate-plist target (and the resulting contents of
> $TMPPLIST), as more and more ports use dynamic package list features.

Yes, but then I was supposing that a complete reconstruction wasn't
necessary -- just a listing of the majority of the ports, or at least
the majority of the leaf ports.  And grep is usually faster than many
invocations of make.

There are other shortcuts: if /var/db/ports is intact, you can look at
the ports that you've had to config -- this will account for the
majority of the larger, more complex ports at the
top of the tree, with many dependencies, and so will cheaply give you
many of your ports.   Also don't forget your file database!   'locate
/var/db/pkg' could give you many of your ports, if things haven't
changed too much since the last time you updated your database, and
the database is intact.


>
> To prevent this from happening in the future, I've written a small periodic
> script that you can put in /usr/local/etc/periodic/daily and backs up the
> list
> of origins of installed ports.
>

Could come in handy.  I usually keep a listing of 'portmaster -l' and
a compressed backup /var/db/ports in a safe place.

 b.


More information about the freebsd-questions mailing list