Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 4/4] dbus: use useradd class to allow use in read-only filesystems
  2011-10-21  3:31 [PATCH 0/4] Fixes and improvements from O.S. Systems Otavio Salvador
@ 2011-10-21  3:31 ` Otavio Salvador
  2011-10-21  6:54   ` Phil Blundell
  0 siblings, 1 reply; 12+ messages in thread
From: Otavio Salvador @ 2011-10-21  3:31 UTC (permalink / raw)
  To: openembedded-core

Move creation of required user/groups to useradd class thus allowing
use with read-only filesystems and booting the initial boot.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
 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 a8ecda8..2a97c02 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
 DEPENDS_virtclass-native = "expat-native virtual/libintl-native"
 DEPENDS_virtclass-nativesdk = "expat-nativesdk virtual/libintl-nativesdk virtual/libx11"
 
+PR = "r1"
+
 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 useradd autotools pkgconfig gettext update-rc.d
 
 INITSCRIPT_NAME = "dbus-1"
 INITSCRIPT_PARAMS = "start 02 5 3 2 . stop 20 0 1 6 ."
 
+USERADD_PACKAGES = "${PN}"
+GROUPADD_PARAM_${PN} = "-r netdev"
+USERADD_PARAM_${PN} = "--system --home ${localstatedir}/lib/dbus \
+                       --no-create-home --user-group messagebus"
+
 CONFFILES_${PN} = "${sysconfdir}/dbus-1/system.conf ${sysconfdir}/dbus-1/session.conf"
 
 DEBIANNAME_${PN} = "dbus-1"
@@ -44,32 +51,7 @@ 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"
-
-	chown "$MESSAGEUSER":"$MESSAGEUSER" "$UUIDDIR"
-
-	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
 }
@@ -92,6 +74,18 @@ do_install() {
 	install -d ${D}${sysconfdir}/init.d
 	install -m 0755 ${WORKDIR}/dbus-1.init ${D}${sysconfdir}/init.d/dbus-1
 
+	install -d ${D}${sysconfdir}/default/volatiles
+	echo "d messagebus messagebus 0755 ${localstatedir}/run/dbus none" \
+	     > ${D}${sysconfdir}/default/volatiles/99_dbus
+
+
+	mkdir -p ${D}${localstatedir}/run/dbus ${D}${localstatedir}/lib/dbus
+
+	chown messagebus:messagebus ${D}${localstatedir}/run/dbus ${D}${localstatedir}/lib/dbus
+
+	chown root:messagebus ${D}${libexecdir}/dbus-daemon-launch-helper
+	chmod 4754 ${D}${libexecdir}/dbus-daemon-launch-helper
+
 	# 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
-- 
1.7.2.5




^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 4/4] dbus: use useradd class to allow use in read-only filesystems
  2011-10-21  3:31 ` [PATCH 4/4] dbus: use useradd class to allow use in read-only filesystems Otavio Salvador
@ 2011-10-21  6:54   ` Phil Blundell
  2011-10-21  7:05     ` Koen Kooi
  0 siblings, 1 reply; 12+ messages in thread
From: Phil Blundell @ 2011-10-21  6:54 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

On Fri, 2011-10-21 at 03:31 +0000, Otavio Salvador wrote:
> +USERADD_PACKAGES = "${PN}"
> +GROUPADD_PARAM_${PN} = "-r netdev"
> +USERADD_PARAM_${PN} = "--system --home ${localstatedir}/lib/dbus \
> +                       --no-create-home --user-group messagebus"

Why does dbus need "netdev"?

p.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 4/4] dbus: use useradd class to allow use in read-only filesystems
  2011-10-21  6:54   ` Phil Blundell
