extract-utils: Ensure that install_symlink names are always unique

Since the logic only takes into account the filename without extension,
it may happen that multiple files end up having the same BASENAME and
SYMLINK_BASENAME, meaning duplicate install_symlink names and then
causing Soong to fail.

Make the name unique by appending the number of times that PKGNAME
is found.

Example:

 vendor/etc/wifi/bdwlan.e30;SYMLINK=vendor/firmware/kiwi/bdwlan.e30
 vendor/etc/wifi/bdwlan.e31;SYMLINK=vendor/firmware/kiwi/bdwlan.e31

Resulting diff:

install_symlink {
       name: "bdwlan_bdwlan_symlink64",
       soc_specific: true,
       installed_location: "firmware/kiwi/bdwlan.e30",
       symlink_target: "/vendor/etc/wifi/bdwlan.e30",
}

install_symlink {
-       name: "bdwlan_bdwlan_symlink64",
+       name: "bdwlan_bdwlan_symlink64_1",
       soc_specific: true,
       installed_location: "firmware/kiwi/bdwlan.e31",
       symlink_target: "/vendor/etc/wifi/bdwlan.e31",
}

Change-Id: Ie9b196e164d89eed16d20b8a9b68f2a6329d5605
diff --git a/extract_utils.sh b/extract_utils.sh
index 42844d4..7f6e1f2 100644
--- a/extract_utils.sh
+++ b/extract_utils.sh
@@ -965,7 +965,10 @@
                 SYMLINKS=(${SYMLINKS//,/ })
                 for SYMLINK in "${SYMLINKS[@]}"; do
                     SYMLINK_BASENAME=$(basename "$SYMLINK")
-                    PKGNAME=${BASENAME%.*}_${SYMLINK_BASENAME%.*}_symlink${ARCH}
+                    PKGNAME="${BASENAME%.*}_${SYMLINK_BASENAME%.*}_symlink${ARCH}"
+                    if [[ "${SYMLINK_PACKAGES[@]}" =~ "$PKGNAME" ]]; then
+                        PKGNAME+="_$(grep -o "$PKGNAME" <<< ${SYMLINK_PACKAGES[*]} | wc -l)"
+                    fi
                     {
                         printf 'install_symlink {\n'
                         printf '\tname: "%s",\n' "$PKGNAME"