LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Best way to find programs not installed by a package manager (https://www.linuxquestions.org/questions/linux-software-2/best-way-to-find-programs-not-installed-by-a-package-manager-790036/)

pobman 02-18-2010 04:19 PM

Best way to find programs not installed by a package manager
 
Hi peeps,

I am trying to think of the best way to find packages that have been installed by NOT using a package manager.

To find installed packages one would search rpm or pkg DB, but what if the software was installed by a tarball or bin or even compilled.

Anyone got any suggestions on how to script for these, I was hopeing to write a script to find all the third party stuff, I iknow there will be a lot of stuff that gets picked up so what is the best way to get minimise false positves?

Any ideas welcome.

unSpawn 02-18-2010 05:23 PM

The real problem lies in "third party stuff" (which is kind of vague a definition), what the FSSTND / FHS / LSB suggests one should do and how a system is actually managed ("let's dump everything in /srv anyway"). For RH.*L and derivatives a 'find /path/ -type f -print0|xargs -0 -iX rpm -qf 'X' |awk '/not owned/ {print $2}';' could be a start, AFAIK that's 'dpkg -S' for Debian and derivatives. Systems where package management can't even list package contents will obviously s*ck major as you will have no basis to work from whatsoever.

CoderMan 02-18-2010 05:26 PM

Well, you can install slocate. With slocate, after installation you can run "updatedb", and then "locate <application name>".

mattca 02-18-2010 05:26 PM

I think if the software wasn't installed via some utility you have to keep track of it yourself. That's part of why people use package managers.

You could just look in your bin dirs and see what's there. Maybe grep -v it against output from your package manager to just see what wasn't installed via the manager.

[Edit: Also, yeah if you just want to find out if a certain package is installed (as opposed to getting a list of all packages that were installed without a manager) locate should do the trick]

repo 02-18-2010 05:35 PM

Slackware has
Quote:

src2pkg
which will create a package from the source file.
Then you can use the packagemanager to install.
Don't know for other distro's though

pobman 02-18-2010 08:50 PM

I know slocate and find quite well, and guessed I hoped for a solution that I may have overlooked.

The problem is I managee several linux servers, and wanted to be able to proivde lists of all the installed software, rpm -qa etc works well for software installed via an RPM but for those odd little besoke packages that some company 10 years ago provided a gz or even zip :( installer for gets left out, I hope most packages are instlled in the opt dir but you can never be sure.

I could check for files in /bin /sbin etc... and then find what proveds etc but it would take some time to run.

knudfl 02-19-2010 04:07 AM

For new "packages", suggest : use a tool like checkinstall
to create an rpm package.

For all programs available as an SRC RPM source, use rpmbuild.
That would be the most common 15,000 to 20,000 programs.
Or write your own spec file to be used by rpmbuild.
.....

cantab 02-19-2010 05:41 AM

In general, I guess best way is to make the package manager spit out a list of what it installed, compare that to a directory listing, and show what is in the latter but not the former.
You could do it for the obvious places (namely, the directories in root's $PATH ), or do it for everywhere. (Well, all of /bin, /lib, /sbin, /usr, /var, and /opt )

JimBrewster 02-19-2010 06:21 AM

Depending on how may packages you are dealing with, you could go back to a build tree and see where "make install" puts things.

I think this is why hand-compiled and installed packages usually default to /usr/local.


All times are GMT -5. The time now is 05:47 AM.