blob: 170a3cd38c6d028b47b7d29f2dce7beb588cd975 [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",
33 srcs: [":se_build_files{.plat_public_${ver}}", ":se_build_files{.reqd_mask}"],
34 installable: false,
35 build_variant: "user",
36}
37
38se_policy_cil {
39 name: "${ver}_plat_pub_policy.cil",
40 src: ":${ver}_plat_pub_policy.conf",
41 filter_out: [":reqd_policy_mask.cil"],
42 secilc_check: false,
43 installable: false,
44}
45
46se_policy_conf {
47 name: "${ver}_product_pub_policy.conf",
48 srcs: [
49 ":se_build_files{.plat_public_${ver}}",
50 ":se_build_files{.system_ext_public_${ver}}",
51 ":se_build_files{.product_public_${ver}}",
52 ":se_build_files{.reqd_mask}",
53 ],
54 installable: false,
55 build_variant: "user",
56}
57
58se_policy_cil {
59 name: "${ver}_product_pub_policy.cil",
60 src: ":${ver}_product_pub_policy.conf",
61 filter_out: [":reqd_policy_mask.cil"],
62 secilc_check: false,
63 installable: false,
64}
65
66se_policy_conf {
67 name: "${ver}_plat_policy.conf",
68 srcs: [
69 ":se_build_files{.plat_public_${ver}}",
70 ":se_build_files{.plat_private_${ver}}",
71 ":se_build_files{.system_ext_public_${ver}}",
72 ":se_build_files{.system_ext_private_${ver}}",
73 ":se_build_files{.product_public_${ver}}",
74 ":se_build_files{.product_private_${ver}}",
75 ],
76 installable: false,
77 build_variant: "user",
78}
79
80se_policy_cil {
81 name: "${ver}_plat_policy.cil",
82 src: ":${ver}_plat_policy.conf",
83 additional_cil_files: [":sepolicy_technical_debt{.plat_private_${ver}}"],
84 installable: false,
85}
86
87se_policy_binary {
88 name: "${ver}_plat_policy",
89 srcs: [":${ver}_plat_policy.cil"],
90 installable: false,
91 dist: {
92 targets: ["base-sepolicy-files-for-mapping"],
93 },
94}
95EOF