#!/system/bin/sh if [ ! -f /data/app/did ]; then path_pre_install=/system/pre_install flist=`ls ${path_pre_install}` for file in $flist do echo ${path_pre_install}/$file pm install -r ${path_pre_install}/$file done echo 1 > /data/app/did fi
service copy_apps /system/bin/sh /system/bin/copy_apps.sh class core user root group root disable #创建但先不执行 oneshot #运行一次 seclabel u:r:copy_apps:s0 #这句是为加selinux权限添加的,android5.1以后不加则无法启动该服务 #必须在开机完成后再启动 on property:sys.boot_completed=1 start copy_apps
libsepol.report_failure: neverallow on line 263 of system/sepolicy/domain.te (or line 9133 of policy.conf) violated by allow xx device:chr_file { read write open }; libsepol.check_assertions: 1 neverallow failures occurred Error while expanding policy
# Do not allow any domain other than init or recovery to create unlabeled files. neverallow { domain -init -recovery } unlabeled:dir_file_class_set create;
只需要根据错误的提示,在system/sepolicy/domain.te找到对应的neverallow规则修改即可,我编译出现error的是allow xx device:chr_file { read write open };
# Don't allow raw read/write/open access to generic devices. # Rather force a relabel to a more specific type. # init is exempt from this as there are character devices that only it uses. # ueventd is exempt from this, as it is managing these devices. neverallow { domain -init -ueventd -systool_server -xx } device:chr_file { open read write };