diff --git a/meta-ohos-demo/recipes-gnome/epiphany/epiphany-app.bb b/meta-ohos-demo/recipes-gnome/epiphany/epiphany-app.bb new file mode 100644 index 0000000000000000000000000000000000000000..81b7d3a50ff07e9f8e7cf6e0d97a415adba85756 --- /dev/null +++ b/meta-ohos-demo/recipes-gnome/epiphany/epiphany-app.bb @@ -0,0 +1,58 @@ +SUMMARY = "Epiphany app mode support files" +BUGTRACKER = "https://gitlab.gnome.org/GNOME/epiphany" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${OHOS_COREBASE}/LICENSES/Apache-2.0.txt;md5=ef3dabb8f39493f4ea410bebc1d01755" + +inherit allarch features_check + +EPIPHANY_APP ?= "HomeAssistant" +EPIPHANY_URL ?= "http://localhost:8123" +EPIPHANY_RDEPENDS ?= "python3-homeassistant" +EPIPHANY_SERVICE_ENABLED ?= "0" + +# The services depend on weston +REQUIRED_DISTRO_FEATURES = "wayland" + +SRC_URI = "\ + file://epiphany-app@.service \ + file://${EPIPHANY_APP}/* \ + " + +do_install() { + # Setup the system service + install -d "${D}${systemd_unitdir}/system/multi-user.target.wants" + install -m 0644 "${WORKDIR}/epiphany-app@.service" "${D}${systemd_unitdir}/system" + sed -i -e 's,@EPIPHANY_APP@,${EPIPHANY_APP},g' \ + -e 's,@EPIPHANY_URL@,${EPIPHANY_URL},g' "${D}${systemd_unitdir}/system/epiphany-app@.service" + if [ "${EPIPHANY_SERVICE_ENABLED}" = "1" ]; then + install -d "${D}${sysconfdir}/systemd/system/multi-user.target.wants" + ln -s "${systemd_unitdir}/system/epiphany-app@.service" \ + "${D}${sysconfdir}/systemd/system/multi-user.target.wants/epiphany-app@${EPIPHANY_APP}.service" + fi + + # The systemd service override is optional and app specific (for example it + # can add dependencies for a local HTTP service). + if [ -f "${WORKDIR}/epiphany-${EPIPHANY_APP}/service-override.conf" ]; then + mkdir -p "${D}${sysconfdir}/systemd/system/epiphany-app@${EPIPHANY_APP}.service.d" + cp "${WORKDIR}/epiphany-${EPIPHANY_APP}/service-override.conf" \ + "${D}${sysconfdir}/systemd/system/epiphany-app@${EPIPHANY_APP}.service.d" + fi + + # Setup the app + WD_APPDIR="${WORKDIR}/${EPIPHANY_APP}" + D_APPDIR="${D}/home/root/.local/share/epiphany-${EPIPHANY_APP}" + mkdir -p "$D_APPDIR" + cp "$WD_APPDIR/epiphany-${EPIPHANY_APP}.desktop" "$D_APPDIR" + touch "$D_APPDIR/.app" +} + +FILES_${PN} += " \ + /home/root \ + ${systemd_unitdir} \ + " + +RDEPENDS_${PN} = "\ + ${EPIPHANY_RDEPENDS} \ + epiphany \ + weston-init \ + " diff --git a/meta-ohos-demo/recipes-gnome/epiphany/epiphany-app/HomeAssistant/epiphany-HomeAssistant.desktop b/meta-ohos-demo/recipes-gnome/epiphany/epiphany-app/HomeAssistant/epiphany-HomeAssistant.desktop new file mode 100644 index 0000000000000000000000000000000000000000..19d0dac19da7789e86c8f2e92f83947f3c5a1d04 --- /dev/null +++ b/meta-ohos-demo/recipes-gnome/epiphany/epiphany-app/HomeAssistant/epiphany-HomeAssistant.desktop @@ -0,0 +1,6 @@ +[Desktop Entry] +Name=HomeAssistant +Exec=epiphany --application-mode --profile="/home/root/.local/share/epiphany-HomeAssistant" http://localhost:8123 +StartupNotify=true +Terminal=false +Type=Application diff --git a/meta-ohos-demo/recipes-gnome/epiphany/epiphany-app/HomeAssistant/service-override.conf b/meta-ohos-demo/recipes-gnome/epiphany/epiphany-app/HomeAssistant/service-override.conf new file mode 100644 index 0000000000000000000000000000000000000000..c40522f587f44492d3daeebd6d0635e31066655d --- /dev/null +++ b/meta-ohos-demo/recipes-gnome/epiphany/epiphany-app/HomeAssistant/service-override.conf @@ -0,0 +1,3 @@ +[Unit] +Requires=weston@root.service homeassistant.service +After=weston@root.service homeassistant.service diff --git a/meta-ohos-demo/recipes-gnome/epiphany/epiphany-app/epiphany-app@.service b/meta-ohos-demo/recipes-gnome/epiphany/epiphany-app/epiphany-app@.service new file mode 100644 index 0000000000000000000000000000000000000000..b33253edef6c76aaa66367633ce78d3a6e6500e7 --- /dev/null +++ b/meta-ohos-demo/recipes-gnome/epiphany/epiphany-app/epiphany-app@.service @@ -0,0 +1,12 @@ +[Unit] +Description=Epiphany browser started for %i application +Requires=weston@root.service +After=weston@root.service + +[Service] +Environment="WAYLAND_DISPLAY=wayland-0" +Environment="XDG_RUNTIME_DIR=/run/user/0" +ExecStart=/usr/bin/epiphany -a --profile /home/root/.local/share/epiphany-@EPIPHANY_APP@ @EPIPHANY_URL@ + +[Install] +WantedBy=multi-user.target