read_bundle_plist.sh: allow read from plist files.
When given a path that looks like a plist file the script reads
from the plist file directly instead of assuming that
Contents/Info.plist must be appended to the path.
Change-Id: Ie6ec3a4f9d1a0b61e0958c5de272bdebca21b15d
diff --git a/installer/scripts/build/read_bundle_plist.sh b/installer/scripts/build/read_bundle_plist.sh
index bd3682f..9020fb9 100755
--- a/installer/scripts/build/read_bundle_plist.sh
+++ b/installer/scripts/build/read_bundle_plist.sh
@@ -22,8 +22,14 @@
read_bundle_info() {
local readonly NAME="$1"
+ [[ -n "${NAME}" ]] || die "missing command name in ${FUNCNAME}."
local readonly COMMAND="Print :CFBundle${NAME}"
- local readonly PLIST_PATH="${BUNDLE}/Contents/Info.plist"
+ # When |BUNDLE| file name is a plist file, just read from the plist file.
+ if [[ "$(basename "${BUNDLE}")" =~ \.plist$ ]]; then
+ local readonly PLIST_PATH="${BUNDLE}"
+ else
+ local readonly PLIST_PATH="${BUNDLE}/Contents/Info.plist"
+ fi
file_exists "${PLIST_PATH}" || die "${PLIST_PATH} does not exist."
${PLIST_BUDDY} -c "${COMMAND}" "${PLIST_PATH}"
}