@ 2011-10-21  7:05     ` Koen Kooi
  0 siblings, 0 replies; 12+ messages in thread
From: Koen Kooi @ 2011-10-21  7:05 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer


Op 21 okt. 2011, om 08:54 heeft Phil Blundell het volgende geschreven:

> On Fri, 2011-10-21 at 03:31 +0000, Otavio Salvador wrote:
>> +USERADD_PACKAGES = "${PN}"
>> +GROUPADD_PARAM_${PN} = "-r netdev"
>> +USERADD_PARAM_${PN} = "--system --home ${localstatedir}/lib/dbus \
>> +                       --no-create-home --user-group messagebus"
> 
> Why does dbus need "netdev"?


A little digging on the internet shows that some applications using dbus use netdev and as a result dbus will complain about a missing netdev group. Dbus itself doesn't seem to need it. A handfull of searchresults imply that not dbus but e.g. networkmanager and wpa-supplicant should create the group, but:

root@beagleboard:/etc/dbus-1/system.d# ls
ConsoleKit.conf           org.freedesktop.PolicyKit1.conf
NetworkManager.conf       org.freedesktop.UDisks.conf
avahi-dbus.conf           org.freedesktop.UPower.conf
bluetooth.conf            org.freedesktop.hostname1.conf
dbus-wpa_supplicant.conf  org.freedesktop.locale1.conf
gdm.conf                  org.freedesktop.login1.conf
nm-avahi-autoipd.conf     org.freedesktop.systemd1.conf
nm-dhcp-client.conf       org.freedesktop.timedate1.conf
nm-dispatcher.conf        org.gnome.GConf.Defaults.conf

root@beagleboard:/etc/dbus-1/system.d# grep netdev *
root@beagleboard:/etc/dbus-1/system.d# 

So it seems (but I am not certain!) that netdev is a relic of the past and can go away. What I would propose:

1) convert the existing *inst to useradd.bbclass
2) bump PR, remove netdev

That should give us a nice bisectable stack of commits.

regards,

Koen


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 0/4 v2] Fixes and improvements
@ 2011-10-21 14:10 Otavio Salvador
  2011-10-21 14:10 ` [PATCH 1/4] bootimg.bbclass: add support to disable HDD image building Otavio Salvador
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Otavio Salvador @ 2011-10-21 14:10 UTC (permalink / raw)
  To: openembedded-core

The following changes since commit 99da9a4e65f9dffb04efc3ad60125194c476d6b3:

  distro-tracking-fields: update fields for tzdata and gst-plugins-good (2011-10-20 13:07:16 +0100)

are available in the git repository at:
  git://github.com/OSSystems/oe-core master
  https://github.com/OSSystems/oe-core/tree/HEAD

Otavio Salvador (4):
  bootimg.bbclass: add support to disable HDD image building
  useradd.bbclass: check if a group already exists manually
  base-passwd: move initial criation of group and passwd to preinst
  dbus: use useradd class to allow use in read-only filesystems

 meta/classes/bootimg.bbclass                       |   44 +++++++++---------
 meta/classes/useradd.bbclass                       |    8 +++-
 .../recipes-core/base-passwd/base-passwd_3.5.22.bb |   19 +++++++-
 meta/recipes-core/dbus/dbus.inc                    |   48 +++++++++-----------
 4 files changed, 69 insertions(+), 50 deletions(-)

-- 
1.7.2.5




^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/4] bootimg.bbclass: add support to disable HDD image building
  2011-10-21 14:10 [PATCH 0/4 v2] Fixes and improvements Otavio Salvador
@ 2011-10-21 14:10 ` Otavio Salvador
  2011-10-21 14:10 ` [PATCH 2/4] useradd.bbclass: check if a group already exists manually Otavio Salvador
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 12+ messages in thread
From: Otavio Salvador @ 2011-10-21 14:10 UTC (permalink / raw)
  To: openembedded-core

If an image sets NOHDD = "1" the HDD image won't be build.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
 meta/classes/bootimg.bbclass |   44 +++++++++++++++++++++--------------------
 1 files changed, 23 insertions(+), 21 deletions(-)

