1SUMMARY = "Simple Xserver Init Script (no dm)"
2LICENSE = "GPL-2.0-only"
3LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
4SECTION = "x11"
5PR = "r31"
6
7SRC_URI = "file://xserver-nodm \
8           file://Xserver \
9           file://X11 \
10           file://gplv2-license.patch \
11           file://xserver-nodm.service.in \
12           file://xserver-nodm.conf.in \
13           file://capability.conf \
14"
15
16S = "${WORKDIR}"
17
18# Since we refer to ROOTLESS_X which is normally enabled per-machine
19PACKAGE_ARCH = "${MACHINE_ARCH}"
20
21inherit update-rc.d systemd features_check
22
23REQUIRED_DISTRO_FEATURES = "x11 ${@oe.utils.conditional('ROOTLESS_X', '1', 'pam', '', d)}"
24
25PACKAGECONFIG ??= "blank"
26# dpms and screen saver will be on only if 'blank' is in PACKAGECONFIG
27PACKAGECONFIG[blank] = ""
28PACKAGECONFIG[nocursor] = ""
29
30do_install() {
31    install -d ${D}${sysconfdir}/default
32    install xserver-nodm.conf.in ${D}${sysconfdir}/default/xserver-nodm
33    install -d ${D}${sysconfdir}/xserver-nodm
34    install Xserver ${D}${sysconfdir}/xserver-nodm/Xserver
35    install -d ${D}${sysconfdir}/X11/Xsession.d
36    install X11/Xsession.d/* ${D}${sysconfdir}/X11/Xsession.d/
37    install X11/Xsession ${D}${sysconfdir}/X11/
38
39    BLANK_ARGS="${@bb.utils.contains('PACKAGECONFIG', 'blank', '', '-s 0 -dpms', d)}"
40    NO_CURSOR_ARG="${@bb.utils.contains('PACKAGECONFIG', 'nocursor', '-nocursor', '', d)}"
41    if [ "${ROOTLESS_X}" = "1" ] ; then
42        XUSER_HOME="/home/xuser"
43        XUSER="xuser"
44        install -D capability.conf ${D}${sysconfdir}/security/capability.conf
45        sed -i "s:@USER@:${XUSER}:" ${D}${sysconfdir}/security/capability.conf
46    else
47        XUSER_HOME=${ROOT_HOME}
48        XUSER="root"
49    fi
50    sed -i "s:@HOME@:${XUSER_HOME}:; s:@USER@:${XUSER}:; s:@BLANK_ARGS@:${BLANK_ARGS}:" \
51        ${D}${sysconfdir}/default/xserver-nodm
52    sed -i "s:@NO_CURSOR_ARG@:${NO_CURSOR_ARG}:" ${D}${sysconfdir}/default/xserver-nodm
53
54    if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
55        install -d ${D}${systemd_system_unitdir}
56        install -m 0644 ${WORKDIR}/xserver-nodm.service.in ${D}${systemd_system_unitdir}/xserver-nodm.service
57        sed -i "s:@USER@:${XUSER}:" ${D}${systemd_system_unitdir}/xserver-nodm.service
58    fi
59
60    if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
61        install -d ${D}${sysconfdir}/init.d
62        install xserver-nodm ${D}${sysconfdir}/init.d
63    fi
64}
65
66RDEPENDS:${PN} = "xinit ${@oe.utils.conditional('ROOTLESS_X', '1', 'xuser-account libcap libcap-bin', '', d)}"
67
68INITSCRIPT_NAME = "xserver-nodm"
69INITSCRIPT_PARAMS = "start 9 5 . stop 20 0 1 2 3 6 ."
70SYSTEMD_SERVICE:${PN} = "xserver-nodm.service"
71
72RCONFLICTS:${PN} = "xserver-common (< 1.34-r9) x11-common"
73