PDA

View Full Version : Finding unmanaged files


Hornpipe2
November 24th, 2009, 02:03
Is there a way I can get a list of all files NOT currently managed by ports/packages? I installed some stuff from source tarball but later found there are ports versions, but I want to audit my system first to delete anything that's not currently managed.

renice
November 24th, 2009, 07:10
Try pkg_cutleaves(1)
# pkg_cutleaves -l

SirDice
November 24th, 2009, 08:40
The only way to do it would be to do a pkg_info -W on every file in /usr/local/bin (that's assuming the source installed it there).

jb_fvwm2
November 24th, 2009, 11:33
pkg_info -cIx a*
Un-newly-tested! but I've run that command...
probably once for each letter in
/usr/local/bin and
/usr/local/lib...
(That command or similar)
I had files from 2004 sitting around still in 2008...
/edit/
OR, similar to a post below, it was pkg_which... something...

frank_s
November 25th, 2009, 16:57
Not a direct answer to your question but sometimes the Makefile of your tarball will have an uninstall option. So you can go to the dir of the unpacked tarball with the Makefile in it and:

make uninstall

This will then delete anything installed during the "make install".

If you've installed the same softs from ports afterwards, then you have to be careful that it doesn't wipe out your binaries etc. which were installed by the port.

In that case just rebuild the port after the "make uninstall".

expl
November 25th, 2009, 17:09
find /usr/local /usr/X11R6 -type f | xargs pkg_which -v | fgrep '?'

Works the best.

SirDice
November 25th, 2009, 17:50
Not a direct answer to your question but sometimes the Makefile of your tarball will have an uninstall option. So you can go to the dir of the unpacked tarball with the Makefile in it and:

make uninstall

This will then delete anything installed during the "make install".
Not if you updated your ports tree in the mean time ;)

The new version of the port might have different files or they're stored in different locations. The best way to remove installed ports is to use pkg_delete or pkg_deinstall (part of portupgrade).

If you've installed the same softs from ports afterwards, then you have to be careful that it doesn't wipe out your binaries etc. which were installed by the port.
pkg_delete will complain if another port/package depends on the package you're trying to remove.

frank_s
November 26th, 2009, 16:16
The new version of the port might have different files or they're stored in different locations. The best way to remove installed ports is to use pkg_delete or pkg_deinstall (part of portupgrade).

I was talking about the files which he installed from a tarball not a port.

paulbeard
January 1st, 2011, 19:54
find /usr/local /usr/X11R6 -type f | xargs pkg_which -v | fgrep '?'

Works the best.

This looks to be doing what I just started a thread about ;-) Now: do I just delete those files or troll through every pkg-plist to see if they are mentioned there? It's almost 25k filenames (!).

It looks like it's missing files with embedded spaces so I amended it thusly:

find /usr/local /usr/X11R6 -type f | xargs -J% pkg_which -v "%" | fgrep '?' > /tmp/unmanaged