From 4dd08cfb4ff5c7f5fe6a2ba1d077dceec3c89d31 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Tue, 12 Nov 2024 03:22:31 +0100 Subject: [PATCH] cage: add package Add Cage which is a Wayland kiosk compositor running a single application in full-screen. Signed-off-by: Daniel Golle --- frameworks/cage/Makefile | 49 +++++++++++++++++++++++++++++++ frameworks/cage/files/cage.config | 8 +++++ frameworks/cage/files/cage.init | 46 +++++++++++++++++++++++++++++ 3 files changed, 103 insertions(+) create mode 100644 frameworks/cage/Makefile create mode 100644 frameworks/cage/files/cage.config create mode 100644 frameworks/cage/files/cage.init diff --git a/frameworks/cage/Makefile b/frameworks/cage/Makefile new file mode 100644 index 0000000..d7eda5a --- /dev/null +++ b/frameworks/cage/Makefile @@ -0,0 +1,49 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=cage +PKG_VERSION:=0.2.0 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/cage-kiosk/cage/releases/download/v0.2.0 +PKG_HASH:=557c194d18af7202a9ec2e8be6dd7129f6c16d0f4528f4079ba26ccd57b6ef88 + +PKG_MAINTAINER:=Daniel Golle +PKG_LICENSE:=MIT +PKG_LICENSE_FILES:=LICENSE + +PKG_INSTALL:=1 +PKG_BUILD_DEPENDS:=wayland/host + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/meson.mk + +define Package/cage + SECTION:=video-frameworks + CATEGORY:=Video + SUBMENU:=Frameworks and Toolkits + TITLE:=a Wayland kiosk + URL:=https://wayland.freedesktop.org/ + DEPENDS:=+wlroots +endef + +define Package/cage/description +This is Cage, a Wayland kiosk. A kiosk runs a single, maximized application. +endef + +MESON_ARGS += \ + -Dman-pages=disabled + +define Package/cage/conffiles +/etc/config/cage +endef + +define Package/cage/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/cage $(1)/usr/bin + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/cage.init $(1)/etc/init.d/cage + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/cage.config $(1)/etc/config/cage +endef + +$(eval $(call BuildPackage,cage)) diff --git a/frameworks/cage/files/cage.config b/frameworks/cage/files/cage.config new file mode 100644 index 0000000..eb8ba30 --- /dev/null +++ b/frameworks/cage/files/cage.config @@ -0,0 +1,8 @@ +config cage + option noinput '0' + option nogpu '0' + option cmd '/usr/bin/cog' + option user 'cog' + list args '--scale=0.33' + list args 'http://localhost' + list env 'WEBKIT_INSPECTOR_HTTP_SERVER=0.0.0.0:12341' diff --git a/frameworks/cage/files/cage.init b/frameworks/cage/files/cage.init new file mode 100644 index 0000000..9ba5e69 --- /dev/null +++ b/frameworks/cage/files/cage.init @@ -0,0 +1,46 @@ +#!/bin/sh /etc/rc.common +START=99 + +USE_PROCD=1 + +cage_append_command() { + procd_append_param command "$@" +} + +cage_append_env() { + procd_append_param env "$@" +} + +cage() { + local cfg="$1" + local cmd user args noinput nogpu + local cagedir="/tmp/run/cage" + config_get cmd "$cfg" 'cmd' + config_get noinput "$cfg" 'noinput' '0' + config_get nogpu "$cfg" 'nogpu' '0' + config_get user "$cfg" 'user' 'root' + + mkdir -p -m 0700 "$cagedir" + chown ${user}:root "$cagedir" + + procd_open_instance + procd_set_param command /usr/bin/cage + procd_append_param command "--" + procd_append_param command "$cmd" + config_list_foreach "$cfg" args cage_append_command + procd_set_param file /etc/config/cage + procd_set_param respawn + procd_set_param env "XDG_RUNTIME_DIR=$cagedir" + [ "$noinput" != "0" ] && procd_append_param env "WLR_LIBINPUT_NO_DEVICES=1" + [ "$nogpu" != "0" ] && procd_append_param env "WLR_RENDERER_ALLOW_SOFTWARE=1" + config_list_foreach "$cfg" env cage_append_env + procd_set_param user "$user" + procd_set_param stderr 1 + procd_set_param stdout 1 + procd_close_instance +} + +start_service() { + config_load cage + config_foreach cage cage +}