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

Joshua Isom jrisom at gmail.com
Fri Oct 12 01:32:36 PDT 2007


On Oct 11, 2007, at 5:39 PM, James wrote:

> 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
> "WhenYou'reAnIdiotLikeJamesWasOnFreeBSDQuestions"
>
>
>
> 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.
>
> James
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to 
> "freebsd-questions-unsubscribe at freebsd.org"
>

If you don't run 'make clean' then you can look for the 'work' 
directory to know if you've installed it or not.  But some of the port 
tools automatically run make clean for you so they would disappear.  A 
simple 'find /usr/ports -type d -name work' would probably work well 
enough unless you wanted it all automated.



More information about the freebsd-questions mailing list