envsetup: Filter unique push paths in dopush
* Reverse the FILE and TARGET handling to sort
and filter unique paths to be pushed
* Resolves the 'mkap systemimage' where
/system/etc/nano/* symlinks were pushed
multiple times in loops
Change-Id: I178cec2e1708ad9239d9e544544fca157639e3b5
diff --git a/build/envsetup.sh b/build/envsetup.sh
index 3132a65..a2b668a 100644
--- a/build/envsetup.sh
+++ b/build/envsetup.sh
@@ -871,12 +871,12 @@
fi
stop_n_start=false
- for FILE in $(echo $LOC | tr " " "\n"); do
+ for TARGET in $(echo $LOC | tr " " "\n" | sed "s#.*$OUT##" | sort | uniq); do
# Make sure file is in $OUT/system or $OUT/data
- case $FILE in
- $OUT/system/*|$OUT/data/*)
- # Get target file name (i.e. /system/bin/adb)
- TARGET=$(echo $FILE | sed "s#$OUT##")
+ case $TARGET in
+ /system/*|/data/*)
+ # Get out file from target (i.e. /system/bin/adb)
+ FILE=$OUT$TARGET
;;
*) continue ;;
esac