A script fo finding orphan files

Moritz Heiber moe at lunar-linux.org
Tue Oct 10 10:48:03 UTC 2006


Hey,

I haven't read your script .. just stating the obvious here: Did you
try 'lvu alien' yet?

Otherwise, if your script gathers more thorough information or is in
any way more effective then 'lvu alien' you might want to look at the
code and try to improve it there :-)

Thank you for your suggestion!

Regards,

Moritz

On Tue, 10 Oct 2006 02:39:17 -0700 (PDT)
Edd Budulea <e_timotei at yahoo.com> wrote:

> Hi, I like to keep my computer clean and inevitable
> after some time I'll end up with files (apps) that
> don't belong to any module. After 2 manual attempts of
> finding these files I've ended up with this script
> that maybe some others will find it useful.
> It will make a list of all files that are belonging to
> modules, then it will find all files that are on hdd
> in applications' root directory (it will filter out
> /home /tmp /mnt and others that are not a target of
> any lunar module) and make a diff in order to make a
> file with all the files that are not in a module.
> ======= cut here =======
> #!/bin/sh
> if [[ "" == "$1" ]] ; then
>     echo -e "Usage\n\t$0 {Output file}"
>     exit 1
> fi
> 
> INSTMOD=`mktemp`
> : > $INSTMOD
> echo Gathering the files that are installed by
> lunar...
> LIMIT=`lvu installed | wc -l`
> CURSOR=0
> for nene in `lvu installed | sed -e "s/:.*//"` ; do
>     lvu install $nene >> $INSTMOD
>     ((VAL=$CURSOR / $LIMIT))
>     echo -ne "\r$VAL%"
>     ((CURSOR=$CURSOR + 100))
> done
> NOTOR=`mktemp`
> sort -u $INSTMOD > $NOTOR
> echo -e "\r100%.DONE..."
> echo Gathering the files that are in app\'s root
> directories...
> : > $INSTMOD
> for nene in `sed -e "s#\(/[^/]*\).*#\1#" $NOTOR | sort
> -u` ; do
>     echo Processing "$nene" ...
>     find "$nene" -type f >> $INSTMOD
> done
> EXIST=`mktemp`
> sort -u $INSTMOD > $EXIST
> echo "DONE..."
> echo "Making differences"
> diff $NOTOR $EXIST --new-line-format="%L"
> --old-line-format="" --unchanged-line-format="" | grep
> -vE
> "^((/usr/src/)|(/var/(log|cache|spool)/)|(/var/.*/lunar/))"
> > "$1"
> #mv $NOTOR "$1".notor
> #mv $EXIST "$1".exist
> rm -f $NOTOR
> rm -f $EXIST
> rm -f $INSTMOD
> =======cut here=======
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> _______________________________________________
> Lunar mailing list
> Lunar at lunar-linux.org
> http://foo-projects.org/mailman/listinfo/lunar


More information about the Lunar mailing list