Date: Sun, 13 Apr 2008 23:01:36 +0200 From: Mel <fbsd.questions@rachie.is-a-geek.net> To: freebsd-questions@freebsd.org Cc: Aijaz Baig <aijaz.abaig@gmail.com>, leslie@eskk.nu Subject: Re: Pkg_info corrupt for some packages Message-ID: <200804132301.38567.fbsd.questions@rachie.is-a-geek.net> In-Reply-To: <101a1afc0804130241p2cae4475qc072ac2b5a4f5aa2@mail.gmail.com> References: <101a1afc0804110732u8b2a16k24caa639258e7f42@mail.gmail.com> <200804112204.04948.fbsd.questions@rachie.is-a-geek.net> <101a1afc0804130241p2cae4475qc072ac2b5a4f5aa2@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200804132301.38567.fbsd.questions>