mirror of
https://gitee.com/openharmony/security_selinux
synced 2024-11-23 05:19:57 +00:00
add feature switch
Signed-off-by: renwei <renwei8@huawei.com> Change-Id: I4b9ce02a6f2ca2948f8d4e45283c187d02279cd1
This commit is contained in:
parent
2f03727c3f
commit
7438649669
16
BUILD.gn
16
BUILD.gn
@ -428,9 +428,13 @@ action("build_contexts") {
|
||||
]
|
||||
}
|
||||
|
||||
action("enforce_selinux") {
|
||||
script = "scripts/enforce_selinux.sh"
|
||||
outputs = [ "$target_out_dir/" ]
|
||||
copy("selinux_config") {
|
||||
if (selinux_enforce) {
|
||||
sources = [ "$SELINUX_ROOT_DIR/config/config.enforce" ]
|
||||
} else {
|
||||
sources = [ "$SELINUX_ROOT_DIR/config/config.permissive" ]
|
||||
}
|
||||
outputs = [ "$target_out_dir/config" ]
|
||||
}
|
||||
|
||||
ohos_prebuilt_etc("build_sepolicy") {
|
||||
@ -450,12 +454,10 @@ ohos_prebuilt_etc("file_contexts_bin") {
|
||||
}
|
||||
|
||||
ohos_prebuilt_etc("config") {
|
||||
source = "$SELINUX_ROOT_DIR/config/config"
|
||||
deps = [ ":selinux_config" ]
|
||||
source = target_out_dir + "/config"
|
||||
license_file = "$SELINUX_ROOT_DIR/LICENSE"
|
||||
part_name = "selinux"
|
||||
if (enforce_selinux) {
|
||||
deps = [ ":enforce_selinux" ]
|
||||
}
|
||||
relative_install_dir = "selinux/"
|
||||
}
|
||||
|
||||
|
17
config/config.permissive
Normal file
17
config/config.permissive
Normal file
@ -0,0 +1,17 @@
|
||||
#
|
||||
# Copyright (c) 2021 北京万里红科技有限公司
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
SELINUX=permissive
|
@ -14,3 +14,7 @@
|
||||
declare_args() {
|
||||
selinux_build_path = "default"
|
||||
}
|
||||
|
||||
declare_args() {
|
||||
selinux_enforce = true
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user