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

Mel fbsd.questions at rachie.is-a-geek.net
Thu Oct 11 15:29:27 PDT 2007

On Thursday 11 October 2007 23:29:05 James wrote:

> 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.

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

# ls /tmp/var/db/pkg/bash-3.2.25/
+CONTENTS       +DESC           +MTREE_DIRS

It's missing +REQUIRED_BY and @pkgdep lines in +CONTENTS, but haven't been 
able to figure out yet why that is.
I hope this gets you a bit closer.

More information about the freebsd-questions mailing list