From owner-freebsd-questions@FreeBSD.ORG Mon Apr 14 20:47:02 2008 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 82469106568E for ; Mon, 14 Apr 2008 20:47:02 +0000 (UTC) (envelope-from aijaz.abaig@gmail.com) Received: from wf-out-1314.google.com (wf-out-1314.google.com [209.85.200.172]) by mx1.freebsd.org (Postfix) with ESMTP id 471CF8FC1F for ; Mon, 14 Apr 2008 20:47:02 +0000 (UTC) (envelope-from aijaz.abaig@gmail.com) Received: by wf-out-1314.google.com with SMTP id 25so1733628wfa.7 for ; Mon, 14 Apr 2008 13:47:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; bh=cxiQOktHsEXgcvxwsIBF4HL3BMlqrM+PjKaJr/CLKM4=; b=SKqeHqtjwab4y+BENF0MMCgs9cdqwz8wN1+4Hci6AfM4FxzjXhl8E3mjWrjzQgbWdOXiWCiWQ3zdUMomzDZr5u33t9H4FUNZDa75Z3zBjaH16kgArGYBfc0F3EcYz9s3gGD56Wl/RrBNg//g9JNLYkVU4BjFHiacIF6VjKXeBJg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=UtGw5fVu/g+gHf8CtHbOqh3g8Hub/GxjxE6Nwk54q5x6UOB/cFxkFbBjN1ESvqlOSWfzo68S6jJO6SGWCcTmD2f0fiQtQthsWwoYHTMUvPYZ5s1+IjRw1aY1uE6yWvYjnqJQoLGa7fLUiRZGHTvHbTdmzO1rKFTTM88HiLPMRn0= Received: by 10.142.11.2 with SMTP id 2mr1103437wfk.297.1208206021581; Mon, 14 Apr 2008 13:47:01 -0700 (PDT) Received: by 10.142.230.7 with HTTP; Mon, 14 Apr 2008 13:47:01 -0700 (PDT) Message-ID: <101a1afc0804141347y4e980688vcabf57dd3df70c8b@mail.gmail.com> Date: Mon, 14 Apr 2008 22:47:01 +0200 From: "Aijaz Baig" To: Mel In-Reply-To: <200804132301.38567.fbsd.questions@rachie.is-a-geek.net> MIME-Version: 1.0 References: <101a1afc0804110732u8b2a16k24caa639258e7f42@mail.gmail.com> <200804112204.04948.fbsd.questions@rachie.is-a-geek.net> <101a1afc0804130241p2cae4475qc072ac2b5a4f5aa2@mail.gmail.com> <200804132301.38567.fbsd.questions@rachie.is-a-geek.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-questions@freebsd.org, leslie@eskk.nu Subject: Re: Pkg_info corrupt for some packages 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: Mon, 14 Apr 2008 20:47:02 -0000 Hello, I tried running the script suggested by mel and after that I was able to see that some of those packages got registered as installed. However some of the packages were not being found and as an example I saw the following: Restoring doodle-0.6.6_1 Failed: cannot find doodle-0.6.6_1 in /usr/ports/INDEX-7* *Then as suggested by andrew I tried to see just how many packages have been messed and to my shock the figure for the first command was 336 and for the second command was 326. Well...how do I 'extract the port origins' from pkgdb.db?I am sorry if I sound naive but im a bit new to freebsd. Hope to hear from you guys, On Sun, Apr 13, 2008 at 11:01 PM, Mel wrote: > On Sunday 13 April 2008 11:41:19 Aijaz Baig wrote: > > Hi, > > > > Well...I tried to cut and paste the command as is by mel (though It > would > > have been better if you explained what that cryptic looking command > > actually meant) and I got the followinfg output: > > > > 'grep: /var/db/pkg/xorg-server-1.4_4,1/+CONTENTS: No such file or > directory > > Well, that explaines it right there. It wasn't installed properly, because > every installed port should have a +CONTENTS file. > You can grab the files from 'pkgdb.db' like Andrew suggested, but I > personally > wouldn't trust those if portupgrade was the one that did this in the first > place. > This is where daily backups rock :). > > If your /usr/ports/INDEX-6 (or -7) is in sync with your installed > packages, > then maybe the following script will work. It worked for me testing it, > but I > can't guarentee it will work in all cases. > > If you're on FreeBSD 6, change INDEXFILE to /usr/ports/INDEX-6. Rest > should > work without changes. > > #!/bin/sh > > > INDEXFILE='/usr/ports/INDEX-7' > for dir in /var/db/pkg/*; do > if test ! -e ${dir}/+CONTENTS -a -d ${dir}; then > pkgname=${dir##*pkg/} > echo "Restoring ${pkgname}" > IDX=$(grep "^${pkgname}|" ${INDEXFILE} 2>/dev/null) > if test -z "${IDX}"; then > echo "Failed: cannot find ${pkgname} in ${INDEXFILE}" > else > _origin=${IDX#*|} > origin=${_origin%%|*} > echo "---> ${origin}" > cd ${origin} > mv ${dir} /tmp/ > make -DFORCE_PKG_REGISTER generate-plist fake-pkg > for file in /tmp/${pkgname}/*; do > f=${file##*/} > if test ! -f ${dir}/${f}; then > echo "--> Restoring ${pkgname}/${f}" > mv ${file} ${dir}/ > fi > done > fi > fi > done > > > -- > Mel > > Problem with today's modular software: they start with the modules > and never get to the software part. >