cross-helper is a patched, minimal busybox build containing modules for native manipulation of a cross-compiled system. It currently contains modules for groupadd, useradd, deluser, delgroup, and passwd. Given that the maintainers of shadow-utils are not interested in native support of a cross-compiled system (from what I've heard on it's IRC channel), that the current implementation of groupadd and useradd in portage (eutils.eclass) checks and/or manipulates files in /etc, not ${ROOT}/etc, and that gentoo is an invaluable resource for cross-compilation, this build would solve a lot of headaches. The useradd and groupadd modules have been altered to accept parameters similar to shadow (and passed by enewuser & enewgroup). eg. cross-helper useradd -g foo -G bar,baz -c "Added by portage" -s /sbin/nologin user It fails unless ROOT is an environment variable (and not /) and acts on files relative to ROOT. eg. /usr/armv4tl-softfloat-linux-gnueabi/etc/shadow if ROOT="/usr/armv4tl-softfloat-linux-gnueabi" It's functionality is supported in portage with a minimal patch to eutils.eclass (which I'll post as another bug and reference here). NB: I extensively tested and debugged it on my own system but I'm new to c so if anyone wants to alter it, feel free. I'm open to suggestions.
Created attachment 217691 [details] cross-helper-1.15.3.ebuild sys-apps/cross-helper/cross-helper-1.15.3.ebuild
Created attachment 217692 [details, diff] cross-helper-portagecompat.patch sys-apps/cross-helper/files/cross-helper-portagecompat.patch
related patch for eutils.eclass at bug# 302572
This looks pretty cool to me, assigning to embedded team to see if they want to take this on.
(In reply to comment #0) > Given that the maintainers of shadow-utils are not interested in native > support of a cross-compiled system (from what I've heard on it's IRC > channel) In the gentoo-embedded email thread it was discussed to add a parameter to the utilities in question that would call chroot() very early in the program. This solution was discussed with shadow maintainers also on IRC and the response was very good - a patch to implement this would be welcomed by them. I thought I'd work on creating that whenever I found some time.. ;)
yes, that is the way to go -- add a chroot flag (-R or something) to all the shadow utilities. we're not going to hack random packages (like busybox) to add random logic (like chroot) in this way.