I performed an rm -r on /var/lib/pkg

James jamesh at lanl.gov
Thu Oct 11 15:38:54 PDT 2007

On Thu, 2007-10-11 at 18:14 -0400, Robert Huff wrote:

> James writes:
> >  What has happened, though, is I've never ran rm in
> >  /usr/ports/distfiles.  I'm going to think for a little bit about
> >  a script that can move through /usr/ports/distfiles and reinstall
> >  everything that exists there.
> 	Having been in almost the identical situation for different
> rasons, I sympathize.
> 	Yes, this will involve a sweep through /usr/ports distfiles.
> If you haven't ever deleted anything, I suggest a prelimiary manual
> run deleting everything but the most recent version.  This has a
> down-side, but it will prevent cluttering the rebuilt system with
> unused ports.

/usr/ports/distfiles is definitely looking promising. awk is too damn
painful to work with, so I'm going to dust off my perl skills.

Hell, this could actually turn out to be fun. And if I write the script
properly, it might make a nice disaster recovery tool
for /usr/ports/ports-mgmt - it can be called

Well, if you figure out what ports you have installed, you can
regenerate the 

> pkgdb using:
> make -DNO_BUILD -DNO_INSTALL generate-plist fake-pkg
> for each port.
> I just tested that using a temporary PKG_DBDIR. In case you wanna see what 
> happens, here's what I did:
> mkdir -p /tmp/var/db/pkg
> cd /usr/ports/shells/bash
> env PKG_DBDIR=/tmp/var/db/pkg make -DNO_BUILD -DNO_INSTALL \
> 	generate-plist fake-pkg

Wow, that's great! I understand that it has the caveats that you mentioned, but it's
*at least* a fantastic start. 


More information about the freebsd-questions mailing list