howto list all non-rpm installed files on system
Steve Siegfried
sos at zjod.net
Sat Apr 12 20:57:39 UTC 2008
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.
>
More information about the fedora-list
mailing list