2 # AGL application systemd unit installation class
5 # Systemd template unit
6 # * agl-app, agl-app-web, agl-app-flutter valid
7 AGL_APP_TEMPLATE ?= "agl-app"
10 # This is what the application will be referred to in the list
11 # exposed to clients by applaunchd, and generally ends up as the
12 # identifier used by agl-compositor for application surface
14 AGL_APP_ID ?= "${BPN}"
16 # Application display name
17 AGL_APP_NAME ?= "${AGL_APP_ID}"
19 # Application executable
20 # * agl-app template only
21 # Use if the application ID and the executable name are both
22 # different from the package name and each other as well.
23 AGL_APP_EXEC ?= "${AGL_APP_ID}"
25 # Web application bundle directory (non-absolute, so directory
26 # name under /usr/lib/wam_apps)
27 # * agl-app-web template only
28 # Use if the web application bundle installs to a directory that
29 # is not the same as the package name.
30 AGL_APP_WAM_DIR ?= "${BPN}"
32 do_install:append () {
33 install -d ${D}${systemd_system_unitdir}
34 ln -s ${AGL_APP_TEMPLATE}\@.service \
35 ${D}${systemd_system_unitdir}/${AGL_APP_TEMPLATE}\@${AGL_APP_ID}.service
37 # NOTE: Unit & Service changes could potentially be collected
38 # and a single override .conf created, but things will be
39 # kept simple for now.
41 if [ "${AGL_APP_EXEC}" != "${AGL_APP_ID}" ]; then
42 install -d ${D}${systemd_system_unitdir}/${AGL_APP_TEMPLATE}\@${AGL_APP_ID}.service.d
43 cat <<-EOF > ${D}${systemd_system_unitdir}/${AGL_APP_TEMPLATE}\@${AGL_APP_ID}.service.d/exec.conf
46 ExecStart=${AGL_APP_EXEC}
50 if [ "${AGL_APP_NAME}" != "${AGL_APP_ID}" ]; then
51 install -d ${D}${systemd_system_unitdir}/${AGL_APP_TEMPLATE}\@${AGL_APP_ID}.service.d
52 cat <<-EOF > ${D}${systemd_system_unitdir}/${AGL_APP_TEMPLATE}\@${AGL_APP_ID}.service.d/name.conf
55 Description=${AGL_APP_NAME}
59 if [ "${AGL_APP_TEMPLATE}" = "agl-app-web" -a "${AGL_APP_ID}" != "${BPN}" ]; then
60 # The application ID does not necessarily match the package name
61 # used in the WAM install hierarchy, and the IDs are hard-coded in
62 # some of the web apps, so if necessary create an override for the
63 # environment variable used in place of directly deriving from %i
64 # (which will always be the app id).
65 install -d ${D}${systemd_system_unitdir}/${AGL_APP_TEMPLATE}\@${AGL_APP_ID}.service.d
66 cat <<-EOF > ${D}${systemd_system_unitdir}/${AGL_APP_TEMPLATE}\@${AGL_APP_ID}.service.d/wam.conf
68 Environment=AGL_APP_WAM_DIR=${AGL_APP_WAM_DIR}
72 if [ "${AGL_APP_TEMPLATE}" = "agl-app-flutter" ]; then
73 # Install icon if present
74 if [ -f ${S}/package/${AGL_APP_ID}.svg ]; then
75 install -d ${D}${datadir}/icons/hicolor/scalable
76 install -m 0644 ${S}/package/${AGL_APP_ID}.svg ${D}${datadir}/icons/hicolor/scalable/
81 FILES:${PN}:append = " ${systemd_system_unitdir} ${datadir}/icons"
83 RDEPENDS:${PN}:append = " applaunchd-template-${AGL_APP_TEMPLATE}"