Skip to content

Commit

Permalink
cage: add package
Browse files Browse the repository at this point in the history
Add Cage which is a Wayland kiosk compositor running a single
application in full-screen.

Signed-off-by: Daniel Golle <[email protected]>
  • Loading branch information
dangowrt committed Dec 2, 2024
1 parent 812764c commit 13f050e
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 0 deletions.
49 changes: 49 additions & 0 deletions frameworks/cage/Makefile
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
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 +xkeyboard-config
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))
8 changes: 8 additions & 0 deletions frameworks/cage/files/cage.config
Original file line number Diff line number Diff line change
@@ -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'
46 changes: 46 additions & 0 deletions frameworks/cage/files/cage.init
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit 13f050e

Please sign in to comment.