diff options
Diffstat (limited to 'meta/recipes-graphics/x11-common')
4 files changed, 23 insertions, 10 deletions
diff --git a/meta/recipes-graphics/x11-common/xserver-nodm-init/capability.conf b/meta/recipes-graphics/x11-common/xserver-nodm-init/capability.conf new file mode 100644 index 0000000000..7ab7460816 --- /dev/null +++ b/meta/recipes-graphics/x11-common/xserver-nodm-init/capability.conf @@ -0,0 +1,2 @@ +cap_sys_admin @USER@ +none * diff --git a/meta/recipes-graphics/x11-common/xserver-nodm-init/xserver-nodm b/meta/recipes-graphics/x11-common/xserver-nodm-init/xserver-nodm index 6c548551b8..116bb278bc 100755 --- a/meta/recipes-graphics/x11-common/xserver-nodm-init/xserver-nodm +++ b/meta/recipes-graphics/x11-common/xserver-nodm-init/xserver-nodm @@ -38,6 +38,14 @@ case "$1" in if [ -e /dev/hidraw0 ]; then chmod o+rw /dev/hidraw* fi + # Make sure that the Xorg has the cap_sys_admin capability which is + # needed for setting the drm master + if ! grep -q "^auth.*pam_cap\.so" /etc/pam.d/su; then + echo "auth optional pam_cap.so" >>/etc/pam.d/su + fi + if ! /usr/sbin/getcap $XSERVER | grep -q cap_sys_admin; then + /usr/sbin/setcap cap_sys_admin+eip $XSERVER + fi fi # Using su rather than sudo as latest 1.8.1 cause failure [YOCTO #1211] diff --git a/meta/recipes-graphics/x11-common/xserver-nodm-init/xserver-nodm.service.in b/meta/recipes-graphics/x11-common/xserver-nodm-init/xserver-nodm.service.in index 324a26f549..87dc4f8fcd 100644 --- a/meta/recipes-graphics/x11-common/xserver-nodm-init/xserver-nodm.service.in +++ b/meta/recipes-graphics/x11-common/xserver-nodm-init/xserver-nodm.service.in @@ -5,6 +5,7 @@ Description=Xserver startup without a display manager EnvironmentFile=/etc/default/xserver-nodm User=@USER@ ExecStart=/etc/xserver-nodm/Xserver +Restart=always [Install] Alias=display-manager.service diff --git a/meta/recipes-graphics/x11-common/xserver-nodm-init_3.0.bb b/meta/recipes-graphics/x11-common/xserver-nodm-init_3.0.bb index 345b589696..671c0a290e 100644 --- a/meta/recipes-graphics/x11-common/xserver-nodm-init_3.0.bb +++ b/meta/recipes-graphics/x11-common/xserver-nodm-init_3.0.bb @@ -1,8 +1,7 @@ SUMMARY = "Simple Xserver Init Script (no dm)" -LICENSE = "GPLv2" +LICENSE = "GPL-2.0-only" LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe" SECTION = "x11" -PR = "r31" SRC_URI = "file://xserver-nodm \ file://Xserver \ @@ -10,6 +9,7 @@ SRC_URI = "file://xserver-nodm \ file://gplv2-license.patch \ file://xserver-nodm.service.in \ file://xserver-nodm.conf.in \ + file://capability.conf \ " S = "${WORKDIR}" @@ -17,9 +17,9 @@ S = "${WORKDIR}" # Since we refer to ROOTLESS_X which is normally enabled per-machine PACKAGE_ARCH = "${MACHINE_ARCH}" -inherit update-rc.d systemd distro_features_check +inherit update-rc.d systemd features_check -REQUIRED_DISTRO_FEATURES = "x11" +REQUIRED_DISTRO_FEATURES = "x11 ${@oe.utils.conditional('ROOTLESS_X', '1', 'pam', '', d)}" PACKAGECONFIG ??= "blank" # dpms and screen saver will be on only if 'blank' is in PACKAGECONFIG @@ -40,6 +40,8 @@ do_install() { if [ "${ROOTLESS_X}" = "1" ] ; then XUSER_HOME="/home/xuser" XUSER="xuser" + install -D capability.conf ${D}${sysconfdir}/security/capability.conf + sed -i "s:@USER@:${XUSER}:" ${D}${sysconfdir}/security/capability.conf else XUSER_HOME=${ROOT_HOME} XUSER="root" @@ -49,9 +51,9 @@ do_install() { sed -i "s:@NO_CURSOR_ARG@:${NO_CURSOR_ARG}:" ${D}${sysconfdir}/default/xserver-nodm if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then - install -d ${D}${systemd_unitdir}/system - install -m 0644 ${WORKDIR}/xserver-nodm.service.in ${D}${systemd_unitdir}/system/xserver-nodm.service - sed -i "s:@USER@:${XUSER}:" ${D}${systemd_unitdir}/system/xserver-nodm.service + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${WORKDIR}/xserver-nodm.service.in ${D}${systemd_system_unitdir}/xserver-nodm.service + sed -i "s:@USER@:${XUSER}:" ${D}${systemd_system_unitdir}/xserver-nodm.service fi if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then @@ -60,10 +62,10 @@ do_install() { fi } -RDEPENDS_${PN} = "xinit ${@base_conditional('ROOTLESS_X', '1', 'xuser-account', '', d)}" +RDEPENDS:${PN} = "xinit ${@oe.utils.conditional('ROOTLESS_X', '1', 'xuser-account libcap libcap-bin', '', d)}" INITSCRIPT_NAME = "xserver-nodm" INITSCRIPT_PARAMS = "start 9 5 . stop 20 0 1 2 3 6 ." -SYSTEMD_SERVICE_${PN} = "xserver-nodm.service" +SYSTEMD_SERVICE:${PN} = "xserver-nodm.service" -RCONFLICTS_${PN} = "xserver-common (< 1.34-r9) x11-common" +RCONFLICTS:${PN} = "xserver-common (< 1.34-r9) x11-common" |