How about this findaufs.sh?
    -- If you like it, you are welcome to use it.

#!/bin/bash
if [ "$1" == "" ] || [ "$1" == "-h" ] || [ "$1" == "-?" ]; then
  echo Usage: $0 "'*find-file/dirname*' '*grep-path/filter*'"
  echo "Sample exact pathfilename match: "$0" 'xorg.conf' '/etc/X11/'"
  echo "Sample fuzzy pathfilename match: "$0" 'xorg.conf' '*/etc/X11/'"
  echo "Sample wildcard match "$0" '*xorg.conf'"
  exit
fi
FINDTXT=$1
GREPTXT=$2
AUFS=aufs
AUFSTMP=/tmp/$AUFSmnt.tmp
cat /proc/mounts | grep $AUFS > $AUFSTMP
CTR=2
while [ $CTR -lt 256 ]; do 
  LN=`cat $AUFSTMP | cut -d : -f $CTR | cut -d = -f 1`
  if [ "$LN" != "" ]; then
      find $LN/ -name $FINDTXT | while read FND; do
        FNDLN=${FND//$LN}
        if [ "$GREPTXT" == "" ]; then
          echo $LN:$FNDLN
        else
          FNDGR=${FNDLN//$GREPTXT}
          if [ "$FNDGR" == "$FINDTXT" ]; then
            echo $LN:$FNDLN
          fi
        fi  
      done
  fi    
  let CTR+=1
done


On Thursday 04 December 2008 03:54:18 pm Chuck Smith wrote:
> oops, I missed sending Kernel John the previous message directly
>
> here is an findaufs.sh script that seems to be a good start for my aufs
> implementation
> #!/bin/bash
> echo Usage: $0 "'*filename*' '*path*'"
> FINDTXT=$1
> PATHTXT=$2
> AUFS=aufs
> AUFSTMP=/tmp/$AUFSmnt.tmp
> cat /proc/mounts | grep $AUFS > $AUFSTMP
> CTR=2
> while [ $CTR -lt 256 ]; do
>   LN=`cat $AUFSTMP | cut -d : -f $CTR | cut -d = -f 1`
>   if [ "$LN" != "" ]; then
>     if [ "$PATHTXT" == "" ]; then
>       find $LN/ -name $FINDTXT
>     else
>       find $LN/ -name $FINDTXT | grep $PATHTXT
>     fi
>   fi
>   let CTR+=1
> done
>
> On Thursday 04 December 2008 02:59:00 pm Chuck Smith wrote:
> > > so if /mnt/aufs has
> > > aufsbranch1
> > > aufsbranch2
> > > realdirectory1
> > > realdirectory2
> >
> > I am speculating on the unknown still ... do you think the relative
> > output of your /proc/mounts might be helpful for me and others to
> > understand the problem?
> >
> > On Thursday 04 December 2008 09:52:21 am Chuck Smith wrote:
> > > > You don't get the problem here.
> > >
> > >   --- Probably :)
> > >
> > > My experience is only of situations where there might be 4 duplicate
> > > files in different aufs branches, so I find all 4, then review the aufs
> > > mount sequence and finally review the aufs r/w branch  (in case it has
> > > been updated unexpectedly).
> > >
> > > so if /mnt/aufs has
> > > aufsbranch1
> > > aufsbranch2
> > > realdirectory1
> > > realdirectory2
> > >
> > > This is an issue with your implementation, as I suspect many keep the
> > > aufs branches in their own path (/mnt/aufs without real directories)
> > >
> > > What I might understand is that xorg.conf is a file I want to find, and
> > > it exists 12 times in 96 branches of over 640,000 files yet there are
> > > only 4 exact filenames with the complete path of /etc/X11/xorg.conf
> > > that create a conflict I need to resolve.
> > >
> > > So the "useful tool" must identify
> > > - aufs branch
> > > - aufs load sequence
> > > - file path
> > > - file name
> > >
> > > It takes 4 seconds on my system to issue this find command
> > > find /mnt/aufs -name 'xorg.conf' | grep '/etc/X11/xorg.conf'
> > >
> > > Note I do NOT search the / root path where a file will exist both in
> > > the aufs root overlay and the /mnt/aufs branches .. that would take
> > > hours!
> > >
> > > What did I miss in understanding the problem and the frequency of it's
> > > challenge?
> > >
> > > On Thursday 04 December 2008 08:38:16 am Kernel John wrote:
> > > > 2008/11/25 Chuck Smith <[EMAIL PROTECTED]>
> > > >
> > > > > I have 96 mounted aufs squashfs modules having more than 640,000
> > > > > files, and I
> > > > > find files searching this location using this method ... it is not
> > > > > time intensive at all as it is in memory.
> > > >
> > > > You don't get the problem here. I don't want to search /mnt/aufs. I
> > > > want to search all modules for a file which is placed (by aufs) in
> > > > /mnt/aufs.
> > > >
> > > > Best,
> > > > John
> > >
> > > -----------------------------------------------------------------------
> > >-- This SF.Net email is sponsored by the Moblin Your Move Developer's
> > > challenge Build the coolest Linux based applications with Moblin SDK &
> > > win great prizes Grand prize is a trip for two to an Open Source event
> > > anywhere in the world
> > > http://moblin-contest.org/redirect.php?banner_id=100&url=/
> >
> > -------------------------------------------------------------------------
> >-- --- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas,
> > Nevada. The future of the web can't happen without you.  Join us at MIX09
> > to help pave the way to the Next Web now. Learn more and register at
> > http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.c
> >om /
>
> ---------------------------------------------------------------------------
>--- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas,
> Nevada. The future of the web can't happen without you.  Join us at MIX09
> to help pave the way to the Next Web now. Learn more and register at
> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com
>/




------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/

Reply via email to