|
|
b7b189 |
#!/bin/bash
|
|
|
b7b189 |
#
|
|
|
b9c2cc |
# cli_getFilesList.sh -- This function outputs the list of files to
|
|
|
b7b189 |
# process.
|
|
|
b7b189 |
#
|
|
|
3b0984 |
# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG
|
|
|
fa95b1 |
#
|
|
|
fa95b1 |
# This program is free software; you can redistribute it and/or modify
|
|
|
fa95b1 |
|
|
|
dcd347 |
|
|
|
dcd347 |
|
|
|
fa95b1 |
#
|
|
|
74a058 |
|
|
|
74a058 |
|
|
|
b7b189 |
|
|
|
b7b189 |
# General Public License for more details.
|
|
|
b7b189 |
#
|
|
|
b7b189 |
|
|
|
b7b189 |
# along with this program; if not, write to the Free Software
|
|
|
dcd347 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
7ac5a5 |
#
|
|
|
b7b189 |
# ----------------------------------------------------------------------
|
|
|
b7b189 |
# $Id$
|
|
|
b7b189 |
# ----------------------------------------------------------------------
|
|
|
b7b189 |
|
|
|
b7b189 |
function cli_getFilesList {
|
|
|
b7b189 |
|
|
|
384196 |
|
|
|
384196 |
local ARGSS=''
|
|
|
8eeb3a |
|
|
|
384196 |
|
|
|
762c10 |
local ARGSL='pattern:,mindepth:,maxdepth:,type:,uid:'
|
|
|
384196 |
|
|
|
384196 |
|
|
|
384196 |
|
|
|
384196 |
local ARGUMENTS=''
|
|
|
384196 |
|
|
|
384196 |
|
|
|
384196 |
local PATTERN="$FLAG_FILTER"
|
|
|
384196 |
|
|
|
384196 |
|
|
|
384196 |
local OPTIONS=''
|
|
|
384196 |
|
|
|
384196 |
|
|
|
793c4c |
cli_parseArgumentsReDef "$@"
|
|
|
384196 |
|
|
|
384196 |
|
|
|
793c4c |
cli_parseArguments
|
|
|
384196 |
|
|
|
384196 |
|
|
|
384196 |
eval set -- "$ARGUMENTS"
|
|
|
384196 |
|
|
|
384196 |
while true;do
|
|
|
384196 |
case "$1" in
|
|
|
384196 |
|
|
|
384196 |
|
|
|
384196 |
PATTERN="$2"
|
|
|
384196 |
shift 2
|
|
|
384196 |
|
|
|
384196 |
|
|
|
384196 |
|
|
|
384196 |
OPTIONS="$OPTIONS -maxdepth $2"
|
|
|
384196 |
shift 2
|
|
|
384196 |
|
|
|
384196 |
|
|
|
762c10 |
|
|
|
762c10 |
OPTIONS="$OPTIONS -mindepth $2"
|
|
|
762c10 |
shift 2
|
|
|
762c10 |
|
|
|
762c10 |
|
|
|
b83a96 |
--type )
|
|
|
b83a96 |
OPTIONS="$OPTIONS -type $2"
|
|
|
b83a96 |
shift 2
|
|
|
b83a96 |
|
|
|
b83a96 |
|
|
|
6eba8c |
|
|
|
6eba8c |
OPTIONS="$OPTIONS -uid $2"
|
|
|
6eba8c |
shift 2
|
|
|
6eba8c |
|
|
|
6eba8c |
|
|
|
384196 |
|
|
|
384196 |
shift 1
|
|
|
384196 |
break
|
|
|
384196 |
|
|
|
384196 |
esac
|
|
|
384196 |
done
|
|
|
384196 |
|
|
|
384196 |
# At this point all options arguments have been processed and
|
|
|
384196 |
|
|
|
384196 |
|
|
|
384196 |
|
|
|
384196 |
local LOCATIONS="$@"
|
|
|
384196 |
|
|
|
62fd79 |
|
|
|
62fd79 |
cli_checkFiles ${LOCATIONS}
|
|
|
f5c4be |
|
|
|
384196 |
|
|
|
f5c4be |
|
|
|
f5c4be |
|
|
|
4a9a32 |
|
|
|
f5c4be |
|
|
|
384196 |
|
|
|
f5c4be |
|
|
|
f5c4be |
|
|
|
385cc4 |
|
|
|
385cc4 |
|
|
|
385cc4 |
|
|
|
385cc4 |
|
|
|
762c10 |
PATTERN="^.*(/)?${PATTERN}$"
|
|
|
8eeb3a |
|
|
|
385cc4 |
# Define list of files to process. At this point we cannot verify
|
|
|
385cc4 |
|
|
|
385cc4 |
|
|
|
385cc4 |
# verifying exit status and go on.
|
|
|
b9c2cc |
find ${LOCATIONS} -regextype posix-egrep ${OPTIONS} -regex "${PATTERN}" | sort | uniq
|
|
|
b7b189 |
|
|
|
b7b189 |
}
|