ports and /var/db/pkg
Peter Pentchev
roam at ringlet.net
Fri Apr 4 05:16:14 PST 2003
On Fri, Apr 04, 2003 at 02:11:58PM +0300, Danny Braniss wrote:
>
> > > ok, so i wrote a small script (tcl, since i don't know perl), that
> > > does some checking, it reports for each package, the number of files
> > > how many are realy there, and if so, checks the MD5.
> > >
> > > now, if im not to far off, if some/all files are missing, or if the
> > > md5 does not match, i should be able to remove the package info, ...
> >
> > Well, that's not what you were asking for originally, and tools
> > already exist to check that.
>
> OK, let me refrase it
>
> PROBLEM:
> how to update /var/db/pkg, when it knows too much,
> i.e. /usr/local has less stuff that /var/db/pkg knows about.
>
> >
> > e.g. pkg_info -g and the example from the pkg_which(1) manpage that I
> > mentioned to you in a previous email.
>
> i read most of the pkg*, and though im very impressed, i fail to find a
> clear/easy way to get a one line output saying:
> pkg xyz no longer exits, can be removed from database
If you are only interested in packages which no longer have *any* files
on the filesystem, then compare the output of the following two
commands:
pkg_info -qL package | wc -l
pkg_info -qg package | wc -l
If the output of those two commands is the same, then there are no valid
package files left at all, and a pkg_delete -f is in order.
Moreover, if you are only interested in the existence of the files, it
would be easier to do something like:
remove=1
pkg_info -qL package | while read fname; do
[ -f "$fname" ] && remove=0
done
if [ $remove == "1" ]; then pkg_delete package; fi
G'luck,
Peter
--
Peter Pentchev roam at ringlet.net roam at sbnd.net roam at FreeBSD.org
PGP key: http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553
"yields falsehood, when appended to its quotation." yields falsehood, when appended to its quotation.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20030404/121fc85d/attachment.bin
More information about the freebsd-hackers
mailing list