Skip to content
Snippets Groups Projects
Commit 1e30b72d authored by Andrei Gherzan's avatar Andrei Gherzan :penguin:
Browse files

epiphany-app: Add support for running epiphany in application mode


This support is done configurable using the following variables:

EPIPHANY_APP             - Defines the app name (which needs to be the
			   directory name in FILESPATH/FILEEXTRAPATHS).
			   Currently defines it for HomeAssistant. If
			   this directory provides a
			   `service-override.conf`, the build system
			   will set it up as a systemd service
			   configuration for the main boot systemd
                           service.
EPIPHANY_URL             - The URL that the browser will load at
                           startup.
EPIPHANY_RDEPENDS        - Extra dependencies. If the specific
			   application needs extra dependencies at
                           runtime, they can be specifed here.
EPIPHANY_SERVICE_ENABLED - By default disabled (0). When enabled (1), it
			   will enable loading the epiphany app at boot.

The configuration defaults to setting up Epiphany browser in application
mode for a local instance of Home Assistant.

Signed-off-by: Andrei Gherzan's avatarAndrei Gherzan <andrei.gherzan@huawei.com>
parent e9915643
No related branches found
No related tags found
No related merge requests found
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 \
"
[Desktop Entry]
Name=HomeAssistant
Exec=epiphany --application-mode --profile="/home/root/.local/share/epiphany-HomeAssistant" http://localhost:8123
StartupNotify=true
Terminal=false
Type=Application
[Unit]
Requires=weston@root.service homeassistant.service
After=weston@root.service homeassistant.service
[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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment