diff --git a/meta/recipes-core/dbus/dbus.inc b/meta/recipes-core/dbus/dbus.inc index a8ecda8..7010002 100644 --- a/meta/recipes-core/dbus/dbus.inc +++ b/meta/recipes-core/dbus/dbus.inc @@ -14,11 +14,21 @@ SRC_URI = "http://dbus.freedesktop.org/releases/dbus/dbus-${PV}.tar.gz \ file://tmpdir.patch; \ file://dbus-1.init" -inherit autotools pkgconfig gettext update-rc.d +inherit autotools pkgconfig gettext update-rc.d useradd + +USERADD_PACKAGES = "${PN}" +USERADD_PARAM_${PN} = "-d ${MESSAGEHOME} -g ${MESSAGEUSER} -r -N ${MESSAGEUSER}" +GROUPADD_PARAM_${PN} = "${MESSAGEUSER}; netdev" +USERADD_PARAM_${PN}_virtclass-native = "" +GROUPADD_PARAM_${PN}_virtclass-native = "" INITSCRIPT_NAME = "dbus-1" INITSCRIPT_PARAMS = "start 02 5 3 2 . stop 20 0 1 6 ." +MESSAGEUSER=messagebus +MESSAGEHOME="${localstatedir}/run/dbus" +UUIDDIR="${localstatedir}/lib/dbus" + CONFFILES_${PN} = "${sysconfdir}/dbus-1/system.conf ${sysconfdir}/dbus-1/session.conf" DEBIANNAME_${PN} = "dbus-1" @@ -38,38 +48,22 @@ FILES_${PN} = "${bindir}/dbus-daemon* \ ${libexecdir}/dbus* \ ${sysconfdir} \ ${datadir}/dbus-1/services \ - ${datadir}/dbus-1/system-services" + ${datadir}/dbus-1/system-services \ + ${MESSAGEHOME} \ + ${UUIDDIR}" FILES_${PN}-lib = "${libdir}/lib*.so.*" RRECOMMENDS_${PN}-lib = "${PN}" FILES_${PN}-dev += "${libdir}/dbus-1.0/include ${bindir}/dbus-glib-tool" -pkg_postinst_dbus() { - # can't do adduser stuff offline - if [ "x$D" != "x" ]; then - exit 1 - fi - - MESSAGEUSER=messagebus - MESSAGEHOME=/var/run/dbus - UUIDDIR=/var/lib/dbus - - mkdir -p $MESSAGEHOME - mkdir -p $UUIDDIR - chgrp "$MESSAGEUSER" "$MESSAGEHOME" 2>/dev/null || addgroup "$MESSAGEUSER" - chown "$MESSAGEUSER":"$MESSAGEUSER" "$MESSAGEHOME" 2>/dev/null || \ - adduser --system --home "$MESSAGEHOME" --no-create-home --disabled-password \ - --ingroup "$MESSAGEUSER" "$MESSAGEUSER" +pkg_postinst_${PN}() { + chgrp "${MESSAGEUSER}" "${MESSAGEHOME}" + chown "${MESSAGEUSER}":"${MESSAGEUSER}" "${MESSAGEHOME}" + chown "${MESSAGEUSER}":"${MESSAGEUSER}" "${UUIDDIR}" - chown "$MESSAGEUSER":"$MESSAGEUSER" "$UUIDDIR" + chown root:"${MESSAGEUSER}" $D${libexecdir}/dbus-daemon-launch-helper + chmod 4754 $D${libexecdir}/dbus-daemon-launch-helper - grep -q netdev: /etc/group || addgroup netdev - - chown root:"$MESSAGEUSER" /usr/libexec/dbus-daemon-launch-helper - chmod 4754 /usr/libexec/dbus-daemon-launch-helper - - # add volatile after new user/grp are created - echo "d messagebus messagebus 0755 /var/run/dbus none" > /etc/default/volatiles/99_dbus - if [ -e /etc/init.d/populate-volatile.sh ] ; then + if [ -z "$D" ] && [ -e /etc/init.d/populate-volatile.sh ] ; then /etc/init.d/populate-volatile.sh update fi } @@ -95,6 +89,12 @@ do_install() { # disable dbus-1 sysv script on systemd installs # nearly all distros call the initscript plain 'dbus', but OE-core is different ln -sf /dev/null ${D}/${base_libdir}/systemd/system/dbus-1.service + + install -d ${D}${UUIDDIR} + install -d ${D}${MESSAGEHOME} + + install -d ${D}${sysconfdir}/default/volatiles + echo "d messagebus messagebus 0755 /var/run/dbus none" > ${D}${sysconfdir}/default/volatiles/99_dbus } do_install_virtclass-native() {