1# Copyright (C) 2022, Rockchip Electronics Co., Ltd
2# Released under the MIT license (see COPYING.MIT for the terms)
3
4SECTION = "console/utils"
5LICENSE = "MIT"
6LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
7
8FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
9
10SRC_URI:append = " \
11	file://adbd.sh \
12	file://android-gadget-setup \
13	file://android-gadget-start \
14	file://android-gadget-cleanup \
15	file://10-adbd-rockchip.conf \
16"
17
18do_install:append() {
19	install -d ${D}${sysconfdir}/init.d
20	install -m 0755 ${WORKDIR}/adbd.sh ${D}${sysconfdir}/init.d/adbd.sh
21
22	install -d ${D}${bindir}
23	install -m 0755 ${WORKDIR}/android-gadget-setup ${D}${bindir}
24	install -m 0755 ${WORKDIR}/android-gadget-start ${D}${bindir}
25	install -m 0755 ${WORKDIR}/android-gadget-cleanup ${D}${bindir}
26
27	install -d ${D}${systemd_unitdir}/system/android-tools-adbd.service.d
28	install -m0644 ${WORKDIR}/10-adbd-rockchip.conf \
29		${D}${systemd_unitdir}/system/android-tools-adbd.service.d
30
31	if [ "${USB_DEBUGGING_ENABLED}" = "1" ]; then
32		install -d ${D}/var
33		touch ${D}/var/usb-debugging-enabled
34	fi
35}
36
37inherit update-rc.d
38
39INITSCRIPT_PACKAGES = "${PN}"
40INITSCRIPT_NAME = "adbd.sh"
41INITSCRIPT_PARAMS = "start 70 5 4 3 2 . stop 30 0 1 6 ."
42
43FILES:${PN}:append = " \
44	/var/ \
45	${sysconfdir}/ \
46	${systemd_unitdir}/system/ \
47"
48
49PROVIDES:append = " android-tools-conf"
50RPROVIDES:${PN} = "android-tools-conf"
51