Я пытаюсь запустить скрипт оболочки во время загрузки устройства.
Я выполнил следующие шаги:
1. Создан скрипт оболочки и помещен в / system /bin/usbmountd.sh
2. Добавлен тест. sh в inir.r c.
service usbmountd /system/bin/usbmountd.sh
user system
disabled
oneshot
3. Добавить новый домен «usbmountd.te» в расположении устройства / broadcom / XXX / sepolicy / treble /
usbmountd.te
type usbmountd, domain;
type usbmountd_exec, exec_type, file_type;
init_daemon_domain(usbmountd)
4. Добавьте метку «/system/bin/usbmountd.sh» на устройство / broadcom / XXX / sepolicy / treble / file_contexts
/system/bin/usbmountd u:object_r: _exec:s0
5. Добавлено в устройство / broadcom / xxx / sepolicy / xxx / file.te
type usbmountd_exec, system_file_type, file_type;
getting compilation error:
>[ 81% 747/921] build out/target/product/xxx/obj/ETC/sepolicy_neverallows_intermediates/sepolicy_neverallows FAILED: out/target/product/xxx/obj/ETC/sepolicy_neverallows_intermediates/sepolicy_neverallows /bin/bash -c "(ASAN_OPTIONS=detect_leaks=0 out/host/linux-x86/bin/checkpolicy -M -c 30 -o out/target/product/xxx/obj/ETC/sepolicy_neverallows_intermediates/sepolicy_neverallows.tmp out/target/product/xxx/obj/ETC/sepolicy_neverallows_intermediates/policy.conf ) && (out/host/linux-x86/bin/sepolicy-analyze out/target/product/xxx/obj/ETC/sepolicy_neverallows_intermediates/sepolicy_neverallows.tmp neverallow -w -f out/target/product/xxx/obj/ETC/sepolicy_neverallows_intermediates/policy_2.conf || ( echo \"\" 1>&2; echo \"sepolicy-analyze failed. This is most likely due to the use\" 1>&2; echo \"of an expanded attribute in a neverallow assertion. Please fix\" 1>&2; echo \"the policy.\" 1>&2; exit 1 ) ) && (touch out/target/product/xxx/obj/ETC/sepolicy_neverallows_intermediates/sepolicy_neverallows.tmp ) && (mv out/target/product/xxx/obj/ETC/sepolicy_neverallows_intermediates/sepolicy_neverallows.tmp out/target/product/xxx/obj/ETC/sepolicy_neverallows_intermediates/sepolicy_neverallows )" device/xxx/xxx/sepolicy/treble/usbmountd.te:3:ERROR 'Duplicate declaration of type' at token ';' on line 60116: type usbmountd_exec, exec_type, file_type; type usbmountd, domain; checkpolicy: error(s) encountered while parsing configuration