blob: 7d0ae51fcc08456bf835c2b52c9e8cdc4165eb47 [file] [log] [blame]
Inseob Kimd9fd42e2024-01-19 18:08:55 +09001#!/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
17if [ $# -ne 2 ]; then
18 echo "Usage: $0 <top> <ver>"
19 exit 1
20fi
21
22top=$1
23ver=$2
24
25mkdir -p "$top/system/sepolicy/prebuilts/api/${ver}/"
26cp -r "$top/system/sepolicy/public/" "$top/system/sepolicy/prebuilts/api/${ver}/"
27cp -r "$top/system/sepolicy/private/" "$top/system/sepolicy/prebuilts/api/${ver}/"
28
29cat > "$top/system/sepolicy/prebuilts/api/${ver}/Android.bp" <<EOF
30// Automatically generated file, do not edit!
31se_policy_conf {
32 name: "${ver}_plat_pub_policy.conf",
Inseob Kim61036d92024-02-21 13:18:49 +090033 defaults: ["se_policy_conf_flags_defaults"],
Inseob Kim6b1db842024-03-19 11:07:30 +090034 srcs: [
35 ":se_build_files{.plat_public_${ver}}",
36 ":se_build_files{.reqd_mask}",
37 ],
Inseob Kimd9fd42e2024-01-19 18:08:55 +090038 installable: false,
39 build_variant: "user",
40}
41
42se_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
50se_policy_conf {
51 name: "${ver}_product_pub_policy.conf",
Inseob Kim61036d92024-02-21 13:18:49 +090052 defaults: ["se_policy_conf_flags_defaults"],
Inseob Kimd9fd42e2024-01-19 18:08:55 +090053 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
63se_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
71se_policy_conf {
72 name: "${ver}_plat_policy.conf",
Inseob Kim61036d92024-02-21 13:18:49 +090073 defaults: ["se_policy_conf_flags_defaults"],
Inseob Kimd9fd42e2024-01-19 18:08:55 +090074 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
86se_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
93se_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}
101EOF