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:
@@ -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"
|
||||
|
||||
40
recipes-defaultconfig/users/unpriv-user_1.2.bb
Normal file
40
recipes-defaultconfig/users/unpriv-user_1.2.bb
Normal 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"
|
||||
@@ -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 \
|
||||
|
||||
Reference in New Issue
Block a user