LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Tool/script to gather info about installed files in system. (http://www.linuxquestions.org/questions/slackware-14/tool-script-to-gather-info-about-installed-files-in-system-4175443956/)

FeyFre 01-03-2013 07:17 AM

Tool/script to gather info about installed files in system.
 
Hi

I need tool which list me files installed using Slackware native package manager.

Of course I can run
removepkg -warn /var/log/packages/* >/tmp/files
but it will work approximately infinitely.
Is there any existing one?

vulcan59 01-03-2013 07:22 AM

pkgtool has an option to view files contained in a package. Otherwise just list the contents of the files in /var/log/packages.

FeyFre 01-03-2013 08:02 AM

@vulcan59
1. pkgtool show content of ONE package, I need content of ALL packages.
2. It shows full content of file(s) in /var/log/packages, I need only file list only, w/o headers.
> Otherwise just list the contents of the files in /var/log/packages
As I already said, those files contain not only file list but package metadata also. I need file list only, excluding "./".

Alien Bob 01-03-2013 08:29 AM

You can get a sorted overview of all files mentioned in /var/log/packages using this command:
Code:

(for III in `ls /var/log/packages` ; do sed '1,/^.\//d' /var/log/packages/$III ; done ) | sort
But remember, the files in /install are not copied into the computer's filesystem, they are used by pkgtools. Also several packages have a "incoming" directory or *.new files which are handled by a doinst.sh script so that the files will end up in different locations of your filesystem than you might think if you look at the package content.

Basically you need to tell us why you want this before we can give you a useful answer. Also, you might put your brain to work and come up with a command yourself which does what you want.

Eric

NonNonBa 01-03-2013 08:38 AM

Hello,

This should do what you barely want:

Code:

awk '(f != FILENAME){pr=0;f=FILENAME}($0 =="./"){pr++;next}(pr>0){print}' /var/log/packages/*
And this variant ensures each file is printed only once:

Code:

awk '(f != FILENAME){pr=0;f=FILENAME}($0 =="./"){pr++;next}(pr>0 && !($0 in OK)){print;OK[$0]}' /var/log/packages/*
EDIT Oops... too late.

FeyFre 01-03-2013 10:41 AM

@Alien Bob
> But remember
I do remember all of /install, .new and incomming

> Basically you need to tell us why you want this before we can give you a useful answer.
Because my FS has a lot of garbage. I.e. packages installed not using pkgtool and some very stupid software which does not cares anything. Then I shall compare this list with content of my FS and annihilate garbage.

> Also, you might put your brain to work and come up with a command yourself which does what you want.
I have already wrote C program which creates such list. Can share. But I wonder if there is any existing tool(as I explicitly wrote in first message).

Woodsman 01-03-2013 02:10 PM

slackpkg has a "clean" option that will list all non stock Slackware packages. You could compare that list with the contents of /var/log/packages. Yet that option will not disclose all software that was installed. That option will only disclose which non stock Slackware packages have been installed. Using the "clean" option presumes having used the package manager.

Discovering software that was installed without using the package manager is challenging. For this same reason, recently I posted a query about a build script to wrap around the virtualbox run scripts. The point is not so much the dependability or trustworthiness of non package install scripts, but that knowing what was installed becomes a mess.

Possibly a script could query the contents of all bin directories and then grep /var/log/packages for those files. The difference would provide some clue about what was installed without the package manager. Unfortunately, some packages don't install bin files, such as perl add-ons.

Or a script that listed all files on a system and compared that list to the contents of all /var/log/packagges files. The difference would provide some clue of what was installed without the package manager.

Another possible option would be to install a stock Slackware system in a second real or virtual machine and then compare the contents of the two systems.

Currently there is no native Slackware tool or script to perform this task. :(

FeyFre 01-03-2013 05:34 PM

Quote:

Or a script that listed all files on a system and compared that list to the contents of all /var/log/packagges files. The difference would provide some clue of what was installed without the package manager.
That is exactly what I doing now. I have result of "find /"(about 70MiB file list) and result of tool I seeking here(around 12MiB file list). Filtered both(or rather latest one) of well know garbage containers(/tmp,/var/log,/var/tmp,/root,/home,/var/cache etc) and doing "diff -u3" against them. As result I have .diff file every line insertion(+) of which show me not-controlled filesystem entries - my goal.

ruario 01-04-2013 03:02 AM

Quote:

Originally Posted by FeyFre (Post 4862178)
> Basically you need to tell us why you want this before we can give you a useful answer.
Because my FS has a lot of garbage. I.e. packages installed not using pkgtool and some very stupid software which does not cares anything. Then I shall compare this list with content of my FS and annihilate garbage.

> Also, you might put your brain to work and come up with a command yourself which does what you want.
I have already wrote C program which creates such list. Can share. But I wonder if there is any existing tool(as I explicitly wrote in first message).

Well if you used a tracking tool (like slacktrack, paco, src2pkg, etc.) whenever you install non Slackware packages it would be fairly easy.

FeyFre 01-04-2013 03:43 AM

@ruario, I already asked somewhere here about tracking tool. Unfortunately none of proposed solutions works for my cases.
And second, tracking tool probably suitable solution when installing software, but it is impossible to use it when software runs and leaves garbage.


All times are GMT -5. The time now is 09:04 AM.