Introduce a default unpriviledged user for X11/wayland

Modernized version of what I had in meta-misc.

Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
This commit is contained in:
Andreas Müller
2018-09-29 11:38:20 +02:00
parent 59da290d17
commit 1b36134d86
3 changed files with 45 additions and 1 deletions

View File

@@ -87,3 +87,7 @@ DISTRO_EXTRA_RRECOMMENDS += " \
# workaround oe-core long lasting bulls.. 049f89155b1e80875aad6e53b21808b827c06915
# make x11-base a valid IMAGE_FEATURES again
IMAGE_FEATURES[validitems] += "x11-base"
# For X11/Wayland images we install an unpriviledged user by default. If this
# is not desired override DISTRO_GUI_USER
DISTRO_GUI_USER ?= "unpriv-user"

View File

@@ -0,0 +1,40 @@
DESCRIPTION = "This recipe adds a user 'morona' without password"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
inherit useradd
USERNAME = "morona"
# groups user shall be member of
USERGROUPS = " \
audio \
video \
${@bb.utils.contains('BBFILE_COLLECTIONS', 'openembedded-layer', 'datetime network', '', d)} \
\
systemd-journal \
"
# all those we are member of
USER_DEPS ?= " \
systemd \
\
${@bb.utils.contains('BBFILE_COLLECTIONS', 'openembedded-layer', 'polkit-group-rule-datetime polkit-group-rule-network', '', d)} \
\
${@bb.utils.contains('BBFILE_COLLECTIONS', 'meta-qt5-extra', 'audio-tweaks', '', d)} \
"
DEPENDS += "${USER_DEPS}"
RDEPENDS_${PN} = "${USER_DEPS} bash"
USERADD_PACKAGES = "${PN}"
USERADD_PARAM_${PN} = "-m -c Operator -d /home/${USERNAME} -s /bin/bash -k /etc/skel -g ${USERNAME} ${USERNAME}"
GROUPADD_PARAM_${PN} = "${USERNAME}"
pkg_postinst_ontarget_${PN}() {
# empty password
passwd -d ${USERNAME}
}
ALLOW_EMPTY_${PN} = "1"

View File

@@ -12,7 +12,7 @@ RDEPENDS_${PN} = " \
source-han-sans-jp-fonts \
source-han-sans-tw-fonts \
\
operator-user \
${DISTRO_GUI_USER} \
\
gedit gtksourceview-classic-light \
xarchiver \