From: Scott Garman <scott.a.garman@intel.com>
To: openembedded-core@lists.openembedded.org
Subject: Re: [PATCH 2/4] useradd.bbclass: check if a group already exists manually
Date: Thu, 20 Oct 2011 20:41:52 -0700 [thread overview]
Message-ID: <4EA0EA00.1050800@intel.com> (raw)
In-Reply-To: <9c3cff6e514e8ccc69b9462197c7bceeb117a55e.1319167843.git.otavio@ossystems.com.br>
On 10/20/2011 08:31 PM, Otavio Salvador wrote:
> 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>
Thanks for getting to the bottom of this!
Acked-by: Scott Garman <scott.a.garman@intel.com>
> ---
> 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
--
Scott Garman
Embedded Linux Engineer - Yocto Project
Intel Open Source Technology Center
next prev parent reply other threads:[~2011-10-21 3:47 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-21 3:31 [PATCH 0/4] Fixes and improvements from O.S. Systems Otavio Salvador
2011-10-21 3:31 ` [PATCH 1/4] bootimg.bbclass: add support to disable HDD image building Otavio Salvador
2011-10-21 6:07 ` Khem Raj
2011-10-21 12:27 ` Otavio Salvador
2011-10-21 15:57 ` Khem Raj
2011-10-21 3:31 ` [PATCH 2/4] useradd.bbclass: check if a group already exists manually Otavio Salvador
2011-10-21 3:41 ` Scott Garman [this message]
2011-10-21 3:31 ` [PATCH 3/4] base-passwd: move initial criation of group and passwd to preinst Otavio Salvador
2011-10-21 3:41 ` Scott Garman
2011-10-21 6:52 ` Phil Blundell
2011-10-21 12:05 ` 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
-- strict thread matches above, loose matches on Subject: below --
2011-10-21 14:10 [PATCH 0/4 v2] Fixes and improvements Otavio Salvador
2011-10-21 14:10 ` [PATCH 2/4] useradd.bbclass: check if a group already exists manually Otavio Salvador
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=4EA0EA00.1050800@intel.com \
--to=scott.a.garman@intel.com \
--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