blob: 68ce0e5065eab653b7803251f7365d86003485b4 [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 Kimd9fd42e2024-01-19 18:08:55 +090034 srcs: [":se_build_files{.plat_public_${ver}}", ":se_build_files{.reqd_mask}"],
35 installable: false,
36 build_variant: "user",
37}
38
39se_policy_cil {
40 name: "${ver}_plat_pub_policy.cil",
41 src: ":${ver}_plat_pub_policy.conf",
42 filter_out: [":reqd_policy_mask.cil"],
43 secilc_check: false,
44 installable: false,
45}
46
47se_policy_conf {
48 name: "${ver}_product_pub_policy.conf",
Inseob Kim61036d92024-02-21 13:18:49 +090049 defaults: ["se_policy_conf_flags_defaults"],
Inseob Kimd9fd42e2024-01-19 18:08:55 +090050 srcs: [
51 ":se_build_files{.plat_public_${ver}}",
52 ":se_build_files{.system_ext_public_${ver}}",
53 ":se_build_files{.product_public_${ver}}",
54 ":se_build_files{.reqd_mask}",
55 ],
56 installable: false,
57 build_variant: "user",
58}
59
60se_policy_cil {
61 name: "${ver}_product_pub_policy.cil",
62 src: ":${ver}_product_pub_policy.conf",
63 filter_out: [":reqd_policy_mask.cil"],
64 secilc_check: false,
65 installable: false,
66}
67
68se_policy_conf {
69 name: "${ver}_plat_policy.conf",
Inseob Kim61036d92024-02-21 13:18:49 +090070 defaults: ["se_policy_conf_flags_defaults"],
Inseob Kimd9fd42e2024-01-19 18:08:55 +090071 srcs: [
72 ":se_build_files{.plat_public_${ver}}",
73 ":se_build_files{.plat_private_${ver}}",
74 ":se_build_files{.system_ext_public_${ver}}",
75 ":se_build_files{.system_ext_private_${ver}}",
76 ":se_build_files{.product_public_${ver}}",
77 ":se_build_files{.product_private_${ver}}",
78 ],
79 installable: false,
80 build_variant: "user",
81}
82
83se_policy_cil {
84 name: "${ver}_plat_policy.cil",
85 src: ":${ver}_plat_policy.conf",
86 additional_cil_files: [":sepolicy_technical_debt{.plat_private_${ver}}"],
87 installable: false,
88}
89
90se_policy_binary {
91 name: "${ver}_plat_policy",
92 srcs: [":${ver}_plat_policy.cil"],
93 installable: false,
94 dist: {
95 targets: ["base-sepolicy-files-for-mapping"],
96 },
97}
98EOF