diff --git a/meta/classes/bootimg.bbclass b/meta/classes/bootimg.bbclass
index a5ba3cf..eecc2bf 100644
--- a/meta/classes/bootimg.bbclass
+++ b/meta/classes/bootimg.bbclass
@@ -48,34 +48,36 @@ SYSLINUXMENU = "${HDDDIR}/menu"
 inherit syslinux
 		
 build_boot_bin() {
-	install -d ${HDDDIR}
-	install -m 0644 ${STAGING_DIR_HOST}/kernel/bzImage \
-	${HDDDIR}/vmlinuz
+	# Create an HDD image
+	if [ "${NOHDD}" != "1" ] ; then
+		install -d ${HDDDIR}
+		install -m 0644 ${STAGING_DIR_HOST}/kernel/bzImage \
+		${HDDDIR}/vmlinuz
 
-	if [ -n "${INITRD}" ] && [ -s "${INITRD}" ]; then 
-    		install -m 0644 ${INITRD} ${HDDDIR}/initrd
-	fi
+		if [ -n "${INITRD}" ] && [ -s "${INITRD}" ]; then
+				install -m 0644 ${INITRD} ${HDDDIR}/initrd
+		fi
 
-	if [ -n "${ROOTFS}" ] && [ -s "${ROOTFS}" ]; then 
-    		install -m 0644 ${ROOTFS} ${HDDDIR}/rootfs.img
-	fi
+		if [ -n "${ROOTFS}" ] && [ -s "${ROOTFS}" ]; then
+				install -m 0644 ${ROOTFS} ${HDDDIR}/rootfs.img
+		fi
 
-	install -m 444 ${STAGING_LIBDIR}/syslinux/ldlinux.sys ${HDDDIR}/ldlinux.sys
+		install -m 444 ${STAGING_LIBDIR}/syslinux/ldlinux.sys ${HDDDIR}/ldlinux.sys
 
-	# Do a little math, bash style
-	#BLOCKS=`du -s ${HDDDIR} | cut -f 1`
-	BLOCKS=`du -bks ${HDDDIR} | cut -f 1`
-	SIZE=`expr $BLOCKS + ${BOOTIMG_EXTRA_SPACE}`	
+		# Do a little math, bash style
+		BLOCKS=`du -bks ${HDDDIR} | cut -f 1`
+		SIZE=`expr $BLOCKS + ${BOOTIMG_EXTRA_SPACE}`
 
-	mkdosfs -n ${BOOTIMG_VOLUME_ID} -d ${HDDDIR} \
-	-C ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg $SIZE 
+		mkdosfs -n ${BOOTIMG_VOLUME_ID} -d ${HDDDIR} \
+		-C ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg $SIZE
 
-	syslinux ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg
-	chmod 644 ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg
+		syslinux ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg
+		chmod 644 ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg
 
-	cd ${DEPLOY_DIR_IMAGE}
-	rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hddimg
-	ln -s ${IMAGE_NAME}.hddimg ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hddimg
+		cd ${DEPLOY_DIR_IMAGE}
+		rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hddimg
+		ln -s ${IMAGE_NAME}.hddimg ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hddimg
+	fi
 	
 	#Create an ISO if we have an INITRD
 	if [ -n "${INITRD}" ] && [ -s "${INITRD}" ] && [ "${NOISO}" != "1" ] ; then
-- 
1.7.2.5




^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/4] useradd.bbclass: check if a group already exists manually
  2011-10-21 14:10 [PATCH 0/4 v2] Fixes and improvements Otavio Salvador
  2011-10-21 14:10 ` [PATCH 1/4] bootimg.bbclass: add support to disable HDD image building Otavio Salvador
@ 2011-10-21 14:10 ` Otavio Salvador
  2011-10-21 14:10 ` [PATCH 3/4] base-passwd: move initial criation of group and passwd to preinst Otavio Salvador
  2011-10-21 14:10 ` [PATCH 4/4] dbus: use useradd class to allow use in read-only filesystems Otavio Salvador
  3 siblings, 0 replies; 12+ messages in thread
From: Otavio Salvador @ 2011-10-21 14:10 UTC (permalink / raw)
  To: openembedded-core

The use of groupadd -f makes much more difficult to figure when a
group is not add. This was the case of the class not working for our
usage and this being caused by the lack of '/etc/group' file but
unnoticed as groupadd wasn't failing according.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
 meta/classes/useradd.bbclass |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/meta/classes/useradd.bbclass b/meta/classes/useradd.bbclass
