4A: delay service startup as a workaround to SPEC-1762/SPEC-1763 (temp workaround)
[AGL/meta-agl-devel.git] / meta-audio-4a-framework / recipes-multimedia / agl-service-audio-4a / agl-service-audio-4a_git.bb
1 SUMMARY     = "4A - High Level Audio API Service"
2 DESCRIPTION = "High Level Audio API service used in 4A (AGL Advanced Audio Agent)"
3 HOMEPAGE    = "https://git.automotivelinux.org/apps/agl-service-audio-4a/"
4 SECTION     = "apps"
5
6 LICENSE = "Apache-2.0"
7 LIC_FILES_CHKSUM = "file://Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
8
9 SRC_URI = "gitsm://gerrit.automotivelinux.org/gerrit/apps/agl-service-audio-4a;protocol=https;branch=${AGL_BRANCH}"
10 SRCREV = "${AGL_APP_REVISION}"
11
12 PV = "0.1+git${SRCPV}"
13 S  = "${WORKDIR}/git"
14
15 inherit cmake aglwgt pkgconfig
16
17 DEPENDS += "alsa-lib json-c systemd af-binder glib-2.0 lua"
18
19 do_aglwgt_deploy_append() {
20         cat <<'EOF' >${D}/${sysconfdir}/agl-postinsts/99_4A_service_patch.sh
21 N=600
22 svcfile="/usr/local/lib/systemd/*/afm-service-agl-service-audio-4a*.service"
23 set -x
24 echo "-- TMP 4A INSTALL FIX from meta-agl/meta-app-framework/recipes-multimedia/agl-service-audio-4a/agl-service-audio-4a_git.bb - MUST BE REMOVED !!!"
25 while ! ls $svcfile > /dev/null; do
26         if [ $N = 0 ]; then echo "-- TMP 4A INSTALL NOT FIXED"; exit 0; fi
27         echo .
28         sleep 0.2
29         N=$(expr $N - 1)
30 done
31 sed -i '/\[Unit\]/ a Before=pulseaudio.service' $svcfile;
32 sed -i '/\[Unit\]/ a ConditionPathExistsGlob=/dev/snd/control*' $svcfile;
33 sed -i '/ExecStartPre=/ a Environment=LIBASOUND_THREAD_SAFE=0' $svcfile;
34
35 sed -i -e 's|/usr/bin/afb-daemon\>|& --ldpath=/usr/libexec/agl/4a-alsa-core/lib:/usr/libexec/agl/4a-hal/lib:/usr/libexec/agl/afb-aaaa/lib:/usr/libexec/agl/smixer/lib|' $svcfile
36
37 # binder name matters: it must match "afbd-4a-*" => the config file (controller json file) that will be searched will be "policy-4a-*.json"
38 sed -i -e 's|--name afbd-agl-\(.*\)|--name afbd-4a-\1|' $svcfile
39
40 # workaround for SPEC-1762
41 sed -i -e 's|/usr/bin/afb-daemon\>|/usr/bin/4a_wait_bt.sh &|' $svcfile
42
43 echo "-- TMP 4A INSTALL FIX END"
44
45 EOF
46         chmod a+x ${D}/${sysconfdir}/agl-postinsts/99_4A_service_patch.sh
47 }
48
49 ##############################################
50 # workaround for SPEC-1762/SPEC-1763
51 RDEPENDS_${PN} += "bash"
52 SRC_URI += "file://4a_wait_bt.sh"
53 do_install_append() {
54         install -d ${D}${bindir}
55         install -m 0755 ${WORKDIR}/4a_wait_bt.sh ${D}${bindir}/
56 }
57 #
58 ##############################################