summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarfield Tan <xutan@google.com>2017-09-26 18:13:12 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-09-27 16:29:29 -0700
commitd4af2cdb1b714429ed6ecd6ca92ed80d255981b8 (patch)
treebb9317bae6f7fb9d493527c31423c307122ec4ca
parentcf81b101a14c7f26bba5f9f3cdab9d2a4ccb0c53 (diff)
downloadvboot-d4af2cdb1b714429ed6ecd6ca92ed80d255981b8.tar.gz
Use globbing to fetch mac_permissions.xml.
Android master puts that file at a different location, so use similar logic to official signing script. TEST="sign_android_image.sh passed locally for both caroline (NYC) & caroline-bertha (master)." BUG=b:65610114 BRANCH=none Change-Id: If33bfbcaa7e6cff95f26ff26a91735c87880f3db Reviewed-on: https://chromium-review.googlesource.com/686046 Commit-Ready: Garfield Tan <xutan@chromium.org> Tested-by: Garfield Tan <xutan@chromium.org> Reviewed-by: Victor Hsieh <victorhsieh@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
-rwxr-xr-xscripts/image_signing/sign_android_image.sh10
1 files changed, 9 insertions, 1 deletions
diff --git a/scripts/image_signing/sign_android_image.sh b/scripts/image_signing/sign_android_image.sh
index 92e4b65d..bf5098d0 100755
--- a/scripts/image_signing/sign_android_image.sh
+++ b/scripts/image_signing/sign_android_image.sh
@@ -136,8 +136,16 @@ update_sepolicy() {
die "Unable to get the public platform key"
fi
+ shopt -s nullglob
+ local xml_list=( "${system_mnt}"/system/etc/**/*mac_permissions.xml )
+ shopt -u nullglob
+ if [[ "${#xml_list[@]}" -ne 1 ]]; then
+ die "Unexpected number of *mac_permissions.xml: ${#xml_list[@]}\n \
+ ${xml_list[*]}"
+ fi
+
+ local xml="${xml_list[0]}"
local orig=$(make_temp_file)
- local xml="${system_mnt}/system/etc/security/mac_permissions.xml"
local pattern='(<signer signature=")\w+("><seinfo value="platform)'
cp "${xml}" "${orig}"
sudo sed -i -E "s/${pattern}/\1${new_cert}"'\2/g' "${xml}"