Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Fedora User (http://www.linux-archive.org/fedora-user/)
-   -   howto list all non-rpm installed files on system (http://www.linux-archive.org/fedora-user/68547-howto-list-all-non-rpm-installed-files-system.html)

David Timms 04-12-2008 06:58 AM

howto list all non-rpm installed files on system
 
Anybody got some good ideas for listing every file on disk that is:
1. modified from default rpm install {eg config files}
2. not installed by any rpm
3. is a config file for a service - eg. web server /etc/httpd/conf.d/
and so on

4. is user data, config, files.
?

The purpose is to determine, say before an upgrade, what files need to
be backed up.


locate / will give me all files on disk.
rpm -qfa will list all files installed by rpm
rpm -Va will tell files changed from what rpm installed.

Is there a tool that combines the above already ?

DaveT.

--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list

Frank Cox 04-12-2008 07:04 AM

howto list all non-rpm installed files on system
 
On Sat, 12 Apr 2008 16:58:19 +1000
David Timms <dtimms@iinet.net.au> wrote:

> Is there a tool that combines the above already ?

uniq

--
MELVILLE THEATRE ~ Melville Sask ~ http://www.melvilletheatre.com

--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list

"Patrick O'Callaghan" 04-12-2008 02:33 PM

howto list all non-rpm installed files on system
 
On Sat, 2008-04-12 at 01:04 -0600, Frank Cox wrote:
> On Sat, 12 Apr 2008 16:58:19 +1000
> David Timms <dtimms@iinet.net.au> wrote:
>
> > Is there a tool that combines the above already ?
>
> uniq

Huh?

poc

--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list

Frank Cox 04-12-2008 05:27 PM

howto list all non-rpm installed files on system
 
On Sat, 12 Apr 2008 10:03:34 -0430
"Patrick O'Callaghan" <pocallaghan@gmail.com> wrote:

>
> On Sat, 2008-04-12 at 01:04 -0600, Frank Cox wrote:
> > On Sat, 12 Apr 2008 16:58:19 +1000
> > David Timms <dtimms@iinet.net.au> wrote:
> >
> > > Is there a tool that combines the above already ?
> >
> > uniq
>
> Huh?

Combine and sort the text files, then use uniq to show you the lines that you're
interested in.

--
MELVILLE THEATRE ~ Melville Sask ~ http://www.melvilletheatre.com

--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list

04-12-2008 08:57 PM

howto list all non-rpm installed files on system
 
You probably need a script for this... at least I do.
> #!/bin/ksh
>
> DOIT()
> {
> START=`date "+%d%b%y @ %T"`
> echo "### RPM status started on $START, output file = $FN"
> echo "+ rpm -qa > /root/RPM-qa"
> rpm -qa > /root/RPM-qa
> echo "+ sort < /root/RPM-qa > /root/RPM-qa.sorted"
> sort < /root/RPM-qa > /root/RPM-qa.sorted
> echo "+ cat /root/RPM-qa.sorted | xargs -l1 rpm -qi | grep "^Name :" | awk '{ print $3 }' > /root/RPM-qa.sorted.basenames"
> cat /root/RPM-qa.sorted | xargs -l1 rpm -qi | grep "^Name :" | awk '{ print $3 }' > /root/RPM-qa.sorted.basenames
> echo "+ uniq < /root/RPM-qa.sorted.basenames > RPM-qa.sorted.basenames.uniq"
> uniq < /root/RPM-qa.sorted.basenames > RPM-qa.sorted.basenames.uniq
> echo "+ diff /root/RPM-qa.sorted.basenames RPM-qa.sorted.basenames.uniq"
> diff /root/RPM-qa.sorted.basenames RPM-qa.sorted.basenames.uniq
> echo
> echo
> echo "### Verifying individual packages:"
>
> for i in `cat /root/RPM-qa.sorted`
> do
> j=`echo $i | xargs -l1 rpm -qi | grep "^Name :" | awk '{ print $3 }'`
> echo "+ rpm -V $j # ($i)"
> rpm -V $j
> done
> echo
> echo
> echo "### Non-RPM files:"
> OF=`mktemp /tmp/list.XXXXXX`
>
> echo "+ rpm -qal | sort | uniq > $OF.rpm"
> rpm -qal | sort | uniq > $OF.rpm
>> echo "+ find / -print | sort > $OF.find"
>> find / -print | sort > $OF.find
> echo "+ diff $OF.rpm $OF.find | grep '^>' "
> diff $OF.rpm $OF.find | grep '^>'
> rm $OF.rpm $OF.find $OF
>
> END=`date "+%d%b%y @ %T"`
> echo "### DONE: RPM status started on $START, finished on $END, output file = $FN"
> }
>
> # MAIN Main main
>
> FN=/root/CHECK_rpm-V/CHECK_rpm-V.`date '+%d%b%y'`
> if [ -f $FN ]
> then FN=$FN.`date '+%H:%M'`
> fi
> export FN
>
>
> DOIT | tee $FN
> exit 0

Note that you may want to rewrite the 2 lines prefixed with ">>" to be something more like:
>> echo "+ find / -print | egrep -v '^/dev|^/home|^/proc|^/sys|^/tmp' | sort > $OF.find"
>> find / -print | egrep -v '^/dev|^/home|^/proc|^/sys|^/tmp' | sort > $OF.find
depending on your needs.

And yeah... it'll take a while to run, too.

Hope this helps,

-S

David Timms wrote:
>
> Anybody got some good ideas for listing every file on disk that is:
> 1. modified from default rpm install {eg config files}
> 2. not installed by any rpm
> 3. is a config file for a service - eg. web server /etc/httpd/conf.d/
> and so on
> 4. is user data, config, files.
> ?
>
> The purpose is to determine, say before an upgrade, what files need to
> be backed up.
>
> locate / will give me all files on disk.
> rpm -qfa will list all files installed by rpm
> rpm -Va will tell files changed from what rpm installed.
>
> Is there a tool that combines the above already ?
>
> DaveT.
>

--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list

"Dave Burns" 04-12-2008 09:25 PM

howto list all non-rpm installed files on system
 
Here's a bash one-liner that outputs the filename of every file on /
not part of an rpm. There may be more directories that should be
excluded or filetypes that should be included, depending on what is in
your setup and what you really want to find.

find / -type f -print|grep -v '^/proc/' |while read file; do rpm -qf
"$file" >/dev/null || echo "$file"; done

Dave

On Sat, Apr 12, 2008 at 10:57 AM, Steve Siegfried <sos@zjod.net> wrote:
>
> You probably need a script for this... at least I do.
> > #!/bin/ksh
> >
> > DOIT()
> > {
> > START=`date "+%d%b%y @ %T"`
> > echo "### RPM status started on $START, output file = $FN"
> > echo "+ rpm -qa > /root/RPM-qa"
> > rpm -qa > /root/RPM-qa
> > echo "+ sort < /root/RPM-qa > /root/RPM-qa.sorted"
> > sort < /root/RPM-qa > /root/RPM-qa.sorted
> > echo "+ cat /root/RPM-qa.sorted | xargs -l1 rpm -qi | grep "^Name :" | awk '{ print $3 }' > /root/RPM-qa.sorted.basenames"
> > cat /root/RPM-qa.sorted | xargs -l1 rpm -qi | grep "^Name :" | awk '{ print $3 }' > /root/RPM-qa.sorted.basenames
> > echo "+ uniq < /root/RPM-qa.sorted.basenames > RPM-qa.sorted.basenames.uniq"
> > uniq < /root/RPM-qa.sorted.basenames > RPM-qa.sorted.basenames.uniq
> > echo "+ diff /root/RPM-qa.sorted.basenames RPM-qa.sorted.basenames.uniq"
> > diff /root/RPM-qa.sorted.basenames RPM-qa.sorted.basenames.uniq
> > echo
> > echo
> > echo "### Verifying individual packages:"
> >
> > for i in `cat /root/RPM-qa.sorted`
> > do
> > j=`echo $i | xargs -l1 rpm -qi | grep "^Name :" | awk '{ print $3 }'`
> > echo "+ rpm -V $j # ($i)"
> > rpm -V $j
> > done
> > echo
> > echo
> > echo "### Non-RPM files:"
> > OF=`mktemp /tmp/list.XXXXXX`
> >
> > echo "+ rpm -qal | sort | uniq > $OF.rpm"
> > rpm -qal | sort | uniq > $OF.rpm
> >> echo "+ find / -print | sort > $OF.find"
> >> find / -print | sort > $OF.find
> > echo "+ diff $OF.rpm $OF.find | grep '^>' "
> > diff $OF.rpm $OF.find | grep '^>'
> > rm $OF.rpm $OF.find $OF
> >
> > END=`date "+%d%b%y @ %T"`
> > echo "### DONE: RPM status started on $START, finished on $END, output file = $FN"
> > }
> >
> > # MAIN Main main
> >
> > FN=/root/CHECK_rpm-V/CHECK_rpm-V.`date '+%d%b%y'`
> > if [ -f $FN ]
> > then FN=$FN.`date '+%H:%M'`
> > fi
> > export FN
> >
> >
> > DOIT | tee $FN
> > exit 0
>
> Note that you may want to rewrite the 2 lines prefixed with ">>" to be something more like:
> >> echo "+ find / -print | egrep -v '^/dev|^/home|^/proc|^/sys|^/tmp' | sort > $OF.find"
> >> find / -print | egrep -v '^/dev|^/home|^/proc|^/sys|^/tmp' | sort > $OF.find
> depending on your needs.
>
> And yeah... it'll take a while to run, too.
>
> Hope this helps,
>
> -S
>
> David Timms wrote:
> >
> > Anybody got some good ideas for listing every file on disk that is:
> > 1. modified from default rpm install {eg config files}
> > 2. not installed by any rpm
> > 3. is a config file for a service - eg. web server /etc/httpd/conf.d/
> > and so on
> > 4. is user data, config, files.
> > ?
> >
> > The purpose is to determine, say before an upgrade, what files need to
> > be backed up.
> >
> > locate / will give me all files on disk.
> > rpm -qfa will list all files installed by rpm
> > rpm -Va will tell files changed from what rpm installed.
> >
> > Is there a tool that combines the above already ?
> >
> > DaveT.
> >
>
> --
> fedora-list mailing list
> fedora-list@redhat.com
> To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
>

--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list

"Dave Burns" 04-14-2008 02:35 AM

howto list all non-rpm installed files on system
 
On Sun, Apr 13, 2008 at 7:42 AM, Steve Siegfried <sos@zjod.net> wrote:
>
> Yeah, one-liners can be nice. However, assuming you've got 37,000 files on your
> system (which isn't really an unreasonable assumption), then your one-liner ends
> up exec'ing rpm 37,000 times. Even if most of the rpm invocations come from disk
> cache (and on a "quiet" production system, they will), the pace will be glacial.

It will be slow no matter what. If the purpose is to back up
useful/modified files, rather than trying to track down suspicious
files, you could speed it up by narrowing the range of the find, maybe
just /etc (maybe also exclude /etc/init.d). Of course, then you might
miss some config file from some rpm the doesn't keep config info in
/etc.

> Note also that your one-liner doesn't satisfy condition 1, either.
> David Timms wrote:
> > Anybody got some good ideas for listing every file on disk that is:
> > 1. modified from default rpm install {eg config files}

rpm -qaVV

> > 2. not installed by any rpm

find <disk> -type f -print|grep -v '^/proc/' |while read file; do rpm -qf
"$file" >/dev/null || echo "$file"; done


> 3. is a config file for a service - eg. web server /etc/httpd/conf.d/
> and so on
> 4. is user data, config, files.

3 & 4 seem redundant or I just don't understand what OP wants. That
is, config files and user files will either not be delivered as part
of an rpm or will have been modified from the rpm version, or will be
the default rpm version. Non-rpm files and modified rpm files files
will show up with the two above commands. Don't think OP really cares
about config files that have not been modified. I suppose a package
could change so that the default was no good, but OP could just
download the old package and extract the old config, no need for a
backup at least in principle.

Quick & dirty - just back up all of /etc. I do have a nagging
suspicion that some packages might try to put some config info in /usr
or /var. But it isn't very fedora-ish, I am probably thinking of some
app I had to compile from source.

Dave

--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list


All times are GMT. The time now is 10:22 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.