diff options
author | Victor Hsieh <victorhsieh@chromium.org> | 2020-07-28 10:31:22 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-07-29 22:13:07 +0000 |
commit | 699189d29bd5385ee36621940c9256f8921e31f4 (patch) | |
tree | f1ac1a89fe4eaa53e1fff49611c7d4548d8e596f /scripts | |
parent | 640d0cb5b1e0a95b0a723c27f6b73638df5feddb (diff) | |
download | vboot-699189d29bd5385ee36621940c9256f8921e31f4.tar.gz |
sign_android_image: use ARCVM file context if needed
Apparently the file android_file_contexts has a different name for ARCVM
with _vm suffix. Choose _vm if the container one is not found.
BUG=b:161828692
TEST=sign_official_build.sh base recovery_image.bin mykey signed.bin
BRANCH=none
Signed-off-by: Victor Hsieh <victorhsieh@chromium.org>
Change-Id: I8a93d8e1dd5b824f319d7de804f8f74825166a97
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2323647
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/image_signing/sign_android_image.sh | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/scripts/image_signing/sign_android_image.sh b/scripts/image_signing/sign_android_image.sh index 2558a980..c1f7c76b 100755 --- a/scripts/image_signing/sign_android_image.sh +++ b/scripts/image_signing/sign_android_image.sh @@ -206,9 +206,16 @@ reapply_file_security_context() { info "Reapplying file security context" - sudo /sbin/setfiles -v -r "${system_mnt}" \ - "${root_fs_dir}/etc/selinux/arc/contexts/files/android_file_contexts" \ - "${system_mnt}" + local selinux_dir="${root_fs_dir}/etc/selinux" + local file_contexts="${selinux_dir}/arc/contexts/files/android_file_contexts" + if [[ ! -f "${file_contexts}" ]]; then + file_contexts="${file_contexts}_vm" + if [[ ! -f "${file_contexts}" ]]; then + die "Can't find Android's file contexts" + fi + fi + + sudo /sbin/setfiles -v -r "${system_mnt}" "${file_contexts}" "${system_mnt}" } # Snapshot file properties in a directory recursively. |