diff options
| author | Joshua Watt <JPEWhacker@gmail.com> | 2025-10-15 10:04:38 -0600 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-10-16 10:53:10 +0100 |
| commit | ee905ad60b20b7d0767c093a2f3c3dafa1d96313 (patch) | |
| tree | 6d972c86fdeded1f764a0de289682d328297514e | |
| parent | 12e142d5e6b45f8208c758166c0c3906b203867c (diff) | |
| download | poky-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>
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 | ||
| 26 | DEFAULTBACKEND ??= "" | 26 | DEFAULTBACKEND ??= "" |
| 27 | DEFAULTBACKEND:qemuall ?= "drm" | 27 | DEFAULTBACKEND:qemuall ?= "drm" |
| 28 | WESTON_USER ??= "weston" | ||
| 29 | WESTON_USER_HOME ??= "/home/${WESTON_USER}" | ||
| 28 | 30 | ||
| 29 | do_install() { | 31 | do_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 | ||
| 76 | INHIBIT_UPDATERCD_BBCLASS = "${@oe.utils.conditional('VIRTUAL-RUNTIME_init_manager', 'systemd', '1', '', d)}" | 83 | INHIBIT_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 | ||
| 101 | CONFFILES:${PN} += "${sysconfdir}/xdg/weston/weston.ini ${sysconfdir}/default/weston" | 108 | CONFFILES:${PN} += "${sysconfdir}/xdg/weston/weston.ini ${sysconfdir}/default/weston" |
| 102 | 109 | ||
| 103 | SYSTEMD_SERVICE:${PN} = "weston.service weston.socket" | 110 | SYSTEMD_SERVICE:${PN} = "weston.service weston.socket" |
| 104 | USERADD_PARAM:${PN} = "--home /home/weston --shell /bin/sh --user-group -G video,input,render,seat,wayland weston" | 111 | USERADD_PARAM:${PN} = "--home ${WESTON_USER_HOME} --shell /bin/sh --user-group -G video,input,render,seat,wayland ${WESTON_USER}" |
| 105 | GROUPADD_PARAM:${PN} = "-r wayland; -r render; -r seat" | 112 | GROUPADD_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 |
| 4 | global_socket="/run/wayland-0" | 4 | global_socket="@runtimedir@/wayland-0" |
| 5 | if [ -e "$global_socket" ]; then | 5 | if [ -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. |
| 35 | Type=notify | 35 | Type=notify |
| 36 | EnvironmentFile=/etc/default/weston | 36 | EnvironmentFile=@sysconfdir@/default/weston |
| 37 | ExecStart=/usr/bin/weston --modules=systemd-notify.so | 37 | ExecStart=@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. |
| 44 | User=weston | 44 | User=@WESTON_USER@ |
| 45 | Group=weston | 45 | Group=@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 |
| 48 | WorkingDirectory=/home/weston | 48 | WorkingDirectory=@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. |
| 51 | PAMName=weston-autologin | 51 | PAMName=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] |
| 2 | Description=Weston socket | 2 | Description=Weston socket |
| 3 | RequiresMountsFor=/run | 3 | RequiresMountsFor=@runtimedir@ |
| 4 | 4 | ||
| 5 | [Socket] | 5 | [Socket] |
| 6 | ListenStream=/run/wayland-0 | 6 | ListenStream=@runtimedir@/wayland-0 |
| 7 | SocketMode=0775 | 7 | SocketMode=0775 |
| 8 | SocketUser=weston | 8 | SocketUser=@WESTON_USER@ |
| 9 | SocketGroup=wayland | 9 | SocketGroup=wayland |
| 10 | RemoveOnStop=yes | 10 | RemoveOnStop=yes |
| 11 | 11 | ||
