From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga09.intel.com ([134.134.136.24]) by linuxtogo.org with esmtp (Exim 4.72) (envelope-from ) id 1RI2rH-0005xS-BH for openembedded-core@lists.openembedded.org; Sun, 23 Oct 2011 20:33:19 +0200 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 23 Oct 2011 11:27:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.67,352,1309762800"; d="scan'208";a="66250224" Received: from unknown (HELO swold-mobl.lan) ([10.255.14.219]) by orsmga001.jf.intel.com with ESMTP; 23 Oct 2011 11:27:21 -0700 From: Saul Wold To: openembedded-core@lists.openembedded.org Date: Sun, 23 Oct 2011 11:26:45 -0700 Message-Id: X-Mailer: git-send-email 1.7.6.4 In-Reply-To: References: In-Reply-To: References: Subject: [CONSOLIDATED PULL 07/27] useradd.bbclass: check if a group already exists manually X-BeenThere: openembedded-core@lists.openembedded.org X-Mailman-Version: 2.1.11 Precedence: list Reply-To: Patches and discussions about the oe-core layer List-Id: Patches and discussions about the oe-core layer List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Oct 2011 18:33:19 -0000 From: Otavio Salvador 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 --- 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.6.4