index 1e03a04..fb70b3e 100644
--- a/meta/classes/useradd.bbclass
+++ b/meta/classes/useradd.bbclass
@@ -37,7 +37,13 @@ if test "x$GROUPADD_PARAM" != "x"; then
 	opts=`echo "$GROUPADD_PARAM" | cut -d ';' -f 1`
 	remaining=`echo "$GROUPADD_PARAM" | cut -d ';' -f 2-`
 	while test "x$opts" != "x"; do
-		eval $PSEUDO groupadd -f $OPT $opts
+		groupname=`echo "$opts" | awk '{ print $NF }'`
+		group_exists=`grep "^$groupname:" $SYSROOT/etc/group || true`
+		if test "x$group_exists" = "x"; then
+			eval $PSEUDO groupadd  $OPT $opts
+		else
+			echo "Note: group $groupname already exists, not re-creating it"
+		fi
 
 		if test "x$opts" = "x$remaining"; then
 			break
-- 
1.7.2.5




^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 3/4] base-passwd: move initial criation of group and passwd to preinst
  2011-10-21 14:10 [PATCH 0/4 v2] Fixes and improvements Otavio Salvador
  2011-10-21 14:10 ` [PATCH 1/4] bootimg.bbclass: add support to disable HDD image building Otavio Salvador
  2011-10-21 14:10 ` [PATCH 2/4] useradd.bbclass: check if a group already exists manually Otavio Salvador
@ 2011-10-21 14:10 ` Otavio Salvador
  2011-10-21 14:52   ` Mark Hatle
  2011-10-21 14:10 ` [PATCH 4/4] dbus: use useradd class to allow use in read-only filesystems Otavio Salvador
  3 siblings, 1 reply; 12+ messages in thread
From: Otavio Salvador @ 2011-10-21 14:10 UTC (permalink / raw)
  To: openembedded-core

To allow use and manipulation of users and groups at rootfs building
time, the '/etc/passwd' and '/etc/group' needs to be available as soon
as possible.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
 .../recipes-core/base-passwd/base-passwd_3.5.22.bb |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/meta/recipes-core/base-passwd/base-passwd_3.5.22.bb b/meta/recipes-core/base-passwd/base-passwd_3.5.22.bb
index 137512d..aa90a6d 100644
--- a/meta/recipes-core/base-passwd/base-passwd_3.5.22.bb
+++ b/meta/recipes-core/base-passwd/base-passwd_3.5.22.bb
@@ -1,7 +1,7 @@
 SUMMARY = "Base system master password/group files."
 DESCRIPTION = "The master copies of the user database files (/etc/passwd and /etc/group).  The update-passwd tool is also provided to keep the system databases synchronized with these master files."
 SECTION = "base"
-PR = "r3"
+PR = "r4"
 LICENSE = "GPLv2+"
 LIC_FILES_CHKSUM = "file://COPYING;md5=eb723b61539feef013de476e68b5c50a"
 
@@ -37,6 +37,23 @@ do_install () {
 	install -p -m 644 debian/copyright ${D}${docdir}/${BPN}/
 }
 
+pkg_preinst_${PN} () {
+	set -e
+
+	# Used for rootfs generation. On in-target install this will be run
+        # before the unpack so the files won't be available
+
+	if [ ! -e $D${sysconfdir}/passwd ] && [ -e $D${datadir}/base-passwd/passwd.master ]; then
+		cp $D${datadir}/base-passwd/passwd.master $D${sysconfdir}/passwd
+	fi
+
+	if [ ! -e $D${sysconfdir}/group ] && [ -e $D${datadir}/base-passwd/group.master ]; then
+		cp $D${datadir}/base-passwd/group.master $D${sysconfdir}/group
+	fi
+
+	exit 0
+}
+
 pkg_postinst_${PN} () {
 	set -e
 
-- 
1.7.2.5




^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 4/4] dbus: use useradd class to allow use in read-only filesystems
  2011-10-21 14:10 [PATCH 0/4 v2] Fixes and improvements Otavio Salvador
                   ` (2 preceding siblings ...)
  2011-10-21 14:10 ` [PATCH 3/4] base-passwd: move initial criation of group and passwd to preinst Otavio Salvador
@ 2011-10-21 14:10 ` Otavio Salvador
  2011-10-21 17:03   ` Saul Wold
  3 siblings, 1 reply; 12+ messages in thread
From: Otavio Salvador @ 2011-10-21 14:10 UTC (permalink / raw)
  To: openembedded-core

Move creation of required user/groups to useradd class thus allowing
use with read-only filesystems and booting the initial boot.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
 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 a8ecda8..2a97c02 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
 DEPENDS_virtclass-native = "expat-native virtual/libintl-native"
 DEPENDS_virtclass-nativesdk = "expat-nativesdk virtual/libintl-nativesdk virtual/libx11"
 
+PR = "r1"
+
 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 useradd autotools pkgconfig gettext update-rc.d
 
 INITSCRIPT_NAME = "dbus-1"
 INITSCRIPT_PARAMS = "start 02 5 3 2 . stop 20 0 1 6 ."
 
+USERADD_PACKAGES = "${PN}"
+GROUPADD_PARAM_${PN} = "-r netdev"
+USERADD_PARAM_${PN} = "--system --home ${localstatedir}/lib/dbus \
+                       --no-create-home --user-group messagebus"
+
 CONFFILES_${PN} = "${sysconfdir}/dbus-1/system.conf ${sysconfdir}/dbus-1/session.conf"
 
 DEBIANNAME_${PN} = "dbus-1"
@@ -44,32 +51,7 @@ 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"
-
-	chown "$MESSAGEUSER":"$MESSAGEUSER" "$UUIDDIR"
-
-	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
 }
@@ -92,6 +74,18 @@ do_install() {
 	install -d ${D}${sysconfdir}/init.d
 	install -m 0755 ${WORKDIR}/dbus-1.init ${D}${sysconfdir}/init.d/dbus-1
 
+	install -d ${D}${sysconfdir}/default/volatiles
+	echo "d messagebus messagebus 0755 ${localstatedir}/run/dbus none" \
+	     > ${D}${sysconfdir}/default/volatiles/99_dbus
+
+
+	mkdir -p ${D}${localstatedir}/run/dbus ${D}${localstatedir}/lib/dbus
+
+	chown messagebus:messagebus ${D}${localstatedir}/run/dbus ${D}${localstatedir}/lib/dbus
+
+	chown root:messagebus ${D}${libexecdir}/dbus-daemon-launch-helper
+	chmod 4754 ${D}${libexecdir}/dbus-daemon-launch-helper
+
 	# 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
-- 
1.7.2.5




^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/4] base-passwd: move initial criation of group and passwd to preinst
  2011-10-21 14:10 ` [PATCH 3/4] base-passwd: move initial criation of group and passwd to preinst Otavio Salvador
@ 2011-10-21 14:52   ` Mark Hatle
  2011-10-21 16:01     ` Otavio Salvador
  0 siblings, 1 reply; 12+ messages in thread
From: Mark Hatle @ 2011-10-21 14:52 UTC (permalink / raw)
  To: openembedded-core

I've seen other distributions solve this doing this by creating the passwd/group
files based on the contents of the recipe and not some external file.

So you would have a list of users/groups that need to be created with their
attributes.  In the do_install these items would be dumped into the
passwd/group.master file(s).  But also in the preinst, it would check for the
existence of the files -- if they didn't exist yet.. it would simply write out
the passwd/group files at that point.

By embedding the data in the recipe, it keeps things in sync and resolves the
chicken/egg problem.

Any opinions from folks if this is even halfway reasonable for us to consider?

(I'm guessing with some anon python code we could probably load in the
passwd/group files, place them into a variable and use the variable to embed
them within the preinst -- keeping the contents out of the recipe.)

--Mark

On 10/21/11 9:10 AM, Otavio Salvador wrote:
> To allow use and manipulation of users and groups at rootfs building
> time, the '/etc/passwd' and '/etc/group' needs to be available as soon
> as possible.
> 
> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
> ---
>  .../recipes-core/base-passwd/base-passwd_3.5.22.bb |   19 ++++++++++++++++++-
>  1 files changed, 18 insertions(+), 1 deletions(-)
> 
> diff --git a/meta/recipes-core/base-passwd/base-passwd_3.5.22.bb b/meta/recipes-core/base-passwd/base-passwd_3.5.22.bb
> index 137512d..aa90a6d 100644
> --- a/meta/recipes-core/base-passwd/base-passwd_3.5.22.bb
> +++ b/meta/recipes-core/base-passwd/base-passwd_3.5.22.bb
> @@ -1,7 +1,7 @@
>  SUMMARY = "Base system master password/group files."
>  DESCRIPTION = "The master copies of the user database files (/etc/passwd and /etc/group).  The update-passwd tool is also provided to keep the system databases synchronized with these master files."
>  SECTION = "base"
> -PR = "r3"
> +PR = "r4"
>  LICENSE = "GPLv2+"
>  LIC_FILES_CHKSUM = "file://COPYING;md5=eb723b61539feef013de476e68b5c50a"
>  
> @@ -37,6 +37,23 @@ do_install () {
>  	install -p -m 644 debian/copyright ${D}${docdir}/${BPN}/
>  }
>  
> +pkg_preinst_${PN} () {
> +	set -e
> +
> +	# Used for rootfs generation. On in-target install this will be run
> +        # before the unpack so the files won't be available
> +
> +	if [ ! -e $D${sysconfdir}/passwd ] && [ -e $D${datadir}/base-passwd/passwd.master ]; then
> +		cp $D${datadir}/base-passwd/passwd.master $D${sysconfdir}/passwd
> +	fi
> +
> +	if [ ! -e $D${sysconfdir}/group ] && [ -e $D${datadir}/base-passwd/group.master ]; then
> +		cp $D${datadir}/base-passwd/group.master $D${sysconfdir}/group
> +	fi
> +
> +	exit 0
> +}
> +
>  pkg_postinst_${PN} () {
>  	set -e
>  




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/4] base-passwd: move initial criation of group and passwd to preinst
  2011-10-21 14:52   ` Mark Hatle
@ 2011-10-21 16:01     ` Otavio Salvador
  0 siblings, 0 replies; 12+ messages in thread
From: Otavio Salvador @ 2011-10-21 16:01 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

On Fri, Oct 21, 2011 at 12:52, Mark Hatle <mark.hatle@windriver.com> wrote:
...
> Any opinions from folks if this is even halfway reasonable for us to consider?
>
> (I'm guessing with some anon python code we could probably load in the
> passwd/group files, place them into a variable and use the variable to embed
> them within the preinst -- keeping the contents out of the recipe.)

I like this idea but I'd prefer to have this merged before it.

-- 
Otavio Salvador                             O.S. Systems
E-mail: otavio@ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 4/4] dbus: use useradd class to allow use in read-only filesystems
  2011-10-21 14:10 ` [PATCH 4/4] dbus: use useradd class to allow use in read-only filesystems Otavio Salvador
@ 2011-10-21 17:03   ` Saul Wold
  2011-10-21 17:07     ` Koen Kooi
  0 siblings, 1 reply; 12+ messages in thread
From: Saul Wold @ 2011-10-21 17:03 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

On 10/21/2011 07:10 AM, Otavio Salvador wrote:
> Move creation of required user/groups to useradd class thus allowing
> use with read-only filesystems and booting the initial boot.
>
> Signed-off-by: Otavio Salvador<otavio@ossystems.com.br>
> ---
>   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 a8ecda8..2a97c02 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
>   DEPENDS_virtclass-native = "expat-native virtual/libintl-native"
>   DEPENDS_virtclass-nativesdk = "expat-nativesdk virtual/libintl-nativesdk virtual/libx11"
>
> +PR = "r1"
> +
>   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 useradd autotools pkgconfig gettext update-rc.d
>
>   INITSCRIPT_NAME = "dbus-1"
>   INITSCRIPT_PARAMS = "start 02 5 3 2 . stop 20 0 1 6 ."
>
> +USERADD_PACKAGES = "${PN}"
> +GROUPADD_PARAM_${PN} = "-r netdev"

I thought netdev was going to be removed from this recipe?

Sau!

> +USERADD_PARAM_${PN} = "--system --home ${localstatedir}/lib/dbus \
> +                       --no-create-home --user-group messagebus"
> +
>   CONFFILES_${PN} = "${sysconfdir}/dbus-1/system.conf ${sysconfdir}/dbus-1/session.conf"
>
>   DEBIANNAME_${PN} = "dbus-1"
> @@ -44,32 +51,7 @@ 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"
> -
> -	chown "$MESSAGEUSER":"$MESSAGEUSER" "$UUIDDIR"
> -
> -	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
>   }
> @@ -92,6 +74,18 @@ do_install() {
>   	install -d ${D}${sysconfdir}/init.d
>   	install -m 0755 ${WORKDIR}/dbus-1.init ${D}${sysconfdir}/init.d/dbus-1
>
> +	install -d ${D}${sysconfdir}/default/volatiles
> +	echo "d messagebus messagebus 0755 ${localstatedir}/run/dbus none" \
> +	>  ${D}${sysconfdir}/default/volatiles/99_dbus
> +
> +
> +	mkdir -p ${D}${localstatedir}/run/dbus ${D}${localstatedir}/lib/dbus
> +
> +	chown messagebus:messagebus ${D}${localstatedir}/run/dbus ${D}${localstatedir}/lib/dbus
> +
> +	chown root:messagebus ${D}${libexecdir}/dbus-daemon-launch-helper
> +	chmod 4754 ${D}${libexecdir}/dbus-daemon-launch-helper
> +
>   	# 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




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 4/4] dbus: use useradd class to allow use in read-only filesystems
  2011-10-21 17:03   ` Saul Wold
