summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2011-06-23 12:04:45 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2011-06-23 12:04:45 +0200
commit8d3d601c4fc9bc99b6188bab028681c73c7a3807 (patch)
treed72c6c9dc262b4b8438c3b3fcfef2d47cea5f614
parent2339f066a071bc683f8683b634f8508a4ab054c4 (diff)
downloadbin-8d3d601c4fc9bc99b6188bab028681c73c7a3807.zip
bin-8d3d601c4fc9bc99b6188bab028681c73c7a3807.tar.gz
easy_e17.sh: rewrite find_local_path
-rwxr-xr-xeasy_e17.sh18
1 files changed, 3 insertions, 15 deletions
diff --git a/easy_e17.sh b/easy_e17.sh
index 72c8021..6334bf7 100755
--- a/easy_e17.sh
+++ b/easy_e17.sh
@@ -898,21 +898,9 @@ function run_command ()
function find_local_path ()
{
name=$1
- path=""
- for dir in `find "$src_path" -maxdepth 3 -type d -name "$name" | awk -F "$src_path" '{print $2}'`; do
- found=0
- for idir in $ignore_dirs; do
- topdir=`echo "$dir" | cut -d'/' -f1`
- if [ "$topdir" == "$idir" ]; then found=1; fi
- done
- if [ $found == 1 ]; then continue; fi
-
- if [ "${#dir}" -lt "${#path}" ] || [ -z "$path" ]; then
- path=$dir
- fi
- done
-
- if [ "$path" ]; then echo "$src_path/$path"; fi
+ path=$(find $src_path -maxdepth 5 -type d -name $pkg | grep -v -E "^${src_path}$" | grep -v -E '$ignore_dirs_re' | \
+ while read line; do echo `echo $line | wc -c` $line; done | sort -n | head -n 1 | cut -d " " -f 2)
+ if [ "$path" ]; then echo "$path"; fi
}
function compile ()