From: Phil Blundell <philb@gnu.org>
To: Patches and discussions about the oe-core layer
<openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH 2/7] shadow: add a -native recipe with customized utilities
Date: Thu, 01 Sep 2011 17:41:31 +0100 [thread overview]
Message-ID: <1314895291.19905.197.camel@phil-desktop> (raw)
In-Reply-To: 7826575ce92090c4460c7d016e0b06441f84cff7.1306865217.git.scott.a.garman@intel.com
[-- Attachment #1: Type: text/plain, Size: 1846 bytes --]
On Thu, 2011-09-01 at 15:46 +0100, Phil Blundell wrote:
> I just tried using useradd.bbclass for the first time (in an effort to
> make dbus installable on a readonly-rootfs) and it doesn't seem to be
> working very well for me.
>
> The root of my problem seems to be the code below. As far as I can
> tell, what's happening is that process_root_flag() consumes all the
> command line arguments to useradd, which means that the subsequent call
> to getopt() in process_flags() just returns immediately because there is
> nothing left for it to do. The upshot of all this is that the switches
> on the command line are simply ignored and useradd doesn't do what I
> wanted.
>
> Is anybody else using this code successfully in oe-core with a
> nontrivial USERADD_PARAM?
So, I added a strategic "optind = 1" to useradd.c and the situation
seems to have improved a bit. However, I've encountered a couple of
other issues which are slightly annoying:
a) with the attached patch, dbus itself no longer requires a postinst to
be run at boot time. Which is cool. Unfortunately, inheriting useradd
causes it to now depend on shadow (which wasn't previously in my image)
and shadow itself isn't currently amenable to read-only-rootfs either so
my image build still fails. I guess the answer to this is to have
shadow excluded (by some or other mechanism) during rootfs construction
for non-package-management-enabled images.
b) the useradd.bbclass stuff seems to try to apply itself to
virtclass-native packages as well, which was causing an error during
do_install() for dbus-native. I worked around this by adding
USERADD_PARAM_${PN}_virtclass-native = ""
GROUPADD_PARAM_${PN}_virtclass-native = ""
to the recipe, but it seems as though the class should probably be
sorting this out for itself.
p.
[-- Attachment #2: dbus.diff --]
[-- Type: text/x-patch, Size: 3403 bytes --]
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() {
next prev parent reply other threads:[~2011-09-01 16:46 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-31 19:53 [PATCH 0/7] User/group creation at preinstall Scott Garman
2011-05-31 18:45 ` [poky] " Koen Kooi
2011-05-31 19:06 ` Saul Wold
2011-05-31 19:51 ` Scott Garman
2011-05-31 19:57 ` Otavio Salvador
2011-05-31 21:16 ` Mark Hatle
2011-05-31 21:27 ` Scott Garman
2011-05-31 21:51 ` Richard Purdie
2011-05-31 21:25 ` Richard Purdie
2011-05-31 19:53 ` [PATCH 1/7] shadow: recipe and patch cleanup Scott Garman
2011-05-31 19:53 ` [PATCH 2/7] shadow: add a -native recipe with customized utilities Scott Garman
2011-06-01 9:47 ` Phil Blundell
2011-06-01 12:34 ` Martyn Welch
2011-06-01 13:42 ` Phil Blundell
2011-06-01 17:43 ` Scott Garman
2011-06-01 21:05 ` Mark Hatle
2011-06-02 11:19 ` Phil Blundell
2011-09-01 14:46 ` Phil Blundell
2011-09-01 16:41 ` Phil Blundell [this message]
2011-09-01 16:54 ` Mark Hatle
2011-09-01 16:58 ` Phil Blundell
2011-09-01 17:25 ` Mark Hatle
2011-09-01 19:44 ` Phil Blundell
2011-09-01 21:59 ` Richard Purdie
2011-09-02 0:02 ` Mark Hatle
2011-09-02 7:15 ` Phil Blundell
2011-09-02 9:50 ` Phil Blundell
2011-09-02 14:03 ` Richard Purdie
2011-09-02 18:43 ` Phil Blundell
2011-09-02 19:17 ` Mark Hatle
2011-05-31 19:53 ` [PATCH 3/7] base-passwd: add -cross recipe with default login.defs Scott Garman
2011-05-31 19:53 ` [PATCH 4/7] useradd.bbclass: new class for managing user/group permissions Scott Garman
2011-05-31 19:53 ` [PATCH 5/7] useradd-example: example recipe for using inherit useradd Scott Garman
2011-05-31 19:53 ` [PATCH 6/7] bitbake.conf: set PSEUDO_PASSWD within FAKEROOTENV Scott Garman
2011-05-31 19:53 ` [PATCH 7/7] package_rpm.bbclass: make RPM use on-disk permissions Scott Garman
-- strict thread matches above, loose matches on Subject: below --
2011-06-02 23:50 [PATCH 0/7] User/group creation at preinstall v2 Scott Garman
2011-06-02 23:50 ` [PATCH 2/7] shadow: add a -native recipe with customized utilities Scott Garman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1314895291.19905.197.camel@phil-desktop \
--to=philb@gnu.org \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox