diff options
author | Otavio Salvador <otavio@ossystems.com.br> | 2011-10-21 02:49:51 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-10-24 17:27:15 +0100 |
commit | dbf48baf90b254adb685049b84a83188d078f2ac (patch) | |
tree | d5ef99eb2c9a6a7e1e0fdbf2e11f6f6e260d6e84 | |
parent | b0dae14eee78e94c7e0577b146a3897a8cb382ad (diff) | |
download | poky-dbf48baf90b254adb685049b84a83188d078f2ac.tar.gz |
dbus: use useradd class to allow use in read-only filesystems
Move creation of required user/groups to useradd class thus allowing
use with read-only filesystems and booting the initial boot.
(From OE-Core rev: 46e6c3fa8034b12d178d605f3f5d7efe69671a13)
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/recipes-core/dbus/dbus.inc | 48 |
1 files changed, 21 insertions, 27 deletions
diff --git a/meta/recipes-core/dbus/dbus.inc b/meta/recipes-core/dbus/dbus.inc index a8ecda8d4f..2a97c028e6 100644 --- a/meta/recipes-core/dbus/dbus.inc +++ b/meta/recipes-core/dbus/dbus.inc | |||
@@ -10,15 +10,22 @@ DEPENDS = "expat virtual/libintl ${@base_contains('DISTRO_FEATURES', 'x11', '${X | |||
10 | DEPENDS_virtclass-native = "expat-native virtual/libintl-native" | 10 | DEPENDS_virtclass-native = "expat-native virtual/libintl-native" |
11 | DEPENDS_virtclass-nativesdk = "expat-nativesdk virtual/libintl-nativesdk virtual/libx11" | 11 | DEPENDS_virtclass-nativesdk = "expat-nativesdk virtual/libintl-nativesdk virtual/libx11" |
12 | 12 | ||
13 | PR = "r1" | ||
14 | |||
13 | SRC_URI = "http://dbus.freedesktop.org/releases/dbus/dbus-${PV}.tar.gz \ | 15 | SRC_URI = "http://dbus.freedesktop.org/releases/dbus/dbus-${PV}.tar.gz \ |
14 | file://tmpdir.patch; \ | 16 | file://tmpdir.patch; \ |
15 | file://dbus-1.init" | 17 | file://dbus-1.init" |
16 | 18 | ||
17 | inherit autotools pkgconfig gettext update-rc.d | 19 | inherit useradd autotools pkgconfig gettext update-rc.d |
18 | 20 | ||
19 | INITSCRIPT_NAME = "dbus-1" | 21 | INITSCRIPT_NAME = "dbus-1" |
20 | INITSCRIPT_PARAMS = "start 02 5 3 2 . stop 20 0 1 6 ." | 22 | INITSCRIPT_PARAMS = "start 02 5 3 2 . stop 20 0 1 6 ." |
21 | 23 | ||
24 | USERADD_PACKAGES = "${PN}" | ||
25 | GROUPADD_PARAM_${PN} = "-r netdev" | ||
26 | USERADD_PARAM_${PN} = "--system --home ${localstatedir}/lib/dbus \ | ||
27 | --no-create-home --user-group messagebus" | ||
28 | |||
22 | CONFFILES_${PN} = "${sysconfdir}/dbus-1/system.conf ${sysconfdir}/dbus-1/session.conf" | 29 | CONFFILES_${PN} = "${sysconfdir}/dbus-1/system.conf ${sysconfdir}/dbus-1/session.conf" |
23 | 30 | ||
24 | DEBIANNAME_${PN} = "dbus-1" | 31 | DEBIANNAME_${PN} = "dbus-1" |
@@ -44,32 +51,7 @@ RRECOMMENDS_${PN}-lib = "${PN}" | |||
44 | FILES_${PN}-dev += "${libdir}/dbus-1.0/include ${bindir}/dbus-glib-tool" | 51 | FILES_${PN}-dev += "${libdir}/dbus-1.0/include ${bindir}/dbus-glib-tool" |
45 | 52 | ||
46 | pkg_postinst_dbus() { | 53 | pkg_postinst_dbus() { |
47 | # can't do adduser stuff offline | 54 | if [ -z "${D}" ] && [ -e /etc/init.d/populate-volatile.sh ] ; then |
48 | if [ "x$D" != "x" ]; then | ||
49 | exit 1 | ||
50 | fi | ||
51 | |||
52 | MESSAGEUSER=messagebus | ||
53 | MESSAGEHOME=/var/run/dbus | ||
54 | UUIDDIR=/var/lib/dbus | ||
55 | |||
56 | mkdir -p $MESSAGEHOME | ||
57 | mkdir -p $UUIDDIR | ||
58 | chgrp "$MESSAGEUSER" "$MESSAGEHOME" 2>/dev/null || addgroup "$MESSAGEUSER" | ||
59 | chown "$MESSAGEUSER":"$MESSAGEUSER" "$MESSAGEHOME" 2>/dev/null || \ | ||
60 | adduser --system --home "$MESSAGEHOME" --no-create-home --disabled-password \ | ||
61 | --ingroup "$MESSAGEUSER" "$MESSAGEUSER" | ||
62 | |||
63 | chown "$MESSAGEUSER":"$MESSAGEUSER" "$UUIDDIR" | ||
64 | |||
65 | grep -q netdev: /etc/group || addgroup netdev | ||
66 | |||
67 | chown root:"$MESSAGEUSER" /usr/libexec/dbus-daemon-launch-helper | ||
68 | chmod 4754 /usr/libexec/dbus-daemon-launch-helper | ||
69 | |||
70 | # add volatile after new user/grp are created | ||
71 | echo "d messagebus messagebus 0755 /var/run/dbus none" > /etc/default/volatiles/99_dbus | ||
72 | if [ -e /etc/init.d/populate-volatile.sh ] ; then | ||
73 | /etc/init.d/populate-volatile.sh update | 55 | /etc/init.d/populate-volatile.sh update |
74 | fi | 56 | fi |
75 | } | 57 | } |
@@ -92,6 +74,18 @@ do_install() { | |||
92 | install -d ${D}${sysconfdir}/init.d | 74 | install -d ${D}${sysconfdir}/init.d |
93 | install -m 0755 ${WORKDIR}/dbus-1.init ${D}${sysconfdir}/init.d/dbus-1 | 75 | install -m 0755 ${WORKDIR}/dbus-1.init ${D}${sysconfdir}/init.d/dbus-1 |
94 | 76 | ||
77 | install -d ${D}${sysconfdir}/default/volatiles | ||
78 | echo "d messagebus messagebus 0755 ${localstatedir}/run/dbus none" \ | ||
79 | > ${D}${sysconfdir}/default/volatiles/99_dbus | ||
80 | |||
81 | |||
82 | mkdir -p ${D}${localstatedir}/run/dbus ${D}${localstatedir}/lib/dbus | ||
83 | |||
84 | chown messagebus:messagebus ${D}${localstatedir}/run/dbus ${D}${localstatedir}/lib/dbus | ||
85 | |||
86 | chown root:messagebus ${D}${libexecdir}/dbus-daemon-launch-helper | ||
87 | chmod 4754 ${D}${libexecdir}/dbus-daemon-launch-helper | ||
88 | |||
95 | # disable dbus-1 sysv script on systemd installs | 89 | # disable dbus-1 sysv script on systemd installs |
96 | # nearly all distros call the initscript plain 'dbus', but OE-core is different | 90 | # nearly all distros call the initscript plain 'dbus', but OE-core is different |
97 | ln -sf /dev/null ${D}/${base_libdir}/systemd/system/dbus-1.service | 91 | ln -sf /dev/null ${D}/${base_libdir}/systemd/system/dbus-1.service |