From owner-freebsd-questions@FreeBSD.ORG Sat Aug 8 19:02:19 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E3D05106566B for ; Sat, 8 Aug 2009 19:02:19 +0000 (UTC) (envelope-from bf1783@googlemail.com) Received: from mail-ew0-f212.google.com (mail-ew0-f212.google.com [209.85.219.212]) by mx1.freebsd.org (Postfix) with ESMTP id 71FE98FC27 for ; Sat, 8 Aug 2009 19:02:19 +0000 (UTC) Received: by ewy8 with SMTP id 8so1700919ewy.36 for ; Sat, 08 Aug 2009 12:02:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=2hKHZ82AyfnqJkQUWNBnNqEz+7s4KZJe+64f5kFcHmg=; b=mPaVuO0cOa+OVhi5ZVRABWr29ttrmyBH5LeOaRLjL6pnMCSFzrs5mKG6mGuOHlLXEM lJ+d4bzRTYg4uOQv8xBCjZDxSadVaQp1t2XC8NsB6nAZ8fkfWfn72nVoFttp2hsfDUTi AoUKTqLghtUQ2BuHn+BJYVYqwuDP24rRS1Iqo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=lZthlM8iasxmTZRk+peVbmiarfBifz9vo6rvffOyDOLbaNtXk8qhm1WP7CwJWNy/HS If0b4HT8KwQ3Hx1u98L/P6SfmqMvmoq5PJTnd9c+hYJLg6bRMjxk8RJ0JlBi2zdn7fAt e0g5IJOzAZD1hoIqoLymukQDj7fWqXpnWl4To= MIME-Version: 1.0 Received: by 10.216.93.141 with SMTP id l13mr492193wef.67.1249758137626; Sat, 08 Aug 2009 12:02:17 -0700 (PDT) In-Reply-To: <200908080932.27489.mel.flynn+fbsd.questions@mailing.thruhere.net> References: <200908080932.27489.mel.flynn+fbsd.questions@mailing.thruhere.net> Date: Sat, 8 Aug 2009 19:02:17 +0000 Message-ID: From: "b. f." To: Mel Flynn Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Volodymyr Kostyrko , freebsd-questions@freebsd.org Subject: Re: Recovering loss of /var/db/pkg ? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Aug 2009 19:02:20 -0000 On 8/8/09, Mel Flynn 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.