summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshua Watt <JPEWhacker@gmail.com>2025-10-15 10:04:38 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-10-16 10:53:10 +0100
commitee905ad60b20b7d0767c093a2f3c3dafa1d96313 (patch)
tree6d972c86fdeded1f764a0de289682d328297514e
parent12e142d5e6b45f8208c758166c0c3906b203867c (diff)
downloadpoky-ee905ad60b20b7d0767c093a2f3c3dafa1d96313.tar.gz
weston-init: Allow weston user to be specified
Adds variables to set the name of the weston user (defaulting to "weston") and the home directory (defaulting to "/home/weston"). This allows users to easily change which user the compositor runs as. (From OE-Core rev: 079cf188adae1c7de3971a64df8cb04d5f47be4e) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-graphics/wayland/weston-init.bb21
-rwxr-xr-xmeta/recipes-graphics/wayland/weston-init/weston-socket.sh2
-rw-r--r--meta/recipes-graphics/wayland/weston-init/weston.service10
-rw-r--r--meta/recipes-graphics/wayland/weston-init/weston.socket6
4 files changed, 23 insertions, 16 deletions
diff --git a/meta/recipes-graphics/wayland/weston-init.bb b/meta/recipes-graphics/wayland/weston-init.bb
index fc817d113f..e236bdb253 100644
--- a/meta/recipes-graphics/wayland/weston-init.bb
+++ b/meta/recipes-graphics/wayland/weston-init.bb
@@ -25,6 +25,8 @@ PACKAGECONFIG[use-pixman] = ",,"
25 25
26DEFAULTBACKEND ??= "" 26DEFAULTBACKEND ??= ""
27DEFAULTBACKEND:qemuall ?= "drm" 27DEFAULTBACKEND:qemuall ?= "drm"
28WESTON_USER ??= "weston"
29WESTON_USER_HOME ??= "/home/${WESTON_USER}"
28 30
29do_install() { 31do_install() {
30 # Install weston-start script 32 # Install weston-start script
@@ -41,10 +43,15 @@ do_install() {
41 install -D -p -m0644 ${S}/weston.service ${D}${systemd_system_unitdir}/weston.service 43 install -D -p -m0644 ${S}/weston.service ${D}${systemd_system_unitdir}/weston.service
42 install -D -p -m0644 ${S}/weston.socket ${D}${systemd_system_unitdir}/weston.socket 44 install -D -p -m0644 ${S}/weston.socket ${D}${systemd_system_unitdir}/weston.socket
43 install -D -p -m0644 ${S}/weston-socket.sh ${D}${sysconfdir}/profile.d/weston-socket.sh 45 install -D -p -m0644 ${S}/weston-socket.sh ${D}${sysconfdir}/profile.d/weston-socket.sh
44 sed -i -e s:/etc:${sysconfdir}:g \ 46 sed -i -e s:@sysconfdir@:${sysconfdir}:g \
45 -e s:/usr/bin:${bindir}:g \ 47 -e s:@bindir@:${bindir}:g \
46 -e s:/var:${localstatedir}:g \ 48 -e s:@localstatedir@:${localstatedir}:g \
47 ${D}${systemd_system_unitdir}/weston.service 49 -e s:@runtimedir@:${runtimedir}:g \
50 -e s:@WESTON_USER@:${WESTON_USER}:g \
51 -e s:@WESTON_USER_HOME@:${WESTON_USER_HOME}:g \
52 ${D}${systemd_system_unitdir}/weston.service \
53 ${D}${systemd_system_unitdir}/weston.socket \
54 ${D}${sysconfdir}/profile.d/weston-socket.sh
48 fi 55 fi
49 56
50 if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then 57 if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then
@@ -70,7 +77,7 @@ do_install() {
70 sed -i -e "/^\[core\]/a use-pixman=true" ${D}${sysconfdir}/xdg/weston/weston.ini 77 sed -i -e "/^\[core\]/a use-pixman=true" ${D}${sysconfdir}/xdg/weston/weston.ini
71 fi 78 fi
72 79
73 install -dm 755 -o weston -g weston ${D}/home/weston 80 install -dm 755 -o ${WESTON_USER} -g ${WESTON_USER} ${D}/${WESTON_USER_HOME}
74} 81}
75 82
76INHIBIT_UPDATERCD_BBCLASS = "${@oe.utils.conditional('VIRTUAL-RUNTIME_init_manager', 'systemd', '1', '', d)}" 83INHIBIT_UPDATERCD_BBCLASS = "${@oe.utils.conditional('VIRTUAL-RUNTIME_init_manager', 'systemd', '1', '', d)}"
@@ -95,11 +102,11 @@ FILES:${PN} += "\
95 ${systemd_system_unitdir}/weston.socket \ 102 ${systemd_system_unitdir}/weston.socket \
96 ${sysconfdir}/default/weston \ 103 ${sysconfdir}/default/weston \
97 ${sysconfdir}/pam.d/ \ 104 ${sysconfdir}/pam.d/ \
98 /home/weston \ 105 ${WESTON_USER_HOME} \
99 " 106 "
100 107
101CONFFILES:${PN} += "${sysconfdir}/xdg/weston/weston.ini ${sysconfdir}/default/weston" 108CONFFILES:${PN} += "${sysconfdir}/xdg/weston/weston.ini ${sysconfdir}/default/weston"
102 109
103SYSTEMD_SERVICE:${PN} = "weston.service weston.socket" 110SYSTEMD_SERVICE:${PN} = "weston.service weston.socket"
104USERADD_PARAM:${PN} = "--home /home/weston --shell /bin/sh --user-group -G video,input,render,seat,wayland weston" 111USERADD_PARAM:${PN} = "--home ${WESTON_USER_HOME} --shell /bin/sh --user-group -G video,input,render,seat,wayland ${WESTON_USER}"
105GROUPADD_PARAM:${PN} = "-r wayland; -r render; -r seat" 112GROUPADD_PARAM:${PN} = "-r wayland; -r render; -r seat"
diff --git a/meta/recipes-graphics/wayland/weston-init/weston-socket.sh b/meta/recipes-graphics/wayland/weston-init/weston-socket.sh
index 86389d63a3..8f652862da 100755
--- a/meta/recipes-graphics/wayland/weston-init/weston-socket.sh
+++ b/meta/recipes-graphics/wayland/weston-init/weston-socket.sh
@@ -1,7 +1,7 @@
1#!/bin/sh 1#!/bin/sh
2 2
3# set weston variables for use with global weston socket 3# set weston variables for use with global weston socket
4global_socket="/run/wayland-0" 4global_socket="@runtimedir@/wayland-0"
5if [ -e "$global_socket" ]; then 5if [ -e "$global_socket" ]; then
6 weston_group=$(stat -c "%G" "$global_socket") 6 weston_group=$(stat -c "%G" "$global_socket")
7 if [ "$(id -u)" = "0" ]; then 7 if [ "$(id -u)" = "0" ]; then
diff --git a/meta/recipes-graphics/wayland/weston-init/weston.service b/meta/recipes-graphics/wayland/weston-init/weston.service
index 80745998ed..b7e845e88d 100644
--- a/meta/recipes-graphics/wayland/weston-init/weston.service
+++ b/meta/recipes-graphics/wayland/weston-init/weston.service
@@ -33,19 +33,19 @@ ConditionPathExists=/dev/tty0
33[Service] 33[Service]
34# Requires systemd-notify.so Weston plugin. 34# Requires systemd-notify.so Weston plugin.
35Type=notify 35Type=notify
36EnvironmentFile=/etc/default/weston 36EnvironmentFile=@sysconfdir@/default/weston
37ExecStart=/usr/bin/weston --modules=systemd-notify.so 37ExecStart=@bindir@/weston --modules=systemd-notify.so
38 38
39# Optional watchdog setup 39# Optional watchdog setup
40#TimeoutStartSec=60 40#TimeoutStartSec=60
41#WatchdogSec=20 41#WatchdogSec=20
42 42
43# The user to run Weston as. 43# The user to run Weston as.
44User=weston 44User=@WESTON_USER@
45Group=weston 45Group=@WESTON_USER@
46 46
47# Make sure the working directory is the users home directory 47# Make sure the working directory is the users home directory
48WorkingDirectory=/home/weston 48WorkingDirectory=@WESTON_USER_HOME@
49 49
50# Set up a full user session for the user, required by Weston. 50# Set up a full user session for the user, required by Weston.
51PAMName=weston-autologin 51PAMName=weston-autologin
diff --git a/meta/recipes-graphics/wayland/weston-init/weston.socket b/meta/recipes-graphics/wayland/weston-init/weston.socket
index c1bdc83c05..a7d461ee30 100644
--- a/meta/recipes-graphics/wayland/weston-init/weston.socket
+++ b/meta/recipes-graphics/wayland/weston-init/weston.socket
@@ -1,11 +1,11 @@
1[Unit] 1[Unit]
2Description=Weston socket 2Description=Weston socket
3RequiresMountsFor=/run 3RequiresMountsFor=@runtimedir@
4 4
5[Socket] 5[Socket]
6ListenStream=/run/wayland-0 6ListenStream=@runtimedir@/wayland-0
7SocketMode=0775 7SocketMode=0775
8SocketUser=weston 8SocketUser=@WESTON_USER@
9SocketGroup=wayland 9SocketGroup=wayland
10RemoveOnStop=yes 10RemoveOnStop=yes
11 11