@ 2011-10-21 17:07     ` Koen Kooi
  0 siblings, 0 replies; 12+ messages in thread
From: Koen Kooi @ 2011-10-21 17:07 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer


Op 21 okt. 2011, om 19:03 heeft Saul Wold het volgende geschreven:

> On 10/21/2011 07:10 AM, Otavio Salvador wrote:
>> Move creation of required user/groups to useradd class thus allowing
>> use with read-only filesystems and booting the initial boot.
>> 
>> Signed-off-by: Otavio Salvador<otavio@ossystems.com.br>
>> ---
>>  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 a8ecda8..2a97c02 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
>>  DEPENDS_virtclass-native = "expat-native virtual/libintl-native"
>>  DEPENDS_virtclass-nativesdk = "expat-nativesdk virtual/libintl-nativesdk virtual/libx11"
>> 
>> +PR = "r1"
>> +
>>  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 useradd autotools pkgconfig gettext update-rc.d
>> 
>>  INITSCRIPT_NAME = "dbus-1"
>>  INITSCRIPT_PARAMS = "start 02 5 3 2 . stop 20 0 1 6 ."
>> 
>> +USERADD_PACKAGES = "${PN}"
>> +GROUPADD_PARAM_${PN} = "-r netdev"
> 
> I thought netdev was going to be removed from this recipe?

let's do that as follow up so it bisects cleanly. Changing 2 things at once never works for me :)

regards,

Koen


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2011-10-21 17:13 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-21 14:10 [PATCH 0/4 v2] Fixes and improvements Otavio Salvador
2011-10-21 14:10 ` [PATCH 1/4] bootimg.bbclass: add support to disable HDD image building Otavio Salvador
2011-10-21 14:10 ` [PATCH 2/4] useradd.bbclass: check if a group already exists manually Otavio Salvador
2011-10-21 14:10 ` [PATCH 3/4] base-passwd: move initial criation of group and passwd to preinst Otavio Salvador
2011-10-21 14:52   ` Mark Hatle
2011-10-21 16:01     ` Otavio Salvador
2011-10-21 14:10 ` [PATCH 4/4] dbus: use useradd class to allow use in read-only filesystems Otavio Salvador
2011-10-21 17:03   ` Saul Wold
2011-10-21 17:07     ` Koen Kooi
  -- strict thread matches above, loose matches on Subject: below --
2011-10-21  3:31 [PATCH 0/4] Fixes and improvements from O.S. Systems Otavio Salvador
2011-10-21  3:31 ` [PATCH 4/4] dbus: use useradd class to allow use in read-only filesystems Otavio Salvador
2011-10-21  6:54   ` Phil Blundell
2011-10-21  7:05     ` Koen Kooi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox