diff options
author | Yu Ke <ke.yu@intel.com> | 2011-02-22 20:41:19 +0800 |
---|---|---|
committer | Saul Wold <sgw@linux.intel.com> | 2011-02-23 10:55:10 -0800 |
commit | e98c515b2bdf8d54e3c2eb38c6a207bde7451d3a (patch) | |
tree | c111002aa9b91520f9362b4b69b2ed25c91f49a8 /meta/recipes-graphics | |
parent | 8d1847a9088628ee2358931d7956b6d0bdef983b (diff) | |
download | poky-e98c515b2bdf8d54e3c2eb38c6a207bde7451d3a.tar.gz |
xserver-nodm-init: add rootless-x support
most rootless X work are already done in the kernel, xserver and
graphics driver, this patches add the the remaining userspace setting:
- create /etc/X11/Xusername to set rootless X user
- add rootless X user to group video, tty to access /dev/tty[0-4]
and /dev/dri/card0
- grant rootless X user access right to /dev/input/*, /var/log
Signed-off-by: Yu Ke <ke.yu@intel.com>
Diffstat (limited to 'meta/recipes-graphics')
3 files changed, 26 insertions, 1 deletions
diff --git a/meta/recipes-graphics/x11-common/xserver-nodm-init.bb b/meta/recipes-graphics/x11-common/xserver-nodm-init.bb index 03a6ca3b56..a93acc9ee3 100644 --- a/meta/recipes-graphics/x11-common/xserver-nodm-init.bb +++ b/meta/recipes-graphics/x11-common/xserver-nodm-init.bb | |||
@@ -3,10 +3,11 @@ LICENSE = "GPLv2" | |||
3 | LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe" | 3 | LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe" |
4 | SECTION = "x11" | 4 | SECTION = "x11" |
5 | PRIORITY = "optional" | 5 | PRIORITY = "optional" |
6 | PR = "r23" | 6 | PR = "r24" |
7 | RDEPENDS_${PN} = "dbus-wait sudo" | 7 | RDEPENDS_${PN} = "dbus-wait sudo" |
8 | 8 | ||
9 | SRC_URI = "file://xserver-nodm \ | 9 | SRC_URI = "file://xserver-nodm \ |
10 | file://Xusername \ | ||
10 | file://gplv2-license.patch" | 11 | file://gplv2-license.patch" |
11 | 12 | ||
12 | S = ${WORKDIR} | 13 | S = ${WORKDIR} |
@@ -17,6 +18,25 @@ do_install() { | |||
17 | install -d ${D}/etc | 18 | install -d ${D}/etc |
18 | install -d ${D}/etc/init.d | 19 | install -d ${D}/etc/init.d |
19 | install xserver-nodm ${D}/etc/init.d | 20 | install xserver-nodm ${D}/etc/init.d |
21 | if [ "${ROOTLESS_X}" = "1" ] ; then | ||
22 | install -d ${D}/etc/X11 | ||
23 | install Xusername ${D}/etc/X11 | ||
24 | fi | ||
25 | } | ||
26 | |||
27 | pkg_postinst_${PN} () { | ||
28 | if [ "x$D" != "x" ] ; then | ||
29 | exit 1 | ||
30 | fi | ||
31 | |||
32 | if [ -f /etc/X11/Xusername ]; then | ||
33 | # create the rootless X user, and add user to group tty, video | ||
34 | username=`cat /etc/X11/Xusername` | ||
35 | adduser --disabled-password $username | ||
36 | # FIXME: use addgroup if busybox addgroup is ready | ||
37 | sed -i -e "s/^video:.*/&${username}/g" /etc/group | ||
38 | sed -i -e "s/^tty:.*/&${username}/g" /etc/group | ||
39 | fi | ||
20 | } | 40 | } |
21 | 41 | ||
22 | inherit update-rc.d | 42 | inherit update-rc.d |
diff --git a/meta/recipes-graphics/x11-common/xserver-nodm-init/Xusername b/meta/recipes-graphics/x11-common/xserver-nodm-init/Xusername new file mode 100644 index 0000000000..7060e5ec16 --- /dev/null +++ b/meta/recipes-graphics/x11-common/xserver-nodm-init/Xusername | |||
@@ -0,0 +1 @@ | |||
xuser | |||
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 69ea949724..d8c4ba0d11 100755 --- a/meta/recipes-graphics/x11-common/xserver-nodm-init/xserver-nodm +++ b/meta/recipes-graphics/x11-common/xserver-nodm-init/xserver-nodm | |||
@@ -30,6 +30,10 @@ case "$1" in | |||
30 | echo "Starting Xserver" | 30 | echo "Starting Xserver" |
31 | if [ -f /etc/X11/Xusername ]; then | 31 | if [ -f /etc/X11/Xusername ]; then |
32 | username=`cat /etc/X11/Xusername` | 32 | username=`cat /etc/X11/Xusername` |
33 | # setting for rootless X | ||
34 | chmod o+w /var/log | ||
35 | chmod g+r /dev/tty[0-3] | ||
36 | chmod o+rw /dev/input/* | ||
33 | fi | 37 | fi |
34 | # Using sudo -i here has the nice side effect of making sire | 38 | # Using sudo -i here has the nice side effect of making sire |
35 | # HOME, USER and other previously problematic variables | 39 | # HOME, USER and other previously problematic variables |