Inseob Kim | d9fd42e | 2024-01-19 18:08:55 +0900 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # Copyright (C) 2023 The Android Open Source Project |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
| 17 | if [ $# -ne 2 ]; then |
| 18 | echo "Usage: $0 <top> <ver>" |
| 19 | exit 1 |
| 20 | fi |
| 21 | |
| 22 | top=$1 |
| 23 | ver=$2 |
| 24 | |
| 25 | mkdir -p "$top/system/sepolicy/prebuilts/api/${ver}/" |
| 26 | cp -r "$top/system/sepolicy/public/" "$top/system/sepolicy/prebuilts/api/${ver}/" |
| 27 | cp -r "$top/system/sepolicy/private/" "$top/system/sepolicy/prebuilts/api/${ver}/" |
| 28 | |
| 29 | cat > "$top/system/sepolicy/prebuilts/api/${ver}/Android.bp" <<EOF |
| 30 | // Automatically generated file, do not edit! |
| 31 | se_policy_conf { |
| 32 | name: "${ver}_plat_pub_policy.conf", |
Inseob Kim | 61036d9 | 2024-02-21 13:18:49 +0900 | [diff] [blame] | 33 | defaults: ["se_policy_conf_flags_defaults"], |
Inseob Kim | 6b1db84 | 2024-03-19 11:07:30 +0900 | [diff] [blame^] | 34 | srcs: [ |
| 35 | ":se_build_files{.plat_public_${ver}}", |
| 36 | ":se_build_files{.reqd_mask}", |
| 37 | ], |
Inseob Kim | d9fd42e | 2024-01-19 18:08:55 +0900 | [diff] [blame] | 38 | installable: false, |
| 39 | build_variant: "user", |
| 40 | } |
| 41 | |
| 42 | se_policy_cil { |
| 43 | name: "${ver}_plat_pub_policy.cil", |
| 44 | src: ":${ver}_plat_pub_policy.conf", |
| 45 | filter_out: [":reqd_policy_mask.cil"], |
| 46 | secilc_check: false, |
| 47 | installable: false, |
| 48 | } |
| 49 | |
| 50 | se_policy_conf { |
| 51 | name: "${ver}_product_pub_policy.conf", |
Inseob Kim | 61036d9 | 2024-02-21 13:18:49 +0900 | [diff] [blame] | 52 | defaults: ["se_policy_conf_flags_defaults"], |
Inseob Kim | d9fd42e | 2024-01-19 18:08:55 +0900 | [diff] [blame] | 53 | srcs: [ |
| 54 | ":se_build_files{.plat_public_${ver}}", |
| 55 | ":se_build_files{.system_ext_public_${ver}}", |
| 56 | ":se_build_files{.product_public_${ver}}", |
| 57 | ":se_build_files{.reqd_mask}", |
| 58 | ], |
| 59 | installable: false, |
| 60 | build_variant: "user", |
| 61 | } |
| 62 | |
| 63 | se_policy_cil { |
| 64 | name: "${ver}_product_pub_policy.cil", |
| 65 | src: ":${ver}_product_pub_policy.conf", |
| 66 | filter_out: [":reqd_policy_mask.cil"], |
| 67 | secilc_check: false, |
| 68 | installable: false, |
| 69 | } |
| 70 | |
| 71 | se_policy_conf { |
| 72 | name: "${ver}_plat_policy.conf", |
Inseob Kim | 61036d9 | 2024-02-21 13:18:49 +0900 | [diff] [blame] | 73 | defaults: ["se_policy_conf_flags_defaults"], |
Inseob Kim | d9fd42e | 2024-01-19 18:08:55 +0900 | [diff] [blame] | 74 | srcs: [ |
| 75 | ":se_build_files{.plat_public_${ver}}", |
| 76 | ":se_build_files{.plat_private_${ver}}", |
| 77 | ":se_build_files{.system_ext_public_${ver}}", |
| 78 | ":se_build_files{.system_ext_private_${ver}}", |
| 79 | ":se_build_files{.product_public_${ver}}", |
| 80 | ":se_build_files{.product_private_${ver}}", |
| 81 | ], |
| 82 | installable: false, |
| 83 | build_variant: "user", |
| 84 | } |
| 85 | |
| 86 | se_policy_cil { |
| 87 | name: "${ver}_plat_policy.cil", |
| 88 | src: ":${ver}_plat_policy.conf", |
| 89 | additional_cil_files: [":sepolicy_technical_debt{.plat_private_${ver}}"], |
| 90 | installable: false, |
| 91 | } |
| 92 | |
| 93 | se_policy_binary { |
| 94 | name: "${ver}_plat_policy", |
| 95 | srcs: [":${ver}_plat_policy.cil"], |
| 96 | installable: false, |
| 97 | dist: { |
| 98 | targets: ["base-sepolicy-files-for-mapping"], |
| 99 | }, |
| 100 | } |
| 101 | EOF |