• android 系统rc添加 shell运行脚本


    4.1 编写对应的rc文件和脚本文件

    start_vendor_sniffer.sh

    skyui_diag_mdlog.rc

    4.2 拷贝文件到编译的vendor 分区

    2.修改 .mk 配置文件,将创建的 test.sh 编译到系统分区

    # copy start_vendor_sniffer.sh to vendor/bin/start_vendor_sniffer.sh

    # copy skyui_diag_mdlog.rc to vendor/etc/init/skyui_diag_mdlog.rc

    PRODUCT_COPY_FILES += ***/start_vendor_sniffer.sh:vendor/bin/start_vendor_sniffer.sh \

    ***/skyui_diag_mdlogsh:vendor/etc/init/skyui_diag_mdlog.rc 

    //skyui vendor 目前不会编译,先使用push 方式推送文件到目标目录

    4.3 在file_context 定义对应的标签

    在vendor\skyui\sepolicy\private目录下的file_contexts文件中增加如下文件:

    /vendor/bin/start_vendor_sniffer.sh u:object_r:vendor_sniffer_exec:s0

    /vendor/bin/stop_vendor_sniffer.sh u:object_r:vendor_sniffer_exec:s0

    4.4 创建脚本文件启动进程时对应的selinux的te文件

    在vendor\skyui\sepolicy\private目录下, 添加vendor_sniffer.te 文件, 内容如下:

    # add by shengqing.liu@nio.com skyui_diag_mdlog 2022/11/8 for_snifferlog start

    type vendor_sniffer, domain;

    type vendor_sniffer_exec, exec_type, vendor_file_type, file_type;

    init_daemon_domain(vendor_sniffer)

    allow vendor_sniffer vendor_shell_exec:file { execute_no_trans };

    allow vendor_sniffer vendor_file:file { execute getattr setattr open read write create};

    allow vendor_sniffer device:chr_file { ioctl };

    allow vendor_sniffer system_file:file { execute };

    allow vendor_sniffer sysfs:file { getattr setattr };

    allow vendor_sniffer storage_file:dir { search open read };

    allow vendor_sniffer storage_file:lnk_file { read };

    allow vendor_sniffer mnt_user_file:lnk_file { read };

    allow vendor_sniffer mnt_user_file:dir { search };

    allow vendor_sniffer sdcardfs:dir { search write add_name create };

    allow vendor_sniffer media_rw_data_file:dir { read open search write };

    allow vendor_sniffer system_data_file:file { getattr };

  • 相关阅读:
    Haproxy搭建Web集群
    Springboot——jxls实现同sheet多个列表展示
    高可用集群HA、LVS+Keepalived、健康检测
    MySQL面试题经典40问!(全)
    Methoxy-PEG-PLGA,mPEG-PLGA是一种可生物降解的两亲性嵌段共聚物
    thsi指针用法总结
    分析SSH登录尝试的日志文件,如果某个IP地址失败次数超过5次,加入黑名单
    Node学习二十 —— 构建和使用HTTP中间件
    git 实际使用命令
    5. Longest Palindromic Substring
  • 原文地址:https://blog.csdn.net/jx232515/article/details/72629928